Creativity meets precision at Maxobiz
where we bring your vision to life
through professional video
editing and storytelling

Learn More

We craft stunning visual designs
that capture attention, services from our communicate messages effectively,
and elevateyour brand to the next level

Learn More

Grow your brand’s online presence
with tailored data-driven digital marketing
strategies that deliver measurable results.

Learn More

Transform Your Brand with Stunning
Web Development & Design
– Crafting Unique, User-Centric
Digital Experiences.

Learn More

Custom Web Development vs. WordPress: Why a Customized WordPress Website is the Best Choice

Custom Web Development vs. WordPress: Why a Customized WordPress Website is the Best Choice

A website is more than an online platform because it is a shop for businesses. Its development plays an important role in its working and ranking. That is why, it is important to choose the right source for its development. It is a big conflict between custom development and WordPress development as both have advantages and disadvantages.

In this blog post, we will mainly focus on the preference of custom web development over WordPress. To illustrate this point, we will provide a detailed comparison. Further, we will suggest a platform where you can seek assistance for custom development.

Preference for Custom Web Development over WordPress

According to my opinion, it is a great idea to develop your website with original codes rather than easy templates. No doubt, it is a complex and difficult process that you cannot do with the help of an experienced developer, but later on, it will give you a lot of benefits.

Custom Web Development vs. WordPress

Custom web development means designing a website from the ground up using programming languages like HTML, CSS, JavaScript, and frameworks such as React or Laravel. There are the following pros and cons of custom web development:

Custom Web Development vs. WordPress Why a Customized

Pros of Custom Web Development:

Unlimited Flexibility:

This means of web development offers unlimited flexibility. It means that developers can design your website according to the specificity of your business. Further, they can add or cancel anything from the website structure whenever there is a need.

Related Article: Why Your Business Needs Corporate Software Development Now

Unique Design:

Through custom web development, you can design your website uniquely. In WordPress development, templates are similar to each other removing uniqueness from the website. Thus, developers can design a creative and different website that can stand unique in a crowded marketplace.

Scalability:

Scalability is important for the growth of a business website. That is why, a customized website is designed to scale seamlessly as your business grows. These sites can accommodate new features, traffic, and integrations with time.

Performance Optimization:

Customized sites are free of unnecessary plugins. These plugins can slow down a site. That is why, custom website development is preferred over WordPress development. Performance optimization is very easy and fast in this way.

Cons of Custom Web Development

High Cost:

If you have a tight budget, then you will neglect this option. Developing a website from the base needs a lot of time, effort, and technical expertise. All these things make it expensive. Developers charge hundreds of dollars for developing a customized site.

Longer Development Time:

As you know, designing a customized site needs the incorporation of every code skillfully and carefully. Any single mistake in the code will lead to many errors. That is why, developers take a long time to design every page. It will not be suitable for you if you are running short of time.

Complex Maintenance:

The process of a customized website is complex. That is why, its maintenance is also complex and difficult. A layman cannot maintain its website without the help of a skillful developer. Further, this maintenance also costs a lot.

Limited Accessibility:

Customized websites provide limited accessibility. An owner of the business or website cannot make changes to it unless a developer helps him or her. Non-technical users find it challenging to manage content or make updates on this kind of site.

Pros of WordPress Development:

WordPress is a famous content management system (CMS) that helps over 40% of websites worldwide. It provides a wide range of themes and plugins by which business owners can design their websites easily.

There are the following advantages of WordPress Development:

Cost-Effective:

In the war of custom website development cost versus WordPress cost, the latter wins. It means that WordPress websites are affordable, especially for small businesses. In this, mainly themes are used, so developers charge less money.

Related Article: Ring In 2025 With A New Website: What You Need to Know About Costs

Ease of Use:

These websites are easy to use and handle. Non-technical users can update content, upload images, and manage the site easily with the help of its dashboard. Any business owner can handle their WordPress website easily without the help of a developer.

Vast Plugin Library:

This type of development provides a wide range of plugins to the users. These plugins include e-commerce, SEO tools, or analytics. You can add any of these features easily to your site according to your business needs.

SEO-Friendly:

WordPress websites are designed with the algorithms of SEO in the backend. That is why, they are more SEO-friendly as compared to customized sites where users have to invest a lot of time and skills to make it SEO-friendly.

Quick Setup:

As in WordPress development, pre-designed themes are offered. Coders do not invest a lot of time, and they just use these themes to make them usable. You can launch your business on this site without wasting time.

Cons of WordPress Development

Limited Customization:

You cannot make your site specific according to your brand. You will use pre-designed themes and will implement them in your business.

Performance Issues:

Overloading a WordPress site with plugins can slow it down. Thus, it provides a lot of performance issues that a user cannot focus on the business but on its performance errors.

Security Vulnerabilities:

These websites are not as secure as customized websites. There are a l lot of chances of hacking if you cannot maintain them properly with updates and security plugins.

Scalability Limitations:

These websites are less scalable as compared to customized websites. These sites cannot grow with time with your business especially when your business has a large and complex niche.

Customized WordPress Development: The Best of Both Worlds

After reading the above pros and cons of both development options, you can make a mid-way decision. You can customize a WordPress website. It offers the perfect middle ground, combining the flexibility of custom development with the cost-effectiveness and user-friendliness of WordPress.

Tailored to Your Needs:

Developers can change the themes according to your business goals. They can add bespoke plugins, and build unique functionalities in your site.

Cost-Effective Customization:

Customizing a WordPress website is more affordable as compared to customizing a whole website. Now, you can get the taste of customization in less price.

Faster Time to Market:

In this case, developers will focus on the changes they have to make to the themes. They will invest their time in extra coding. Thus, your website will be ready in a short time.

Easy Maintenance:

WordPress’s user-friendly interface remains intact. You can handle the day-to-day updates without depending on developers.

Choosing a Custom WordPress Development Agency:

Ready to make your business customized? Then, choose a perfect custom WordPress Development Agency that can offer both services. Finding a professional and authentic firm is a bit difficult in this digital age. So, never trust one, but explore all the agencies and rule out the one like Maxobiz.

Why Choose Our Customized WordPress Development Services:

Our customized WordPress websites are exceptional and deliver performance and user experiences. Our team of expert developers combines creativity with technical expertise to build sites according to your business needs. We offer:

  • Specific theme customization
  • Bespoke plugin development for specific functionalities
  • SEO-optimized designs for better ranking
  • Responsive layouts for a seamless experience across many devices
  • Instant support and maintenance for your site

Conclusion:

In conclusion, choosing the best means of development for your website is necessary. Both solutions provide different pros and cons. Custom websites provide flexibility, but WordPress websites offer cost-effectiveness. With the help of customized WordPress development, you can achieve a balance of flexibility, cost-effectiveness, and usability.

Choose Maxobiz for a wide range of customized WordPress websites. We are enthusiastic to provide you with quality work that will rank your business. So, let our team help you build a website that elevates your business.

FAQs:

Q: What is the difference between WordPress and a custom website?

A: A custom website is a site that is designed by developers and coders from the base and it provides flexibility to the users. A WordPress website is designed by using a CMS which offers templates and plugins for ease of use.

Q: Is WordPress better than web development?

A: It depends on your business needs. If your business is small, and you cannot invest a lot then it is a good option.

Q: Is it better to code your website or use WordPress?

A: It also depends on your business requirements. If your business is complex, you have to make regular changes and you can invest a lot, then it is a good choice.

Q: What is the difference between WordPress and custom HTML?

A: WordPress is a CMS that simplifies website management with themes and plugins. Custom HTML involves writing code manually and offers greater flexibility but requires more technical skills.

0;)Xo[Vr]&&Xo[Vr].update(0,i);cs=1}else for(Vr=0;Vr20),n-=n-x} if(o){var w=t+n,S=o._isStart;f="scroll"+i.d2,qo(o,w,i,S&&w>20||!S&&(c?Math.max(Lr[f],Pr[f]):o.parentNode[f])<=w+1),c&&(l=Oo(s),c&&(o.style[i.op.p]=l[i.op.p]-i.op.m-o._offset+Po))} return d&&m&&(f=Oo(m),d.seek(h),p=Oo(m),d._caScrollDist=f[i.p]-p[i.p],t=t/d._caScrollDist*h),d&&d.seek(g),d?t:Math.round(t)},ys=/(webkit|moz|length|cssText|inset)/i,bs=function(t,e,n,i){if(t.parentNode!==e){var r,o,s=t.style;if(e===Lr){for(r in t._stOrig=s.cssText,o=Lo(t))+r||ys.test(r)||!o[r]||"string"!=typeof s[r]||"0"===r||(s[r]=o[r]);s.top=n,s.left=i}else s.cssText=t._stOrig;Tr.core.getCache(t).uncache=1,e.appendChild(t)}},ws=function(t,e){var n,i,r=xr(t,e),o="_scroll"+e.p2,s=function e(s,a,l,u,c){var h=e.tween,d=a.onComplete,f={};return l=l||r(),c=u&&c||0,u=u||s-l,h&&h.kill(),n=Math.round(l),a[o]=s,a.modifiers=f,f[o]=function(t){return(t=Math.round(r()))!==n&&t!==i&&Math.abs(t-n)>3&&Math.abs(t-i)>3?(h.kill(),e.tween=0):t=l+u*h.ratio+c*h.ratio*h.ratio,i=n,n=Math.round(t)},a.onUpdate=function(){sr.cache++,hs()},a.onComplete=function(){e.tween=0,d&&d.call(h)},h=e.tween=Tr.to(t,a)};return t[o]=r,r.wheelHandler=function(){return s.tween&&s.tween.kill()&&(s.tween=0)},ko(t,"wheel",r.wheelHandler),s},Ss=function(){function t(e,n){Er||t.register(Tr)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),this.init(e,n)} return t.prototype.init=function(e,n){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),co){var i,r,o,s,a,l,u,c,h,d,f,p,m,g,v,_,x,y,b,w,S,M,D,T,E,C,A,P,L,R,O,F,I,N,z,k,U,B,V,H,G,W,j=e=Ro(wo(e)||Mo(e)||e.nodeType?{trigger:e}:e,Ho),q=j.onUpdate,X=j.toggleClass,Y=j.id,Z=j.onToggle,K=j.onRefresh,J=j.scrub,Q=j.trigger,$=j.pin,tt=j.pinSpacing,et=j.invalidateOnRefresh,nt=j.anticipatePin,it=j.onScrubComplete,rt=j.onSnapComplete,ot=j.once,st=j.snap,at=j.pinReparent,lt=j.pinSpacer,ut=j.containerAnimation,ct=j.fastScrollEnd,ht=j.preventOverlaps,dt=e.horizontal||e.containerAnimation&&!1!==e.horizontal?gr:vr,ft=!J&&0!==J,pt=_r(e.scroller||Cr),mt=Tr.core.getCache(pt),gt=_o(pt),vt="fixed"===("pinType" in e?e.pinType:cr(pt,"pinType")||gt&&"fixed"),_t=[e.onEnter,e.onLeave,e.onEnterBack,e.onLeaveBack],xt=ft&&e.toggleActions.split(" "),yt="markers" in e?e.markers:Ho.markers,bt=gt?0:parseFloat(Lo(pt)["border"+dt.p2+"Width"])||0,wt=this,St=e.onRefreshInit&&function(){return e.onRefreshInit(wt)},Mt=function(t,e,n){var i=n.d,r=n.d2,o=n.a;return(o=cr(t,"getBoundingClientRect"))?function(){return o()[i]}:function(){return(e?Cr["inner"+r]:t["client"+r])||0}}(pt,gt,dt),Dt=function(t,e){return!e||~ar.indexOf(t)?xo(t):function(){return _s}}(pt,gt),Tt=0,Et=0,Ct=xr(pt,dt);if($r(wt),wt._dir=dt,nt*=45,wt.scroller=pt,wt.scroll=ut?ut.time.bind(ut):Ct,s=Ct(),wt.vars=e,n=n||e.animation,"refreshPriority" in e&&(jr=1,-9999===e.refreshPriority&&(oo=wt)),mt.tweenScroll=mt.tweenScroll||{top:ws(pt,vr),left:ws(pt,gr)},wt.tweenTo=i=mt.tweenScroll[dt.p],wt.scrubDuration=function(t){(F=Mo(t)&&t)?O?O.duration(t):O=Tr.to(n,{ease:"expo",totalProgress:"+=0.001",duration:F,paused:!0,onComplete:function(){return it&&it(wt)}}):(O&&O.progress(1).kill(),O=0)},n&&(n.vars.lazy=!1,n._initted||!1!==n.vars.immediateRender&&!1!==e.immediateRender&&n.duration()&&n.render(0,!0,!0),wt.animation=n.pause(),n.scrollTrigger=wt,wt.scrubDuration(J),L=0,Y||(Y=n.vars.id)),Xo.push(wt),st&&(Do(st)&&!st.push||(st={snapTo:st}),"scrollBehavior" in Lr.style&&Tr.set(gt?[Lr,Pr]:pt,{scrollBehavior:"auto"}),sr.forEach((function(t){return So(t)&&t.target===(gt?Ar.scrollingElement||Pr:pt)&&(t.smooth=!1)})),o=So(st.snapTo)?st.snapTo:"labels"===st.snapTo?function(t){return function(e){return Tr.utils.snap(Io(t),e)}}(n):"labelsDirectional"===st.snapTo?(H=n,function(t,e){return No(Io(H))(t,e.direction)}):!1!==st.directional?function(t,e){return No(st.snapTo)(t,ao()-Et<500?0:e.direction)}:Tr.utils.snap(st.snapTo),I=st.duration||{min:.1,max:2},I=Do(I)?Ir(I.min,I.max):Ir(I,I),N=Tr.delayedCall(st.delay||F/2||.1,(function(){var t=Ct(),e=ao()-Et<500,r=i.tween;if(!(e||Math.abs(wt.getVelocity())<10)||r||Ur||Tt===t)wt.isActive&&Tt!==t&&N.restart(!0);else{var s=(t-l)/m,a=n&&!ft?n.totalProgress():s,c=e?0:(a-R)/(ao()-Nr)*1e3||0,h=Tr.utils.clamp(-s,1-s,Co(c/2)*c/.185),d=s+(!1===st.inertia?0:h),f=Ir(0,1,o(d,wt)),p=Math.round(l+f*m),g=st,v=g.onStart,_=g.onInterrupt,x=g.onComplete;if(t<=u&&t>=l&&p!==t){if(r&&!r._initted&&r.data<=Co(p-t))return;!1===st.inertia&&(h=f-s),i(p,{duration:I(Co(.185*Math.max(Co(d-a),Co(f-a))/c/.05||0)),ease:st.ease||"power3",data:Co(p-t),onInterrupt:function(){return N.restart(!0)&&_&&_(wt)},onComplete:function(){wt.update(),Tt=Ct(),L=R=n&&!ft?n.totalProgress():wt.progress,rt&&rt(wt),x&&x(wt)}},t,h*m,p-t-h*m),v&&v(wt,i.tween)}}})).pause()),Y&&(Yo[Y]=wt),(V=(Q=wt.trigger=_r(Q||$))&&Q._gsap&&Q._gsap.stRevert)&&(V=V(wt)),$=!0===$?Q:_r($),wo(X)&&(X={targets:Q,className:X}),$&&(!1===tt||"margin"===tt||(tt=!(!tt&&$.parentNode&&$.parentNode.style&&"flex"===Lo($.parentNode).display)&&Ao),wt.pin=$,(r=Tr.core.getCache($)).spacer?g=r.pinState:(lt&&((lt=_r(lt))&&!lt.nodeType&&(lt=lt.current||lt.nativeElement),r.spacerIsNative=!!lt,lt&&(r.spacerState=vs(lt))),r.spacer=x=lt||Ar.createElement("div"),x.classList.add("pin-spacer"),Y&&x.classList.add("pin-spacer-"+Y),r.pinState=g=vs($)),!1!==e.force3D&&Tr.set($,{force3D:!0}),wt.spacer=x=r.spacer,P=Lo($),D=P[tt+dt.os2],b=Tr.getProperty($),w=Tr.quickSetter($,dt.a,Po),ps($,x,P),_=vs($)),yt){p=Do(yt)?Ro(yt,Vo):Vo,d=jo("scroller-start",Y,pt,dt,p,0),f=jo("scroller-end",Y,pt,dt,p,0,d),y=d["offset"+dt.op.d2];var At=_r(cr(pt,"content")||pt);c=this.markerStart=jo("start",Y,At,dt,p,y,0,ut),h=this.markerEnd=jo("end",Y,At,dt,p,y,0,ut),ut&&(B=Tr.quickSetter([c,h],dt.a,Po)),vt||ar.length&&!0===cr(pt,"fixedMarkers")||(W=Lo(G=gt?Lr:pt).position,G.style.position="absolute"===W||"fixed"===W?W:"relative",Tr.set([d,f],{force3D:!0}),E=Tr.quickSetter(d,dt.a,Po),A=Tr.quickSetter(f,dt.a,Po))} if(ut){var Pt=ut.vars.onUpdate,Lt=ut.vars.onUpdateParams;ut.eventCallback("onUpdate",(function(){wt.update(0,0,1),Pt&&Pt.apply(Lt||[])}))} wt.previous=function(){return Xo[Xo.indexOf(wt)-1]},wt.next=function(){return Xo[Xo.indexOf(wt)+1]},wt.revert=function(t,e){if(!e)return wt.kill(!0);var i=!1!==t||!wt.enabled,r=kr;i!==wt.isReverted&&(i&&(k=Math.max(Ct(),wt.scroll.rec||0),z=wt.progress,U=n&&n.progress()),c&&[c,h,d,f].forEach((function(t){return t.style.display=i?"none":"block"})),i&&(kr=1,wt.update(i)),!$||at&&wt.isActive||(i?function(t,e,n){gs(n);var i=t._gsap;if(i.spacerIsNative)gs(i.spacerState);else if(t._gsap.swappedIn){var r=e.parentNode;r&&(r.insertBefore(t,e),r.removeChild(e))} t._gsap.swappedIn=!1}($,x,g):ps($,x,Lo($),T)),i||wt.update(i),kr=r,wt.isReverted=i)},wt.refresh=function(r,o){if(!kr&&wt.enabled||o) if($&&r&&uo)ko(t,"scrollEnd",es);else{!io&&St&&St(wt),kr=1,Et=ao(),i.tween&&(i.tween.kill(),i.tween=0),O&&O.pause(),et&&n&&n.revert({kill:!1}).invalidate(),wt.isReverted||wt.revert(!0,!0),wt._subPinOffset=!1;for(var p,y,w,D,E,A,P,L,R,F,I,B=Mt(),V=Dt(),H=ut?ut.duration():yo(pt,dt),G=0,W=0,j=e.end,q=e.endTrigger||Q,X=e.start||(0!==e.start&&Q?$?"0 0":"0 100%":0),Y=wt.pinnedContainer=e.pinnedContainer&&_r(e.pinnedContainer),Z=Q&&Math.max(0,Xo.indexOf(wt))||0,J=Z;J--;)(A=Xo[J]).end||A.refresh(0,1)||(kr=1),!(P=A.pin)||P!==Q&&P!==$||A.isReverted||(F||(F=[]),F.unshift(A),A.revert(!0,!0)),A!==Xo[J]&&(Z--,J--);for(So(X)&&(X=X(wt)),l=xs(X,Q,B,dt,Ct(),c,d,wt,V,bt,vt,H,ut)||($?-.001:0),So(j)&&(j=j(wt)),wo(j)&&!j.indexOf("+=")&&(~j.indexOf(" ")?j=(wo(X)?X.split(" ")[0]:"")+j:(G=Wo(j.substr(2),B),j=wo(X)?X:l+G,q=Q)),u=Math.max(l,xs(j||(q?"100% 0":H),q,B,dt,Ct()+G,h,f,wt,V,bt,vt,H,ut))||-.001,m=u-l||(l-=.01)&&.001,G=0,J=Z;J--;)(P=(A=Xo[J]).pin)&&A.start-A._pinPush<=l&&!ut&&A.end>0&&(p=A.end-A.start,(P===Q&&A.start-A._pinPush1&&((I={style:I=(gt?Ar.scrollingElement||Pr:pt).style,value:I["overflow"+dt.a.toUpperCase()]})["overflow"+dt.a.toUpperCase()]="scroll"),ps($,x,p),_=vs($),y=Oo($,!0),L=vt&&xr(pt,D?gr:vr)(),tt&&((T=[tt+dt.os2,m+W+Po]).t=x,(J=tt===Ao?Fo($,dt)+m+W:0)&&T.push(dt.d,J+Po),gs(T),Y&&Xo.forEach((function(t){t.pin===Y&&!1!==t.vars.pinSpacing&&(t._subPinOffset=!0)})),vt&&Ct(k)),vt&&((E={top:y.top+(D?w-l:L)+Po,left:y.left+(D?L:w-l)+Po,boxSizing:"border-box",position:"fixed"}).width=E.maxWidth=Math.ceil(y.width)+Po,E.height=E.maxHeight=Math.ceil(y.height)+Po,E.margin=E.marginTop=E.marginRight=E.marginBottom=E.marginLeft="0",E[Ao]=p[Ao],E[Ao+"Top"]=p[Ao+"Top"],E[Ao+"Right"]=p[Ao+"Right"],E[Ao+"Bottom"]=p[Ao+"Bottom"],E[Ao+"Left"]=p[Ao+"Left"],v=function(t,e,n){for(var i,r=[],o=t.length,s=n?8:0;s1,vt&&C&&v.splice(v.length-2,2),n.render(0,!0,!0),R||n.invalidate(!0),n.parent||n.totalTime(n.totalTime()),qr(0)):M=m,I&&(I.value?I.style["overflow"+dt.a.toUpperCase()]=I.value:I.style.removeProperty("overflow-"+dt.a));else if(Q&&Ct()&&!ut) for(y=Q.parentNode;y&&y!==Lr;)y._pinOffset&&(l-=y._pinOffset,u-=y._pinOffset),y=y.parentNode;F&&F.forEach((function(t){return t.revert(!1,!0)})),wt.start=l,wt.end=u,s=a=io?k:Ct(),ut||io||(s0?Xo.slice(0,e).reverse():Xo.slice(e+1);return(wo(t)?n.filter((function(e){return e.vars.preventOverlaps===t})):n).filter((function(t){return wt.direction>0?t.end<=l:t.start>=u}))},wt.update=function(t,e,r){if(!ut||r||t){var o,c,h,f,p,g,y,b=io?k:wt.scroll(),T=t?0:(b-l)/m,P=T<0?0:T>1?1:T||0,F=wt.progress;if(e&&(a=s,s=ut?Ct():b,st&&(R=L,L=n&&!ft?n.totalProgress():P)),nt&&!P&&$&&!kr&&!so&&uo&&lF?1:-1,wt.progress=P,f&&!kr&&(c=P&&!F?0:1===P?1:1===F?2:3,ft&&(h=!p&&"none"!==xt[c+1]&&xt[c+1]||xt[c],y=n&&("complete"===h||"reset"===h||h in n))),ht&&(p||y)&&(y||J||!n)&&(So(ht)?ht(wt):wt.getTrailing(ht).forEach((function(t){return t.endAnimation()}))),ft||(!O||kr||so?n&&n.totalProgress(P,!!kr):(O._dp._time-O._start!==O._time&&O.render(O._dp._time-O._start),O.resetTo?O.resetTo("totalProgress",P,n._tTime/n._tDur):(O.vars.totalProgress=P,O.invalidate().restart()))),$) if(t&&tt&&(x.style[tt+dt.os2]=D),vt){if(f){if(g=!t&&P>F&&u+1>b&&b+1>=yo(pt,dt),at) if(t||!o&&!g)bs($,x);else{var I=Oo($,!0),z=b-l;bs($,Lr,I.top+(dt===vr?z:0)+Po,I.left+(dt===vr?0:z)+Po)}gs(o||g?v:_),C&&P<1&&o||w(S+(1!==P||g?0:M))}}else w(mo(S+M*P));st&&!i.tween&&!kr&&!so&&N.restart(!0),X&&(p||ot&&P&&(P<1||!eo))&&Fr(X.targets).forEach((function(t){return t.classList[o||ot?"add":"remove"](X.className)})),q&&!ft&&!t&&q(wt),f&&!kr?(ft&&(y&&("complete"===h?n.pause().totalProgress(1):"reset"===h?n.restart(!0).pause():"restart"===h?n.restart(!0):n[h]()),q&&q(wt)),!p&&eo||(Z&&p&&Eo(wt,Z),_t[c]&&Eo(wt,_t[c]),ot&&(1===P?wt.kill(!1,1):_t[c]=0),p||_t[c=1===P?1:3]&&Eo(wt,_t[c])),ct&&!o&&Math.abs(wt.getVelocity())>(Mo(ct)?ct:2500)&&(To(wt.callbackAnimation),O?O.progress(1):To(n,"reverse"===h?1:!P,1))):ft&&q&&!kr&&q(wt)} if(A){var U=ut?b/ut.duration()*(ut._caScrollDist||0):b;E(U+(d._isFlipped?1:0)),A(U)} B&&B(-b/ut.duration()*(ut._caScrollDist||0))}},wt.enable=function(e,n){wt.enabled||(wt.enabled=!0,ko(pt,"resize",Qo),ko(gt?Ar:pt,"scroll",Ko),St&&ko(t,"refreshInit",St),!1!==e&&(wt.progress=z=0,s=a=Tt=Ct()),!1!==n&&wt.refresh())},wt.getTween=function(t){return t&&i?i.tween:O},wt.setPositions=function(t,e){$&&(S+=t-l,M+=e-t-m,tt===Ao&&wt.adjustPinSpacing(e-t-m)),wt.start=l=t,wt.end=u=e,m=e-t,wt.update()},wt.adjustPinSpacing=function(t){if(T){var e=T.indexOf(dt.d)+1;T[e]=parseFloat(T[e])+t+Po,T[1]=parseFloat(T[1])+t+Po,gs(T)}},wt.disable=function(e,n){if(wt.enabled&&(!1!==e&&wt.revert(!0,!0),wt.enabled=wt.isActive=!1,n||O&&O.pause(),k=0,r&&(r.uncache=1),St&&Uo(t,"refreshInit",St),N&&(N.pause(),i.tween&&i.tween.kill()&&(i.tween=0)),!gt)){for(var o=Xo.length;o--;) if(Xo[o].scroller===pt&&Xo[o]!==wt)return;Uo(pt,"resize",Qo),Uo(pt,"scroll",Ko)}},wt.kill=function(t,i){wt.disable(t,i),O&&!i&&O.kill(),Y&&delete Yo[Y];var o=Xo.indexOf(wt);o>=0&&Xo.splice(o,1),o===Vr&&cs>0&&Vr--,o=0,Xo.forEach((function(t){return t.scroller===wt.scroller&&(o=1)})),o||io||(wt.scroll.rec=0),n&&(n.scrollTrigger=null,t&&n.revert({kill:!1}),i||n.kill()),c&&[c,h,d,f].forEach((function(t){return t.parentNode&&t.parentNode.removeChild(t)})),oo===wt&&(oo=0),$&&(r&&(r.uncache=1),o=0,Xo.forEach((function(t){return t.pin===$&&o++})),o||(r.spacer=0)),e.onKill&&e.onKill(wt)},wt.enable(!1,!1),V&&V(wt),n&&n.add&&!m?Tr.delayedCall(.01,(function(){return l||u||wt.refresh()}))&&(m=.01)&&(l=u=0):wt.refresh(),$&&function(){if(ro!==as){var t=ro=as;requestAnimationFrame((function(){return t===as&&ls(!0)}))}}()}else this.update=this.refresh=this.kill=po},t.register=function(e){return Er||(Tr=e||vo(),go()&&window.document&&t.enable(),Er=co),Er},t.defaults=function(t){if(t) for(var e in t)Ho[e]=t[e];return Ho},t.disable=function(t,e){co=0,Xo.forEach((function(n){return n[e?"kill":"disable"](t)})),Uo(Cr,"wheel",Ko),Uo(Ar,"scroll",Ko),clearInterval(zr),Uo(Ar,"touchcancel",po),Uo(Lr,"touchstart",po),zo(Uo,Ar,"pointerdown,touchstart,mousedown",ho),zo(Uo,Ar,"pointerup,touchend,mouseup",fo),Or.kill(),bo(Uo);for(var n=0;n0&&i.left+r0&&i.top+r=0&&is.splice(e,5),is.push(t,t.style.cssText,t.getBBox&&t.getAttribute("transform"),Tr.core.getCache(t),$r())}})):is},Ss.revert=function(t,e){return os(!t,e)},Ss.create=function(t,e){return new Ss(t,e)},Ss.refresh=function(t){return t?Qo():(Er||Ss.register())&&ls(!0)},Ss.update=function(t){return++sr.cache&&hs(!0===t?2:0)},Ss.clearScrollMemory=ss,Ss.maxScroll=function(t,e){return yo(t,e?gr:vr)},Ss.getScrollFunc=function(t,e){return xr(_r(t),e?gr:vr)},Ss.getById=function(t){return Yo[t]},Ss.getAll=function(){return Xo.filter((function(t){return"ScrollSmoother"!==t.vars.id}))},Ss.isScrolling=function(){return!!uo},Ss.snapDirectional=No,Ss.addEventListener=function(t,e){var n=$o[t]||($o[t]=[]);~n.indexOf(e)||n.push(e)},Ss.removeEventListener=function(t,e){var n=$o[t],i=n&&n.indexOf(e);i>=0&&n.splice(i,1)},Ss.batch=function(t,e){var n,i=[],r={},o=e.interval||.016,s=e.batchMax||1e9,a=function(t,e){var n=[],i=[],r=Tr.delayedCall(o,(function(){e(n,i),n=[],i=[]})).pause();return function(t){n.length||r.restart(!0),n.push(t.trigger),i.push(t),s<=n.length&&r.progress(1)}};for(n in e)r[n]="on"===n.substr(0,2)&&So(e[n])&&"onRefreshInit"!==n?a(0,e[n]):e[n];return So(s)&&(s=s(),ko(Ss,"refresh",(function(){return s=e.batchMax()}))),Fr(t).forEach((function(t){var e={};for(n in r)e[n]=r[n];e.trigger=t,i.push(Ss.create(e))})),i};var Ms,Ds=function(t,e,n,i){return e>i?t(i):e<0&&t(0),n>i?(i-e)/(n-e):n<0?e/(e-n):1},Ts=function t(e,n){!0===n?e.style.removeProperty("touch-action"):e.style.touchAction=!0===n?"auto":n?"pan-"+n+(Dr.isTouch?" pinch-zoom":""):"none",e===Pr&&t(Lr,n)},Es={auto:1,scroll:1},Cs=function(t){var e,n=t.event,i=t.target,r=t.axis,o=(n.changedTouches?n.changedTouches[0]:n).target,s=o._gsap||Tr.core.getCache(o),a=ao();if(!s._isScrollT||a-s._isScrollT>2e3){for(;o&&o!==Lr&&(o.scrollHeight<=o.clientHeight&&o.scrollWidth<=o.clientWidth||!Es[(e=Lo(o)).overflowY]&&!Es[e.overflowX]);)o=o.parentNode;s._isScroll=o&&o!==i&&!_o(o)&&(Es[(e=Lo(o)).overflowY]||Es[e.overflowX]),s._isScrollT=a}(s._isScroll||"x"===r)&&(n.stopPropagation(),n._gsapAllow=!0)},As=function(t,e,n,i){return Dr.create({target:t,capture:!0,debounce:!1,lockAxis:!0,type:e,onWheel:i=i&&Cs,onPress:i,onDrag:i,onScroll:i,onEnable:function(){return n&&ko(Ar,Dr.eventTypes[0],Ls,!1,!0)},onDisable:function(){return Uo(Ar,Dr.eventTypes[0],Ls,!0)}})},Ps=/(input|label|select|textarea)/i,Ls=function(t){var e=Ps.test(t.target.tagName);(e||Ms)&&(t._gsapAllow=!0,Ms=e)},Rs=function(t){Do(t)||(t={}),t.preventDefault=t.isNormalizer=t.allowClicks=!0,t.type||(t.type="wheel,touch"),t.debounce=!!t.debounce,t.id=t.id||"normalizer";var e,n,i,r,o,s,a,l,u=t,c=u.normalizeScrollX,h=u.momentum,d=u.allowNestedScroll,f=_r(t.target)||Pr,p=Tr.core.globals().ScrollSmoother,m=p&&p.get(),g=Qr&&(t.content&&_r(t.content)||m&&!1!==t.content&&!m.smooth()&&m.content()),v=xr(f,vr),_=xr(f,gr),x=1,y=(Dr.isTouch&&Cr.visualViewport?Cr.visualViewport.scale*Cr.visualViewport.width:Cr.outerWidth)/Cr.innerWidth,b=0,w=So(h)?function(){return h(e)}:function(){return h||2.8},S=As(f,t.type,!0,d),M=function(){return r=!1},D=po,T=po,E=function(){n=yo(f,vr),T=Ir(Qr?1:0,n),c&&(D=Ir(0,yo(f,gr))),i=as},C=function(){g._gsap.y=mo(parseFloat(g._gsap.y)+v.offset)+"px",g.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(g._gsap.y)+", 0, 1)",v.offset=v.cacheID=0},A=function(){E(),o.isActive()&&o.vars.scrollY>n&&(v()>n?o.progress(1)&&v(n):o.resetTo("scrollY",n))};return g&&Tr.set(g,{y:"+=0"}),t.ignoreCheck=function(t){return Qr&&"touchmove"===t.type&&function(){if(r){requestAnimationFrame(M);var t=mo(e.deltaY/2),n=T(v.v-t);if(g&&n!==v.v+v.offset){v.offset=n-v.v;var i=mo((parseFloat(g&&g._gsap.y)||0)-v.offset);g.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+i+", 0, 1)",g._gsap.y=i+"px",v.cacheID=sr.cache,hs()} return!0} v.offset&&C(),r=!0}()||x>1.05&&"touchstart"!==t.type||e.isGesturing||t.touches&&t.touches.length>1},t.onPress=function(){var t=x;x=mo((Cr.visualViewport&&Cr.visualViewport.scale||1)/y),o.pause(),t!==x&&Ts(f,x>1.01||!c&&"x"),s=_(),a=v(),E(),i=as},t.onRelease=t.onGestureStart=function(t,e){if(v.offset&&C(),e){sr.cache++;var i,r,s=w();c&&(r=(i=_())+.05*s*-t.velocityX/.227,s*=Ds(_,i,r,yo(f,gr)),o.vars.scrollX=D(r)),r=(i=v())+.05*s*-t.velocityY/.227,s*=Ds(v,i,r,yo(f,vr)),o.vars.scrollY=T(r),o.invalidate().duration(s).play(.01),(Qr&&o.vars.scrollY>=n||i>=n-1)&&Tr.to({},{onUpdate:A,duration:s})}else l.restart(!0)},t.onWheel=function(){o._ts&&o.pause(),ao()-b>1e3&&(i=0,b=ao())},t.onChange=function(t,e,n,r,o){if(as!==i&&E(),e&&c&&_(D(r[2]===e?s+(t.startX-t.x):_()+e-r[1])),n){v.offset&&C();var l=o[2]===n,u=l?a+t.startY-t.y:v()+n-o[1],h=T(u);l&&u!==h&&(a+=h-u),v(h)}(n||e)&&hs()},t.onEnable=function(){Ts(f,!c&&"x"),Ss.addEventListener("refresh",A),ko(Cr,"resize",A),v.smooth&&(v.target.style.scrollBehavior="auto",v.smooth=_.smooth=!1),S.enable()},t.onDisable=function(){Ts(f,!0),Uo(Cr,"resize",A),Ss.removeEventListener("refresh",A),S.kill()},t.lockAxis=!1!==t.lockAxis,(e=new Dr(t)).iOS=Qr,Qr&&!v()&&v(1),Qr&&Tr.ticker.add(po),l=e._dc,o=Tr.to(e,{ease:"power4",paused:!0,scrollX:c?"+=0.1":"+=0",scrollY:"+=0.1",onComplete:l.vars.onComplete}),e};Ss.sort=function(t){return Xo.sort(t||function(t,e){return-1e6*(t.vars.refreshPriority||0)+t.start-(e.start+ -1e6*(e.vars.refreshPriority||0))})},Ss.observe=function(t){return new Dr(t)},Ss.normalizeScroll=function(t){if(void 0===t)return Yr;if(!0===t&&Yr)return Yr.enable();if(!1===t)return Yr&&Yr.kill();var e=t instanceof Dr?t:Rs(t);return Yr&&Yr.target===e.target&&Yr.kill(),_o(e.target)&&(Yr=e),e},Ss.core={_getVelocityProp:yr,_inputObserver:As,_scrollers:sr,_proxies:ar,bridge:{ss:function(){uo||ns("scrollStart"),uo=ao()},ref:function(){return kr}}},vo()&&Tr.registerPlugin(Ss);/*! * ScrollToPlugin 3.11.4 * https://greensock.com * * @license Copyright 2008-2022, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */ var Os,Fs,Is,Ns,zs,ks,Us,Bs,Vs=function(){return"undefined"!=typeof window},Hs=function(){return Os||Vs()&&(Os=window.gsap)&&Os.registerPlugin&&Os},Gs=function(t){return"string"==typeof t},Ws=function(t){return"function"==typeof t},js=function(t,e){var n="x"===e?"Width":"Height",i="scroll"+n,r="client"+n;return t===Is||t===Ns||t===zs?Math.max(Ns[i],zs[i])-(Is["inner"+n]||Ns[r]||zs[r]):t[i]-t["offset"+n]},qs=function(t,e){var n="scroll"+("x"===e?"Left":"Top");return t===Is&&(null!=t.pageXOffset?n="page"+e.toUpperCase()+"Offset":t=null!=Ns[n]?Ns:zs),function(){return t[n]}},Xs=function(t,e){if(!(t=ks(t)[0])||!t.getBoundingClientRect)return console.warn("scrollTo target doesn't exist. Using 0")||{x:0,y:0};var n=t.getBoundingClientRect(),i=!e||e===Is||e===zs,r=i?{top:Ns.clientTop-(Is.pageYOffset||Ns.scrollTop||zs.scrollTop||0),left:Ns.clientLeft-(Is.pageXOffset||Ns.scrollLeft||zs.scrollLeft||0)}:e.getBoundingClientRect(),o={x:n.left-r.left,y:n.top-r.top};return!i&&e&&(o.x+=qs(e,"x")(),o.y+=qs(e,"y")()),o},Ys=function(t,e,n,i,r){return isNaN(t)||"object"==typeof t?Gs(t)&&"="===t.charAt(1)?parseFloat(t.substr(2))*("-"===t.charAt(0)?-1:1)+i-r:"max"===t?js(e,n)-r:Math.min(js(e,n),Xs(t,e)[n]-r):parseFloat(t)-r},Zs=function(){Os=Hs(),Vs()&&Os&&"undefined"!=typeof document&&document.body&&(Is=window,zs=document.body,Ns=document.documentElement,ks=Os.utils.toArray,Os.config({autoKillThreshold:7}),Us=Os.config(),Fs=1)},Ks={version:"3.11.4",name:"scrollTo",rawVars:1,register:function(t){Os=t,Zs()},init:function(t,e,n,i,r){Fs||Zs();var o=Os.getProperty(t,"scrollSnapType");this.isWin=t===Is,this.target=t,this.tween=n,e=function(t,e,n,i){if(Ws(t)&&(t=t(e,n,i)),"object"!=typeof t)return Gs(t)&&"max"!==t&&"="!==t.charAt(1)?{x:t,y:t}:{y:t};if(t.nodeType)return{y:t,x:t};var r,o={};for(r in t)o[r]="onAutoKill"!==r&&Ws(t[r])?t[r](e,n,i):t[r];return o}(e,i,t,r),this.vars=e,this.autoKill=!!e.autoKill,this.getX=qs(t,"x"),this.getY=qs(t,"y"),this.x=this.xPrev=this.getX(),this.y=this.yPrev=this.getY(),Bs||(Bs=Os.core.globals().ScrollTrigger),"smooth"===Os.getProperty(t,"scrollBehavior")&&Os.set(t,{scrollBehavior:"auto"}),o&&"none"!==o&&(this.snap=1,this.snapInline=t.style.scrollSnapType,t.style.scrollSnapType="none"),null!=e.x?(this.add(this,"x",this.x,Ys(e.x,t,"x",this.x,e.offsetX||0),i,r),this._props.push("scrollTo_x")):this.skipX=1,null!=e.y?(this.add(this,"y",this.y,Ys(e.y,t,"y",this.y,e.offsetY||0),i,r),this._props.push("scrollTo_y")):this.skipY=1},render:function(t,e){for(var n,i,r,o,s,a=e._pt,l=e.target,u=e.tween,c=e.autoKill,h=e.xPrev,d=e.yPrev,f=e.isWin,p=e.snap,m=e.snapInline;a;)a.r(t,a.d),a=a._next;n=f||!e.skipX?e.getX():h,r=(i=f||!e.skipY?e.getY():d)-d,o=n-h,s=Us.autoKillThreshold,e.x<0&&(e.x=0),e.y<0&&(e.y=0),c&&(!e.skipX&&(o>s||o<-s)&&ns||r<-s)&&i=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s} function ta(){for(var t=0,e=0,n=arguments.length;er-20?c.x=l-r+20:lo-20?c.y=u-o+20:u=i)"function"==typeof l&&l.call(t);else{var o=requestAnimationFrame(e);Ma.set(t,o)}}()}(this,t,e,n,i)},t.prototype.scrollIntoView=function(t,e){void 0===e&&(e={}),function(t,e,n){var i=void 0===n?{}:n,r=i.alignToTop,o=void 0===r||r,s=i.onlyScrollIfNeeded,a=void 0!==s&&s,l=i.offsetTop,u=void 0===l?0:l,c=i.offsetLeft,h=void 0===c?0:c,d=i.offsetBottom,f=void 0===d?0:d,p=t.containerEl,m=t.bounding,g=t.offset,v=t.limit;if(e&&p.contains(e)){var _=e.getBoundingClientRect();if(!a||!t.isVisible(e)){var x=o?_.top-m.top-u:_.bottom-m.bottom+f;t.setMomentum(_.left-m.left-h,na()(x,-g.y,v.y-g.y))}}}(this,t,e)},t.prototype.addListener=function(t){if("function"!=typeof t)throw new TypeError("[smooth-scrollbar] scrolling listener should be a function");this._listeners.add(t)},t.prototype.removeListener=function(t){this._listeners.delete(t)},t.prototype.addTransformableMomentum=function(t,e,n,i){this._updateDebounced();var r=this._plugins.reduce((function(t,e){return e.transformDelta(t,n)||t}),{x:t,y:e}),o=!this._shouldPropagateMomentum(r.x,r.y);o&&this.addMomentum(r.x,r.y),i&&i.call(this,o)},t.prototype.addMomentum=function(t,e){this.setMomentum(this._momentum.x+t,this._momentum.y+e)},t.prototype.setMomentum=function(t,e){0===this.limit.x&&(t=0),0===this.limit.y&&(e=0),this.options.renderByPixels&&(t=Math.round(t),e=Math.round(e)),this._momentum.x=t,this._momentum.y=e},t.prototype.updatePluginOptions=function(t,e){this._plugins.forEach((function(n){n.name===t&&Object.assign(n.options,e)}))},t.prototype.destroy=function(){var t,e,n=this.containerEl,i=this.contentEl;t=this,(e=ca.get(t))&&(e.forEach((function(t){var e=t.elem,n=t.eventName,i=t.handler;e.removeEventListener(n,i,ha())})),ca.delete(t)),this._listeners.clear(),this.setMomentum(0,0),cancelAnimationFrame(this._renderID),this._observer&&this._observer.disconnect(),Va.delete(this.containerEl);for(var r=Array.from(i.childNodes);n.firstChild;)n.removeChild(n.firstChild);r.forEach((function(t){n.appendChild(t)})),va(n,{overflow:""}),n.scrollTop=this.scrollTop,n.scrollLeft=this.scrollLeft,this._plugins.forEach((function(t){t.onDestroy()})),this._plugins.length=0},t.prototype._init=function(){var t=this;this.update(),Object.keys(i).forEach((function(e){i[e](t)})),this._plugins.forEach((function(t){t.onInit()})),this._render()},t.prototype._updateDebounced=function(){this.update()},t.prototype._shouldPropagateMomentum=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var n=this.options,i=this.offset,r=this.limit;if(!n.continuousScrolling)return!1;0===r.x&&0===r.y&&this._updateDebounced();var o=na()(t+i.x,0,r.x),s=na()(e+i.y,0,r.y),a=!0;return a=(a=(a=a&&o===i.x)&&s===i.y)&&(i.x===r.x||0===i.x||i.y===r.y||0===i.y)},t.prototype._render=function(){var t=this._momentum;if(t.x||t.y){var e=this._nextTick("x"),n=this._nextTick("y");t.x=e.momentum,t.y=n.momentum,this.setPosition(e.position,n.position)} var i=Qs({},this._momentum);this._plugins.forEach((function(t){t.onRender(i)})),this._renderID=requestAnimationFrame(this._render.bind(this))},t.prototype._nextTick=function(t){var e=this.options,n=this.offset,i=this._momentum,r=n[t],o=i[t];if(Math.abs(o)<=.1)return{momentum:0,position:r+o};var s=o*(1-e.damping);return e.renderByPixels&&(s|=0),{momentum:s,position:r+o-s}},$s([aa(100,{leading:!0})],t.prototype,"_updateDebounced",null),t}(),Ga=!1;function Wa(){if(!Ga&&"undefined"!=typeof window){var t=document.createElement("style");t.id="smooth-scrollbar-style",t.textContent="\n[data-scrollbar] {\n display: block;\n position: relative;\n}\n\n.scroll-content {\n display: flow-root;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n}\n\n.scrollbar-track {\n position: absolute;\n opacity: 0;\n z-index: 1;\n background: rgba(222, 222, 222, .75);\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-transition: opacity 0.5s 0.5s ease-out;\n transition: opacity 0.5s 0.5s ease-out;\n}\n.scrollbar-track.show,\n.scrollbar-track:hover {\n opacity: 1;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n.scrollbar-track-x {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 8px;\n}\n.scrollbar-track-y {\n top: 0;\n right: 0;\n width: 8px;\n height: 100%;\n}\n.scrollbar-thumb {\n position: absolute;\n top: 0;\n left: 0;\n width: 8px;\n height: 8px;\n background: rgba(0, 0, 0, .5);\n border-radius: 4px;\n}\n",document.head&&document.head.appendChild(t),Ga=!0}} var ja=function(t){function e(){return null!==t&&t.apply(this,arguments)||this} return function(t,e){function n(){this.constructor=t} Js(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.init=function(t,e){if(!t||1!==t.nodeType)throw new TypeError("expect element to be DOM Element, but got "+t);return Wa(),Va.has(t)?Va.get(t):new Ha(t,e)},e.initAll=function(t){return Array.from(document.querySelectorAll("[data-scrollbar]"),(function(n){return e.init(n,t)}))},e.has=function(t){return Va.has(t)},e.get=function(t){return Va.get(t)},e.getAll=function(){return Array.from(Va.values())},e.destroy=function(t){var e=Va.get(t);e&&e.destroy()},e.destroyAll=function(){Va.forEach((function(t){t.destroy()}))},e.use=function(){for(var t=[],e=0;e0?1:-1,i=t.y>0?1:-1;return n===this.lockX||i===this.lockY?{x:0,y:0}:(this.lockX=null,this.lockY=null,t)},r.onRender=function(t){var e=t.x,n=t.y;n<0&&!this.lockY&&Math.abs(n)>=this.scrollbar.scrollTop&&(this.scrollbar.setMomentum(0,-this.scrollbar.scrollTop),this.lockY=-1),e<0&&!this.lockX&&Math.abs(e)>=this.scrollbar.scrollLeft&&(this.scrollbar.setMomentum(-this.scrollbar.scrollLeft,0),this.lockX=-1),e>0&&!this.lockX&&Math.abs(e)>=this.scrollbar.limit.x-this.scrollbar.scrollLeft&&(this.scrollbar.setMomentum(this.scrollbar.limit.x-this.scrollbar.scrollLeft,0),this.lockX=1),n>0&&!this.lockY&&Math.abs(n)>=this.scrollbar.limit.y-this.scrollbar.scrollTop&&(this.scrollbar.setMomentum(0,this.scrollbar.limit.y-this.scrollbar.scrollTop),this.lockY=1),0===n&&(this.lockY=null),0===e&&(this.lockX=null)},i}(ja.ScrollbarPlugin);Ka.pluginName="SoftScroll";var Ja=Ka;function Qa(t,e){return(Qa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}/*! * SmoothScrollbar GSAP ScrollTrigger Plugin * * @version 1.0.5 * @author Artem Dordzhiev (Draft) */ Hi.registerPlugin(Ss);var $a={el:document.body,vars:{scrollTop:function(t){return arguments.length&&($a.scrollbar.scrollTop=t),$a.scrollbar.scrollTop},scrollLeft:function(t){return arguments.length&&($a.scrollbar.scrollLeft=t),$a.scrollbar.scrollLeft},getBoundingClientRect:function(){return{top:0,left:0,width:window.innerWidth,height:window.innerHeight}},pinType:"transform"}},tl=function(t){var e,n;function i(e,n){var i;return i=t.call(this,e,n)||this,$a.scrollbar=e,Ss.scrollerProxy($a.el,$a.vars),Ss.defaults({pinType:"transform"}),e.addListener(Ss.update),i} return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,Qa(e,n),i}(ja.ScrollbarPlugin);tl.pluginName="ScrollTrigger";var el=tl;function nl(t,e){return(nl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} Hi.registerPlugin(Ks),ja.use(Ya,Ja,el);var il=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).bindNativeScrolling(),e.initSmoothScrolling(),e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,nl(e,n);var r=i.prototype;return r.bindNativeScrolling=function(){var t=this;this.nativeScrollEvent=function(){return t.app.trigger("scrolling",window.pageYOffset,window.pageXOffset)},window.addEventListener("scroll",this.nativeScrollEvent)},r.initSmoothScrolling=function(){var t=this;window.matchMedia("(pointer:fine)").matches&&(this.ssb=ja.init(this.el,{continuousScrolling:!1,renderByPixels:!0,damping:.08}),this.ssb.addListener((function(e){return t.app.trigger("scrolling",e.offset.y,e.offset.x)})),document.documentElement.classList.add("smooth"))},r.destroySmoothScrolling=function(){this.ssb.destroy(),this.ssb=null,document.documentElement.classList.remove("smooth")},r.scrollEnable=function(){document.documentElement.classList.remove("no-scroll"),this.ssb&&this.ssb.updatePluginOptions("Disable",{disable:!1})},r.scrollDisable=function(){document.documentElement.classList.add("no-scroll"),this.ssb&&this.ssb.updatePluginOptions("Disable",{disable:!0})},r.scrollTop=function(){return this.ssb?this.ssb.scrollTop:window.pageYOffset},r.scrollLeft=function(){return this.ssb?this.ssb.scrollLeft:window.pageXOffset},r.scrollHeight=function(){return this.ssb?this.ssb.limit.y:document.documentElement.scrollHeight},r.scrollWidth=function(){return this.ssb?this.ssb.limit.x:document.documentElement.scrollWidth},r.scrollTo=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n={}),t+=(n=Object.assign({},{offsetY:0,offsetX:0,duration:.3,callback:null,ease:null},n)).offsetY,e+=n.offsetX,this.ssb?this.ssb.scrollTo(e,t,1e3*n.duration,{callback:n.callback,easing:n.ease}):Ks?Hi.to(window,{scrollTo:{y:t,x:e,autoKill:!1},ease:n.ease,duration:n.duration,onComplete:n.callback}):window.scrollTo({top:t,left:e,behavior:n.duration?"smooth":"instant"})},r.scrollToTarget=function(t,e){var n=this.app.query(t);if(n){var i=n.getBoundingClientRect(),r=i.top+this.scrollTop(),o=i.left+this.scrollLeft();this.scrollTo(r,o,e)}},r.scrollToHash=function(){window.location.hash&&(this.ssb&&this.ssb.update(),this.scrollToTarget("#section-"+window.location.hash.substr(1),{duration:0}))},r.loadLazyImages=function(){this.el.querySelectorAll("img[loading=lazy]").forEach((function(t){t.setAttribute("loading","eager")}))},r.onEnter=function(){try{return this.scrollToHash(),Promise.resolve()}catch(t){return Promise.reject(t)}},r.onComplete=function(){try{var t=this;return setTimeout((function(){return t.loadLazyImages()}),3e3),Promise.resolve()}catch(t){return Promise.reject(t)}},r.onLeave=function(){try{return this.scrollEnable(),Ss&&(Ss.killAll(),Ss.clearScrollMemory()),Promise.resolve()}catch(t){return Promise.reject(t)}},r.onDestroy=function(){try{return this.ssb&&this.destroySmoothScrolling(),window.removeEventListener("scroll",this.nativeScrollEvent),Promise.resolve()}catch(t){return Promise.reject(t)}},i}(o),rl=function(){function t(e){void 0===e&&(e={}),this.options=Object.assign({},{el:null,container:document.body,className:"mf-cursor",innerClassName:"mf-cursor-inner",textClassName:"mf-cursor-text",mediaClassName:"mf-cursor-media",mediaBoxClassName:"mf-cursor-media-box",iconSvgClassName:"mf-svgsprite",iconSvgNamePrefix:"-",iconSvgSrc:"",dataAttr:"cursor",hiddenState:"-hidden",textState:"-text",iconState:"-icon",activeState:"-active",mediaState:"-media",stateDetection:{"-pointer":"a,button"},visible:!0,visibleOnState:!1,speed:.55,ease:"expo.out",overwrite:!0,skewing:0,skewingText:2,skewingIcon:2,skewingMedia:2,skewingDelta:.001,skewingDeltaMax:.15,stickDelta:.15,showTimeout:0,hideOnLeave:!0,hideTimeout:300,hideMediaTimeout:300,initialPos:[-window.innerWidth,-window.innerHeight]},e),this.options.visible&&null==e.stateDetection&&(this.options.stateDetection["-hidden"]="iframe"),this.gsap=t.gsap||window.gsap,this.el="string"==typeof this.options.el?document.querySelector(this.options.el):this.options.el,this.container="string"==typeof this.options.container?document.querySelector(this.options.container):this.options.container,this.skewing=this.options.skewing,this.pos={x:this.options.initialPos[0],y:this.options.initialPos[1]},this.vel={x:0,y:0},this.event={},this.events=[],this.init()} t.registerGSAP=function(e){t.gsap=e};var e=t.prototype;return e.init=function(){this.el||this.create(),this.createSetter(),this.bind(),this.render(!0),this.ticker=this.render.bind(this,!1),this.gsap.ticker.add(this.ticker)},e.create=function(){this.el=document.createElement("div"),this.el.className=this.options.className,this.el.classList.add(this.options.hiddenState),this.inner=document.createElement("div"),this.inner.className=this.options.innerClassName,this.text=document.createElement("div"),this.text.className=this.options.textClassName,this.media=document.createElement("div"),this.media.className=this.options.mediaClassName,this.mediaBox=document.createElement("div"),this.mediaBox.className=this.options.mediaBoxClassName,this.media.appendChild(this.mediaBox),this.inner.appendChild(this.media),this.inner.appendChild(this.text),this.el.appendChild(this.inner),this.container.appendChild(this.el)},e.createSetter=function(){this.setter={x:this.gsap.quickSetter(this.el,"x","px"),y:this.gsap.quickSetter(this.el,"y","px"),rotation:this.gsap.quickSetter(this.el,"rotation","deg"),scaleX:this.gsap.quickSetter(this.el,"scaleX"),scaleY:this.gsap.quickSetter(this.el,"scaleY"),wc:this.gsap.quickSetter(this.el,"willChange"),inner:{rotation:this.gsap.quickSetter(this.inner,"rotation","deg")}}},e.bind=function(){var t=this;this.event.mouseleave=function(){return t.hide()},this.event.mouseenter=function(){return t.show()},this.event.mousedown=function(){return t.addState(t.options.activeState)},this.event.mouseup=function(){return t.removeState(t.options.activeState)},this.event.mousemoveOnce=function(){return t.show()},this.event.mousemove=function(e){t.gsap.to(t.pos,{x:t.stick?t.stick.x-(t.stick.x-e.clientX)*t.options.stickDelta:e.clientX,y:t.stick?t.stick.y-(t.stick.y-e.clientY)*t.options.stickDelta:e.clientY,overwrite:t.options.overwrite,ease:t.options.ease,duration:t.visible?t.options.speed:0,onUpdate:function(){return t.vel={x:e.clientX-t.pos.x,y:e.clientY-t.pos.y}}})},this.event.mouseover=function(e){for(var n=e.target;n&&n!==t.container&&(!e.relatedTarget||!n.contains(e.relatedTarget));n=n.parentNode){for(var i in t.options.stateDetection)n.matches(t.options.stateDetection[i])&&t.addState(i);if(t.options.dataAttr){var r=t.getFromDataset(n);r.state&&t.addState(r.state),r.text&&t.setText(r.text),r.icon&&t.setIcon(r.icon),r.img&&t.setImg(r.img),r.video&&t.setVideo(r.video),void 0!==r.show&&t.show(),void 0!==r.stick&&t.setStick(r.stick||n)}}},this.event.mouseout=function(e){for(var n=e.target;n&&n!==t.container&&(!e.relatedTarget||!n.contains(e.relatedTarget));n=n.parentNode){for(var i in t.options.stateDetection)n.matches(t.options.stateDetection[i])&&t.removeState(i);if(t.options.dataAttr){var r=t.getFromDataset(n);r.state&&t.removeState(r.state),r.text&&t.removeText(),r.icon&&t.removeIcon(),r.img&&t.removeImg(),r.video&&t.removeVideo(),void 0!==r.show&&t.hide(),void 0!==r.stick&&t.removeStick()}}},this.options.hideOnLeave&&this.container.addEventListener("mouseleave",this.event.mouseleave,{passive:!0}),this.options.visible&&this.container.addEventListener("mouseenter",this.event.mouseenter,{passive:!0}),this.options.activeState&&(this.container.addEventListener("mousedown",this.event.mousedown,{passive:!0}),this.container.addEventListener("mouseup",this.event.mouseup,{passive:!0})),this.container.addEventListener("mousemove",this.event.mousemove,{passive:!0}),this.options.visible&&this.container.addEventListener("mousemove",this.event.mousemoveOnce,{passive:!0,once:!0}),(this.options.stateDetection||this.options.dataAttr)&&(this.container.addEventListener("mouseover",this.event.mouseover,{passive:!0}),this.container.addEventListener("mouseout",this.event.mouseout,{passive:!0}))},e.render=function(t){if(!0===t||0!==this.vel.y&&0!==this.vel.x){if(this.trigger("render"),this.setter.wc("transform"),this.setter.x(this.pos.x),this.setter.y(this.pos.y),this.skewing){var e=Math.sqrt(Math.pow(this.vel.x,2)+Math.pow(this.vel.y,2)),n=Math.min(e*this.options.skewingDelta,this.options.skewingDeltaMax)*this.skewing,i=180*Math.atan2(this.vel.y,this.vel.x)/Math.PI;this.setter.rotation(i),this.setter.scaleX(1+n),this.setter.scaleY(1-n),this.setter.inner.rotation(-i)}}else this.setter.wc("auto")},e.show=function(){var t=this;this.trigger("show"),clearInterval(this.visibleInt),this.visibleInt=setTimeout((function(){t.el.classList.remove(t.options.hiddenState),t.visible=!0,t.render(!0)}),this.options.showTimeout)},e.hide=function(){var t=this;this.trigger("hide"),clearInterval(this.visibleInt),this.el.classList.add(this.options.hiddenState),this.visibleInt=setTimeout((function(){return t.visible=!1}),this.options.hideTimeout)},e.toggle=function(t){!0===t||!1!==t&&!this.visible?this.show():this.hide()},e.addState=function(t){var e;if(this.trigger("addState",t),t===this.options.hiddenState)return this.hide();(e=this.el.classList).add.apply(e,t.split(" ")),this.options.visibleOnState&&this.show()},e.removeState=function(t){var e;if(this.trigger("removeState",t),t===this.options.hiddenState)return this.show();(e=this.el.classList).remove.apply(e,t.split(" ")),this.options.visibleOnState&&this.el.className===this.options.className&&this.hide()},e.toggleState=function(t,e){!0===e||!1!==e&&!this.el.classList.contains(t)?this.addState(t):this.removeState(t)},e.setSkewing=function(t){this.gsap.to(this,{skewing:t})},e.removeSkewing=function(){this.gsap.to(this,{skewing:this.options.skewing})},e.setStick=function(t){var e=("string"==typeof t?document.querySelector(t):t).getBoundingClientRect();this.stick={y:e.top+e.height/2,x:e.left+e.width/2}},e.removeStick=function(){this.stick=!1},e.setText=function(t){this.text.innerHTML=t,this.addState(this.options.textState),this.setSkewing(this.options.skewingText)},e.removeText=function(){this.removeState(this.options.textState),this.removeSkewing()},e.setIcon=function(t,e){void 0===e&&(e=""),this.text.innerHTML="",this.addState(this.options.iconState),this.setSkewing(this.options.skewingIcon)},e.removeIcon=function(){this.removeState(this.options.iconState),this.removeSkewing()},e.setMedia=function(t){var e=this;clearTimeout(this.mediaInt),t&&(this.mediaBox.innerHTML="",this.mediaBox.appendChild(t)),this.mediaInt=setTimeout((function(){return e.addState(e.options.mediaState)}),20),this.setSkewing(this.options.skewingMedia)},e.removeMedia=function(){var t=this;clearTimeout(this.mediaInt),this.removeState(this.options.mediaState),this.mediaInt=setTimeout((function(){return t.mediaBox.innerHTML=""}),this.options.hideMediaTimeout),this.removeSkewing()},e.setImg=function(t){this.mediaImg||(this.mediaImg=new Image),this.mediaImg.src!==t&&(this.mediaImg.src=t),this.setMedia(this.mediaImg)},e.removeImg=function(){this.removeMedia()},e.setVideo=function(t){this.mediaVideo||(this.mediaVideo=document.createElement("video"),this.mediaVideo.muted=!0,this.mediaVideo.loop=!0,this.mediaVideo.autoplay=!0),this.mediaVideo.src!==t&&(this.mediaVideo.src=t,this.mediaVideo.load()),this.mediaVideo.play(),this.setMedia(this.mediaVideo)},e.removeVideo=function(){this.mediaVideo&&this.mediaVideo.readyState>2&&this.mediaVideo.pause(),this.removeMedia()},e.on=function(t,e){this.events[t]instanceof Array||this.off(t),this.events[t].push(e)},e.off=function(t,e){this.events[t]=e?this.events[t].filter((function(t){return t!==e})):[]},e.trigger=function(t){var e=arguments,n=this;this.events[t]&&this.events[t].forEach((function(t){return t.call.apply(t,[n,n].concat([].slice.call(e,1)))}))},e.getFromDataset=function(t){var e=t.dataset;return{state:e[this.options.dataAttr],show:e[this.options.dataAttr+"Show"],text:e[this.options.dataAttr+"Text"],icon:e[this.options.dataAttr+"Icon"],img:e[this.options.dataAttr+"Img"],video:e[this.options.dataAttr+"Video"],stick:e[this.options.dataAttr+"Stick"]}},e.destroy=function(){this.trigger("destroy"),this.gsap.ticker.remove(this.ticker),this.container.removeEventListener("mouseleave",this.event.mouseleave),this.container.removeEventListener("mouseenter",this.event.mouseenter),this.container.removeEventListener("mousedown",this.event.mousedown),this.container.removeEventListener("mouseup",this.event.mouseup),this.container.removeEventListener("mousemove",this.event.mousemove),this.container.removeEventListener("mousemove",this.event.mousemoveOnce),this.container.removeEventListener("mouseover",this.event.mouseover),this.container.removeEventListener("mouseout",this.event.mouseout),this.el&&(this.container.removeChild(this.el),this.el=null,this.mediaImg=null,this.mediaVideo=null)},t}();/*! * Cuberto Mouse Follower * https://cuberto.com/ * * @version 1.1.2 * @author Cuberto, Artem Dordzhiev (Draft) */ function ol(t,e){return(ol=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} rl.registerGSAP(Hi);var sl=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).initFollower(),e} return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,ol(e,n),i.prototype.initFollower=function(){window.matchMedia("(pointer:fine)").matches&&(this.follower=new rl({className:"cb-cursor",innerClassName:"cb-cursor-inner",textClassName:"cb-cursor-text",mediaClassName:"cb-cursor-media",mediaBoxClassName:"cb-cursor-media-box",iconSvgClassName:"cb-svgsprite",iconSvgSrc:"/assets/img/sprites/svgsprites.svg",skewing:1.5,skewingMedia:1.5}))},i}(o);function al(t,e){return(al=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var ll=function(t){var e,n;function i(){return t.apply(this,arguments)||this} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,al(e,n);var r=i.prototype;return r.show=function(){this.el.classList.add("-visible"),document.documentElement.classList.add("loader")},r.hide=function(){this.el.classList.remove("-visible"),document.documentElement.classList.remove("loader")},r.onInit=function(){try{return Promise.resolve(new Promise((function(t){return setTimeout(t,300)}))).then((function(){}))}catch(t){return Promise.reject(t)}},r.onEnter=function(){try{return this.hide(),Promise.resolve(new Promise((function(t){return setTimeout(t,200)}))).then((function(){}))}catch(t){return Promise.reject(t)}},r.onRefresh=function(){try{return Promise.resolve(new Promise((function(t){return setTimeout(t,350)}))).then((function(){}))}catch(t){return Promise.reject(t)}},r.onLeave=function(){try{return this.show(),Promise.resolve(new Promise((function(t){return setTimeout(t,300)}))).then((function(){}))}catch(t){return Promise.reject(t)}},i}(o);var ul=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},cl=n(90),hl="object"==typeof self&&self&&self.Object===Object&&self,dl=cl.a||hl||Function("return this")(),fl=function(){return dl.Date.now()},pl=/\s/;var ml=function(t){for(var e=t.length;e--&&pl.test(t.charAt(e)););return e},gl=/^\s+/;var vl=function(t){return t?t.slice(0,ml(t)+1).replace(gl,""):t},_l=dl.Symbol,xl=Object.prototype,yl=xl.hasOwnProperty,bl=xl.toString,wl=_l?_l.toStringTag:void 0;var Sl=function(t){var e=yl.call(t,wl),n=t[wl];try{t[wl]=void 0;var i=!0}catch(t){} var r=bl.call(t);return i&&(e?t[wl]=n:delete t[wl]),r},Ml=Object.prototype.toString;var Dl=function(t){return Ml.call(t)},Tl=_l?_l.toStringTag:void 0;var El=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Tl&&Tl in Object(t)?Sl(t):Dl(t)};var Cl=function(t){return null!=t&&"object"==typeof t};var Al=function(t){return"symbol"==typeof t||Cl(t)&&"[object Symbol]"==El(t)},Pl=/^[-+]0x[0-9a-f]+$/i,Ll=/^0b[01]+$/i,Rl=/^0o[0-7]+$/i,Ol=parseInt;var Fl=function(t){if("number"==typeof t)return t;if(Al(t))return NaN;if(ul(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ul(e)?e+"":e} if("string"!=typeof t)return 0===t?t:+t;t=vl(t);var n=Ll.test(t);return n||Rl.test(t)?Ol(t.slice(2),n?2:8):Pl.test(t)?NaN:+t},Il=Math.max,Nl=Math.min;var zl=function(t,e,n){var i,r,o,s,a,l,u=0,c=!1,h=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var n=i,o=r;return i=r=void 0,u=e,s=t.apply(o,n)} function p(t){return u=t,a=setTimeout(g,e),c?f(t):s} function m(t){var n=t-l;return void 0===l||n>=e||n<0||h&&t-u>=o} function g(){var t=fl();if(m(t))return v(t);a=setTimeout(g,function(t){var n=e-(t-l);return h?Nl(n,o-(t-u)):n}(t))} function v(t){return a=void 0,d&&i?f(t):(i=r=void 0,s)} function _(){var t=fl(),n=m(t);if(i=arguments,r=this,l=t,n){if(void 0===a)return p(l);if(h)return clearTimeout(a),a=setTimeout(g,e),f(l)} return void 0===a&&(a=setTimeout(g,e)),s} return e=Fl(e)||0,ul(n)&&(c=!!n.leading,o=(h="maxWait" in n)?Il(Fl(n.maxWait)||0,e):o,d="trailing" in n?!!n.trailing:d),_.cancel=function(){void 0!==a&&clearTimeout(a),u=0,i=l=r=a=void 0},_.flush=function(){return void 0===a?s:v(fl())},_};function kl(t,e){return(kl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var Ul=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).injectSvg(),e.bindMouseMove(),e.bindResizeObserver(),e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,kl(e,n);var r=i.prototype;return r.onInit=function(){try{var t=this;return Promise.resolve(t.app.wait("loader")).then((function(){t.magicShow()}))}catch(t){return Promise.reject(t)}},r.magicShow=function(){Ss.create({trigger:this.el,animation:this.tlShow()})},r.tlShow=function(){var t=new Hi.timeline;return t.set(this.svg,{transformOrigin:"left center"}),t.from(this.svg,{scaleX:0,duration:3,ease:"expo.out"}),t},r.getPathD=function(t,e,n){return t||(t=this.el.offsetWidth/2),e||(e=100),void 0===n&&(n=this.el.offsetWidth),"M0,100 Q"+t+","+e+" "+n+",100"},r.injectSvg=function(){this.el.innerHTML="",this.svg=this.el.querySelector("svg"),this.path=this.el.querySelector("path")},r.update=function(){Hi.killTweensOf(this.path),this.path.setAttribute("d",this.getPathD())},r.bindMouseMove=function(){var t=this;if(!Ss.isTouch){var e=0;this.el.addEventListener("mousemove",(function(n){var i=t.svg.getBoundingClientRect(),r=n.pageX-i.left,o=n.pageY-i.top;e||(e=o<100?50:-50);var s=r,a=2*o-100+e;Hi.to(t.path,{attr:{d:t.getPathD(s,a)},duration:.2,overwrite:!0})})),this.el.addEventListener("mouseleave",(function(){e=0,Hi.to(t.path,{attr:{d:t.getPathD()},duration:2,ease:"elastic.out(1, 0.2)"})}))}},r.bindResizeObserver=function(){var t=this;this.updateDebounced=zl(this.update.bind(this),30),this.resizeObserver=new ResizeObserver((function(){return t.updateDebounced()})),this.resizeObserver.observe(this.el)},i}(o);function Bl(t,e){return(Bl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var Vl=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).layout=e.app.get("layout"),e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,Bl(e,n);var r=i.prototype;return r.bindModalOpen=function(){var t=this;this.el.dataset.modalOpen&&this.el.addEventListener("click",(function(e){var n=t.app.find(t.el.dataset.modalOpen,"modal");n&&(e.preventDefault(),e.stopPropagation(),n.open())}))},r.bindScrollTo=function(){var t=this;this.el.dataset.scrollTo||this.el.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation(),t.layout.scrollToTarget(t.el.dataset.scrollTo)}))},i}(o);function Hl(t,e){return(Hl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var Gl=function(t){var e,n;function i(){return t.apply(this,arguments)||this} return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,Hl(e,n),i}(o),Wl=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;/*! * strings: 3.11.1 * https://greensock.com * * Copyright 2008-2022, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */ /*! * SplitText: 3.11.1 * https://greensock.com * * @license Copyright 2008-2022, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */ var jl,ql,Xl,Yl=/(?:\r|\n|\t\t)/g,Zl=/(?:\s\s+)/g,Kl=function(t){return ql.getComputedStyle(t)},Jl=Array.isArray,Ql=[].slice,$l=function(t,e){var n;return Jl(t)?t:"string"==(n=typeof t)&&!e&&t?Ql.call(jl.querySelectorAll(t),0):t&&"object"===n&&"length" in t?Ql.call(t,0):t?[t]:[]},tu=function(t){return"absolute"===t.position||!0===t.absolute},eu=function(t,e){for(var n,i=e.length;--i>-1;) if(n=e[i],t.substr(0,n.length)===n)return n.length},nu=function(t,e){void 0===t&&(t="");var n=~t.indexOf("++"),i=1;return n&&(t=t.split("++").join("")),function(){return"<"+e+" style='position:relative;display:inline-block;'"+(t?" class='"+t+(n?i++:"")+"'>":">")}},iu=function t(e,n,i){var r=e.nodeType;if(1===r||9===r||11===r) for(e=e.firstChild;e;e=e.nextSibling)t(e,n,i);else 3!==r&&4!==r||(e.nodeValue=e.nodeValue.split(n).join(i))},ru=function(t,e){for(var n=e.length;--n>-1;)t.push(e[n])},ou=function(t,e,n){for(var i;t&&t!==e;){if(i=t._next||t.nextSibling)return i.textContent.charAt(0)===n;t=t.parentNode||t._parent}},su=function t(e){var n,i,r=$l(e.childNodes),o=r.length;for(n=0;nT&&("BR"!==c.nodeName||0===a)&&(f=[],F.push(f),b=_),z&&(c._x=c.offsetLeft,c._y=_,c._w=c.offsetWidth,c._h=c.offsetHeight),F&&((c._isSplit&&d||!N&&d||I&&d||!I&&c.parentNode.parentNode===t&&!c.parentNode._isSplit)&&(f.push(c),c._x-=y,ou(c,t,L)&&(c._wordEnd=!0)),"BR"===c.nodeName&&(c.nextSibling&&"BR"===c.nextSibling.nodeName||0===a)&&F.push([])));for(a=0;a-1;)B[a].parentNode.removeChild(B[a]);if(F){for(z&&(g=jl.createElement(R),t.appendChild(g),v=g.offsetWidth+"px",_=g.offsetParent===t?0:t.offsetLeft,t.removeChild(g)),m=t.style.cssText,t.style.cssText="display:none;";t.firstChild;)t.removeChild(t.firstChild);for(p=" "===L&&(!z||!I&&!N),a=0;at.clientHeight&&(t.style.height=s-M+"px",t.clientHeightt.clientWidth&&(t.style.width=o-D+"px",t.clientWidth",_=1,x=e.specialChars?"function"==typeof e.specialChars?e.specialChars:eu:null,y=jl.createElement("div"),b=t.parentNode;for(b.insertBefore(y,t),y.textContent=t.nodeValue,b.removeChild(t),c=-1!==(r=function t(e){var n=e.nodeType,i="";if(1===n||9===n||11===n){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=t(e)}else if(3===n||4===n)return e.nodeValue;return i}(t=y)).indexOf("<"),!1!==e.reduceWhiteSpace&&(r=r.replace(Zl," ").replace(Yl,"")),c&&(r=r.split("<").join("{{LT}}")),l=r.length,o=(" "===r.charAt(0)?g:"")+n(),s=0;s":u,s+=h-1;else if(u===m&&r.charAt(s-1)!==m&&s){for(o+=_?v:"",_=0;r.charAt(s+1)===m;)o+=g,s++;s===l-1?o+=g:")"!==r.charAt(s+1)&&(o+=g+n(),_=1)}else "{"===u&&"{{LT}}"===r.substr(s,6)?(o+=f?i()+"{{LT}}":"{{LT}}",s+=5):u.charCodeAt(0)>=55296&&u.charCodeAt(0)<=56319||r.charCodeAt(s+1)>=65024&&r.charCodeAt(s+1)<=65039?(a=((r.substr(s,12).split(Wl)||[])[1]||"").length||2,o+=f&&" "!==u?i()+r.substr(s,a)+"":r.substr(s,a),s+=a-1):o+=f&&" "!==u?i()+u+"":u;t.outerHTML=o+(_?v:""),c&&iu(b,"{{LT}}","<")},cu=function t(e,n,i,r){var o,s,a=$l(e.childNodes),l=a.length,u=tu(n);if(3!==e.nodeType||l>1){for(n.absolute=!1,o=0;o-1;)i=this.elements[r],this._originals[r]=i.innerHTML,e=i.clientHeight,n=i.clientWidth,cu(i,t,s,a),lu(i,t,this.chars,this.words,this.lines,n,e);return this.chars.reverse(),this.words.reverse(),this.lines.reverse(),this.isSplit=!0,this},e.revert=function(){var t=this._originals;if(!t)throw "revert() call wasn't scoped properly.";return this.elements.forEach((function(e,n){return e.innerHTML=t[n]})),this.chars=[],this.words=[],this.lines=[],this.isSplit=!1,this},t.create=function(e,n){return new t(e,n)},t}();function du(){return(du=Object.assign?Object.assign.bind():function(t){for(var e=1;et&&this.removeClones(this.clonesCount-t),this.clonesCount=t)},n.getCalcData=function(){var t={clonesCount:0,clonesWidth:0,containerWidth:this.container.offsetWidth,fullWidth:0,itemWidth:[],itemsWidth:0,lastIndex:0};this.item.map((function(e){var n=e.getBoundingClientRect(),i=window.getComputedStyle(e),r=n.width+parseInt(i.marginLeft)+parseInt(i.marginRight);t.itemWidth.push(r),t.itemsWidth+=r}));for(var e=t.itemWidth.length,n=this.options.clonesOverflow?t.containerWidth:t.containerWidth-t.itemsWidth;n>t.clonesWidth||t.clonesCount0;)t.lastIndex=t.clonesCount%e,t.clonesWidth+=t.itemWidth[t.lastIndex],t.clonesCount++;return t.fullWidth=t.clonesWidth+t.itemsWidth,t},n.update=function(){this.calcData=this.getCalcData(),this.setClonesCount(this.calcData.clonesCount),this.trigger("update",this.calcData)},n.refresh=function(t){void 0===t&&(t=!0),this.removeClones(),this.item=Array.from(this.container.querySelectorAll(this.options.itemSelector)),this.calcData={},this.clonesCount=0,this.trigger("refresh"),t&&this.update()},n.destroy=function(t){void 0===t&&(t=!1),t&&this.removeClones(),this.resizeObserver&&this.resizeObserver.disconnect(),this.trigger("destroy")},e}(Pu);Lu.defaultOptions={container:null,wrapper:null,itemSelector:null,cloneClassName:"-clone",autoUpdate:!0,clonesOverflow:!1,clonesFinish:!1,clonesMin:0};var Ru=function(t){function e(n){var i;return(i=t.call(this)||this).options=Eu({},e.defaultOptions,n),i.gsap=e.gsap||window.gsap,i.paused=i.options.paused,i.createFiller(),i.createTimeline(),i.options.autoStop&&i.bindIntersectionObserver(),i.options.plugins&&i.initPlugins(),i} Cu(e,t),e.registerGSAP=function(t){e.gsap=t},e.use=function(){[].slice.call(arguments).forEach((function(t){var n=t.pluginName;if("string"!=typeof n)throw new TypeError("Invalid plugin. Name is required.");e.plugins[n]=t}))};var n=e.prototype;return n.createFiller=function(){var t=this;this.filler=new Lu(this.options),this.filler.on("update",(function(e,n){t.invalidate(),t.trigger("update",n)})),this.filler.on("refresh",(function(){t.trigger("refresh")}))},n.createTimeline=function(){var t=this;return this.tl=new this.gsap.timeline({paused:this.options.paused,repeat:-1,yoyo:!this.options.loop,onReverseComplete:function(){this.progress(1)}}),this.gsap.set(this.filler.container,{overflow:"hidden"}),this.tl.fromTo(this.filler.wrapper,{x:function(){return t.options.clonesOverflow?-t.filler.calcData.itemsWidth:-(t.filler.calcData.fullWidth-t.filler.calcData.containerWidth)}},{x:0,duration:this.options.speed,ease:this.options.ease}),this.tl.seek(this.options.seek),this.tl},n.bindIntersectionObserver=function(){var t=this;this.intersectionObserver=new IntersectionObserver((function(e){e[0].isIntersecting?t.resume():t.pause()})),this.intersectionObserver.observe(this.filler.container)},n.initPlugins=function(){this.plugin={};for(var t=0,n=Object.entries(this.options.plugins);t0?Math.max(t.options.threshold,s):Math.min(-t.options.threshold,s);t.tween=t.gsap.to(t.tl,{timeScale:a,duration:t.options.speed,ease:t.options.ease,overwrite:t.options.overwrite}),i=!1}else if(!i){var l=t.options.stopOnEnd?0:n*t.options.threshold;t.gsap.killTweensOf(t.tl),t.tween=t.gsap.to(t.tl,{timeScale:l,duration:t.options.speed,overwrite:t.options.overwrite,ease:t.options.ease}),i=!0} n=Math.sign(o),e=r},this.gsap.ticker.add(this.tickerFn)},e.destroy=function(){this.tickerFn&&(this.gsap.ticker.remove(this.tickerFn),this.tickerFn=null),this.tween&&this.tween.kill()},t}();function Fu(t,e){return(Fu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} Ou.pluginName="scroller",Ou.defaultOptions={speed:1,multiplier:.5,threshold:1,ease:"expo.out",overwrite:!0,bothDirection:!0,reversed:!1,stopOnEnd:!1,scrollProxy:null},Ru.registerGSAP(Hi),Ru.use(Ou);var Iu=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).cursor=e.app.get("cursor"),e.layout=e.app.get("layout"),e.bg=e.el.querySelector(".cb-overview-bg"),e.content=e.el.querySelector(".cb-overview-content"),e.header=e.el.querySelector(".cb-overview-header"),e.icon=e.el.querySelector(".cb-overview-icon"),e.caption=e.el.querySelectorAll(".cb-overview-caption"),e.author=e.el.querySelector(".cb-overview-author"),e.text=e.el.querySelector(".cb-overview-text"),e.action=e.el.querySelector(".cb-overview-action"),e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,Fu(e,n);var r=i.prototype;return r.onInit=function(){try{var t=this;return Promise.resolve(document.fonts.ready).then((function(){t.magicParallax(),t.magicShow()}))}catch(t){return Promise.reject(t)}},r.magicShow=function(){var t,e;this.header&&mu(this.header.firstElementChild,{type:"lines",stagger:.3}),this.icon&&(t=this.icon,void 0===e&&(e={}),Ss.create({trigger:t,animation:gu(t,e),once:!0})),this.caption.length&&this.caption.forEach((function(t){mu(t,{stagger:.1})})),this.author&&xu(this.author),this.text&&mu(this.text),this.action&&function(t,e){void 0===e&&(e={}),Ss.create({trigger:t,animation:vu(t,e),once:!0})}(this.action)},r.magicParallax=function(){Ss.create({trigger:this.el,animation:this.tlParallax(),start:"top bottom",end:"bottom top",scrub:!0})},r.tlParallax=function(){var t=new Hi.timeline;return this.bg&&t.fromTo(this.bg,{yPercent:-30},{yPercent:30,ease:"none"},0),t},i}(o);function Nu(t,e){return(Nu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var zu=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).item=e.el.querySelectorAll(".cb-splitshow-item"),e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,Nu(e,n);var r=i.prototype;return r.onInit=function(){try{return this.magicItems(),Promise.resolve()}catch(t){return Promise.reject(t)}},r.magicItems=function(){var t=this;this.item.forEach((function(e){var n=e.querySelector(".cb-splitshow-preview").querySelector(".cb-splitshow-preview-media"),i=e.querySelector(".cb-splitshow-caption");Ss.create({trigger:e,animation:t.tlShow(n,i),once:!0}),Ss.create({trigger:e,animation:t.tlParallax(n),start:"top bottom",end:"bottom top",scrub:!0})}))},r.tlShow=function(t,e){var n=new Hi.timeline;return Hi.set(t,{opacity:0}),n.to(t,{opacity:1,duration:1}),n},r.tlParallax=function(t){var e=new Hi.timeline;return Hi.set(t,{scale:1.05}),e.fromTo(t,{y:"-10%"},{y:"10%",ease:"none"}),e},i}(o);function ku(t,e){return(ku=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var Uu=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).preview=e.el.querySelector(".cb-screenshot-preview"),e.previewMedia=e.preview.querySelector(".cb-screenshot-preview-media"),e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,ku(e,n);var r=i.prototype;return r.onInit=function(){try{return this.magicShow(),this.magicParallax(),Promise.resolve()}catch(t){return Promise.reject(t)}},r.magicShow=function(){Ss.create({trigger:this.el,animation:this.tlShow(),once:!0})},r.tlShow=function(){var t=new Hi.timeline;return Hi.set(this.previewMedia,{opacity:0}),t.to(this.previewMedia,{opacity:1,duration:1}),t},r.magicParallax=function(){Ss.create({trigger:this.el,animation:this.tlParallax(),start:"top bottom",end:"bottom top",scrub:!0})},r.tlParallax=function(){var t=new Hi.timeline;return Hi.set(this.previewMedia,{scale:1.05}),t.fromTo(this.previewMedia,{y:"-10%"},{y:"10%",ease:"none"}),t},i}(o);function Bu(t,e){return(Bu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var Vu=function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).layout=e.app.get("layout"),e.reel=e.el.querySelector(".cb-outro-reel"),e.header=e.el.querySelector(".cb-outro-header"),e.caption=e.el.querySelector(".cb-outro-caption"),e.social=e.el.querySelectorAll(".cb-outro-social"),e.location=e.el.querySelectorAll(".cb-outro-location"),e.initReeller(),e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,Bu(e,n);var r=i.prototype;return r.onInit=function(){try{return this.magicShow(),Promise.resolve()}catch(t){return Promise.reject(t)}},r.initReeller=function(){var t=this;new Ru({container:this.reel,wrapper:".cb-outro-reel-wrap",itemSelector:".cb-outro-reel-item",speed:10,plugins:{scroller:{multiplier:.3,speed:1,threshold:1,reversed:!0,scrollProxy:function(){return t.layout.scrollTop()}}}});Ss.isTouch||this.social.forEach((function(t){var e=t.querySelector(".cb-outro-social-reel"),n=new Ru({container:e,wrapper:".cb-outro-social-reel-wrap",itemSelector:".cb-outro-social-reel-item",autoStop:!1,speed:3});t.addEventListener("mouseenter",(function(){return n.reverse()})),t.addEventListener("mouseleave",(function(){return n.pause()}))}))},r.magicShow=function(){var t=this;this.caption&&mu(this.caption,{stagger:.1}),this.social.length&&this.social.forEach((function(e){Ss.create({trigger:e,start:"center bottom",animation:t.tlShowSocialItem(e),once:!0})})),this.location.length&&this.location.forEach((function(e){Ss.create({trigger:e,start:"center bottom",animation:t.tlShowLocationItem(e),once:!0})}))},r.tlShowSocialItem=function(t){var e=new Hi.timeline,n=t.querySelector(".cb-outro-social-title"),i=t.querySelector(".cb-outro-social-divider"),r=t.querySelector(".cb-outro-social-arr");return Hi.set(i,{scaleX:0,transformOrigin:"left center"}),e.to(i,{scaleX:1,duration:3,stagger:.3,ease:"expo.out"},0),e.add(pu(n,{duration:2.5}),0),e.add(gu(r),.5),e},r.tlShowLocationItem=function(t){var e=new Hi.timeline,n=t.querySelector(".cb-outro-location-caption"),i=t.querySelector(".cb-outro-location-address"),r=t.querySelector(".cb-outro-location-action");return e.add(_u(n),0),e.add(pu(i),.2),e.add(vu(r),.4),e},i}(o);/** * @license * Copyright 2010-2022 Three.js Authors * SPDX-License-Identifier: MIT */ class Hu{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)} hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)} removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}} dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e>8&255]+Gu[t>>16&255]+Gu[t>>24&255]+"-"+Gu[255&e]+Gu[e>>8&255]+"-"+Gu[e>>16&15|64]+Gu[e>>24&255]+"-"+Gu[63&n|128]+Gu[n>>8&255]+"-"+Gu[n>>16&255]+Gu[n>>24&255]+Gu[255&i]+Gu[i>>8&255]+Gu[i>>16&255]+Gu[i>>24&255]).toLowerCase()} function Xu(t,e,n){return Math.max(e,Math.min(n,t))} function Yu(t,e){return(t%e+e)%e} function Zu(t,e,n){return(1-n)*t+n*e} function Ku(t){return 0==(t&t-1)&&0!==t} function Ju(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))} function Qu(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}} function $u(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}} class tc{constructor(t=0,e=0){tc.prototype.isVector2=!0,this.x=t,this.y=e} get width(){return this.x} set width(t){this.x=t} get height(){return this.y} set height(t){this.y=t} set(t,e){return this.x=t,this.y=e,this} setScalar(t){return this.x=t,this.y=t,this} setX(t){return this.x=t,this} setY(t){return this.y=t,this} setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)} return this} getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}} clone(){return new this.constructor(this.x,this.y)} copy(t){return this.x=t.x,this.y=t.y,this} add(t){return this.x+=t.x,this.y+=t.y,this} addScalar(t){return this.x+=t,this.y+=t,this} addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this} addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this} sub(t){return this.x-=t.x,this.y-=t.y,this} subScalar(t){return this.x-=t,this.y-=t,this} subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this} multiply(t){return this.x*=t.x,this.y*=t.y,this} multiplyScalar(t){return this.x*=t,this.y*=t,this} divide(t){return this.x/=t.x,this.y/=t.y,this} divideScalar(t){return this.multiplyScalar(1/t)} applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this} min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this} max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this} clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this} clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this} clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))} floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this} ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this} round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this} roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this} negate(){return this.x=-this.x,this.y=-this.y,this} dot(t){return this.x*t.x+this.y*t.y} cross(t){return this.x*t.y-this.y*t.x} lengthSq(){return this.x*this.x+this.y*this.y} length(){return Math.sqrt(this.x*this.x+this.y*this.y)} manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)} normalize(){return this.divideScalar(this.length()||1)} angle(){return Math.atan2(-this.y,-this.x)+Math.PI} distanceTo(t){return Math.sqrt(this.distanceToSquared(t))} distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n} manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)} setLength(t){return this.normalize().multiplyScalar(t)} lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this} lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this} equals(t){return t.x===this.x&&t.y===this.y} fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this} toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t} fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this} rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this} random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}} class ec{constructor(){ec.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]} set(t,e,n,i,r,o,s,a,l){const u=this.elements;return u[0]=t,u[1]=i,u[2]=s,u[3]=e,u[4]=r,u[5]=a,u[6]=n,u[7]=o,u[8]=l,this} identity(){return this.set(1,0,0,0,1,0,0,0,1),this} copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this} extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this} setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this} multiply(t){return this.multiplyMatrices(this,t)} premultiply(t){return this.multiplyMatrices(t,this)} multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[3],a=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],f=n[8],p=i[0],m=i[3],g=i[6],v=i[1],_=i[4],x=i[7],y=i[2],b=i[5],w=i[8];return r[0]=o*p+s*v+a*y,r[3]=o*m+s*_+a*b,r[6]=o*g+s*x+a*w,r[1]=l*p+u*v+c*y,r[4]=l*m+u*_+c*b,r[7]=l*g+u*x+c*w,r[2]=h*p+d*v+f*y,r[5]=h*m+d*_+f*b,r[8]=h*g+d*x+f*w,this} multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this} determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8];return e*o*u-e*s*l-n*r*u+n*s*a+i*r*l-i*o*a} invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8],c=u*o-s*l,h=s*a-u*r,d=l*r-o*a,f=e*c+n*h+i*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const p=1/f;return t[0]=c*p,t[1]=(i*l-u*n)*p,t[2]=(s*n-i*o)*p,t[3]=h*p,t[4]=(u*e-i*a)*p,t[5]=(i*r-s*e)*p,t[6]=d*p,t[7]=(n*a-l*e)*p,t[8]=(o*e-n*r)*p,this} transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this} getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()} transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this} setUvTransform(t,e,n,i,r,o,s){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*o+l*s)+o+t,-i*l,i*a,-i*(-l*o+a*s)+s+e,0,0,1),this} scale(t,e){return this.premultiply(nc.makeScale(t,e)),this} rotate(t){return this.premultiply(nc.makeRotation(-t)),this} translate(t,e){return this.premultiply(nc.makeTranslation(t,e)),this} makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this} makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this} makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this} equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++) if(e[t]!==n[t])return!1;return!0} fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this} toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t} clone(){return(new this.constructor).fromArray(this.elements)}} const nc=new ec;function ic(t){for(let e=t.length-1;e>=0;--e) if(t[e]>=65535)return!0;return!1} Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function rc(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)} function oc(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)} function sc(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055} const ac={srgb:{"srgb-linear":oc},"srgb-linear":{srgb:sc}},lc={legacyMode:!0,get workingColorSpace(){return"srgb-linear"},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if(ac[e]&&void 0!==ac[e][n]){const i=ac[e][n];return t.r=i(t.r),t.g=i(t.g),t.b=i(t.b),t} throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},uc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},cc={r:0,g:0,b:0},hc={h:0,s:0,l:0},dc={h:0,s:0,l:0};function fc(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t} function pc(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e} class mc{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)} set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this} setScalar(t){return this.r=t,this.g=t,this.b=t,this} setHex(t,e="srgb"){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,lc.toWorkingColorSpace(this,e),this} setRGB(t,e,n,i=lc.workingColorSpace){return this.r=t,this.g=e,this.b=n,lc.toWorkingColorSpace(this,i),this} setHSL(t,e,n,i=lc.workingColorSpace){if(t=Yu(t,1),e=Xu(e,0,1),n=Xu(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=fc(r,i,t+1/3),this.g=fc(r,i,t),this.b=fc(r,i,t-1/3)} return lc.toWorkingColorSpace(this,i),this} setStyle(t,e="srgb"){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")} let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=i[1],o=i[2];switch(r){case "rgb":case "rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,lc.toWorkingColorSpace(this,e),n(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,lc.toWorkingColorSpace(this,e),n(t[4]),this;break;case "hsl":case "hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const i=parseFloat(t[1])/360,r=parseFloat(t[2])/100,o=parseFloat(t[3])/100;return n(t[4]),this.setHSL(i,r,o,e)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],n=t.length;if(3===n)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,lc.toWorkingColorSpace(this,e),this;if(6===n)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,lc.toWorkingColorSpace(this,e),this} return t&&t.length>0?this.setColorName(t,e):this} setColorName(t,e="srgb"){const n=uc[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this} clone(){return new this.constructor(this.r,this.g,this.b)} copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this} copySRGBToLinear(t){return this.r=oc(t.r),this.g=oc(t.g),this.b=oc(t.b),this} copyLinearToSRGB(t){return this.r=sc(t.r),this.g=sc(t.g),this.b=sc(t.b),this} convertSRGBToLinear(){return this.copySRGBToLinear(this),this} convertLinearToSRGB(){return this.copyLinearToSRGB(this),this} getHex(t="srgb"){return lc.fromWorkingColorSpace(pc(this,cc),t),Xu(255*cc.r,0,255)<<16^Xu(255*cc.g,0,255)<<8^Xu(255*cc.b,0,255)<<0} getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)} getHSL(t,e=lc.workingColorSpace){lc.fromWorkingColorSpace(pc(this,cc),e);const n=cc.r,i=cc.g,r=cc.b,o=Math.max(n,i,r),s=Math.min(n,i,r);let a,l;const u=(s+o)/2;if(s===o)a=0,l=0;else{const t=o-s;switch(l=u<=.5?t/(o+s):t/(2-o-s),o){case n:a=(i-r)/t+(i2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")} static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=rc("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n} dispose(){this.dispatchEvent({type:"dispose"})} transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)} if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)} return this.flipY&&(t.y=1-t.y),t} set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}} bc.DEFAULT_IMAGE=null,bc.DEFAULT_MAPPING=300,bc.DEFAULT_ANISOTROPY=1;class wc{constructor(t=0,e=0,n=0,i=1){wc.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i} get width(){return this.z} set width(t){this.z=t} get height(){return this.w} set height(t){this.w=t} set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this} setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this} setX(t){return this.x=t,this} setY(t){return this.y=t,this} setZ(t){return this.z=t,this} setW(t){return this.w=t,this} setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)} return this} getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}} clone(){return new this.constructor(this.x,this.y,this.z,this.w)} copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this} add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this} addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this} addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this} addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this} sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this} subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this} subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this} multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this} multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this} applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this} divideScalar(t){return this.multiplyScalar(1/t)} setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this} setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=t.elements,s=o[0],a=o[4],l=o[8],u=o[1],c=o[5],h=o[9],d=o[2],f=o[6],p=o[10];if(Math.abs(a-u)<.01&&Math.abs(l-d)<.01&&Math.abs(h-f)<.01){if(Math.abs(a+u)<.1&&Math.abs(l+d)<.1&&Math.abs(h+f)<.1&&Math.abs(s+c+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,o=(c+1)/2,m=(p+1)/2,g=(a+u)/4,v=(l+d)/4,_=(h+f)/4;return t>o&&t>m?t<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=g/n,r=v/n):o>m?o<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=g/i,r=_/i):m<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=v/r,i=_/r),this.set(n,i,r,e),this} let m=Math.sqrt((f-h)*(f-h)+(l-d)*(l-d)+(u-a)*(u-a));return Math.abs(m)<.001&&(m=1),this.x=(f-h)/m,this.y=(l-d)/m,this.z=(u-a)/m,this.w=Math.acos((s+c+p-1)/2),this} min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this} max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this} clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this} clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this} clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))} floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this} ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this} round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this} roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this} negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this} dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w} lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w} length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)} manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)} normalize(){return this.divideScalar(this.length()||1)} setLength(t){return this.normalize().multiplyScalar(t)} lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this} lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this} equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w} fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this} toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t} fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this} random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}} class Sc extends Hu{constructor(t=1,e=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new wc(0,0,t,e),this.scissorTest=!1,this.viewport=new wc(0,0,t,e);const i={width:t,height:e,depth:1};this.texture=new bc(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0} setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)} clone(){return(new this.constructor).copy(this)} copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new _c(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this} dispose(){this.dispatchEvent({type:"dispose"})}} class Mc extends bc{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}} class Dc extends bc{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}} class Tc{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i} static slerpFlat(t,e,n,i,r,o,s){let a=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3];const h=r[o+0],d=r[o+1],f=r[o+2],p=r[o+3];if(0===s)return t[e+0]=a,t[e+1]=l,t[e+2]=u,void(t[e+3]=c);if(1===s)return t[e+0]=h,t[e+1]=d,t[e+2]=f,void(t[e+3]=p);if(c!==p||a!==h||l!==d||u!==f){let t=1-s;const e=a*h+l*d+u*f+c*p,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r} const r=s*n;if(a=a*t+h*r,l=l*t+d*r,u=u*t+f*r,c=c*t+p*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+u*u+c*c);a*=t,l*=t,u*=t,c*=t}} t[e]=a,t[e+1]=l,t[e+2]=u,t[e+3]=c} static multiplyQuaternionsFlat(t,e,n,i,r,o){const s=n[i],a=n[i+1],l=n[i+2],u=n[i+3],c=r[o],h=r[o+1],d=r[o+2],f=r[o+3];return t[e]=s*f+u*c+a*d-l*h,t[e+1]=a*f+u*h+l*c-s*d,t[e+2]=l*f+u*d+s*h-a*c,t[e+3]=u*f-s*c-a*h-l*d,t} get x(){return this._x} set x(t){this._x=t,this._onChangeCallback()} get y(){return this._y} set y(t){this._y=t,this._onChangeCallback()} get z(){return this._z} set z(t){this._z=t,this._onChangeCallback()} get w(){return this._w} set w(t){this._w=t,this._onChangeCallback()} set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this} clone(){return new this.constructor(this._x,this._y,this._z,this._w)} copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this} setFromEuler(t,e){const n=t._x,i=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(n/2),u=s(i/2),c=s(r/2),h=a(n/2),d=a(i/2),f=a(r/2);switch(o){case "XYZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case "YXZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case "ZXY":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case "ZYX":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case "YZX":this._x=h*u*c+l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c-h*d*f;break;case "XZY":this._x=h*u*c-l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)} return!1!==e&&this._onChangeCallback(),this} setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this} setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],u=e[6],c=e[10],h=n+s+c;if(h>0){const t=.5/Math.sqrt(h+1);this._w=.25/t,this._x=(u-a)*t,this._y=(r-l)*t,this._z=(o-i)*t}else if(n>s&&n>c){const t=2*Math.sqrt(1+n-s-c);this._w=(u-a)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+l)/t}else if(s>c){const t=2*Math.sqrt(1+s-n-c);this._w=(r-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(a+u)/t}else{const t=2*Math.sqrt(1+c-n-s);this._w=(o-i)/t,this._x=(r+l)/t,this._y=(a+u)/t,this._z=.25*t} return this._onChangeCallback(),this} setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()} angleTo(t){return 2*Math.acos(Math.abs(Xu(this.dot(t),-1,1)))} rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this} identity(){return this.set(0,0,0,1)} invert(){return this.conjugate()} conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this} dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w} lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w} length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)} normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this} multiply(t){return this.multiplyQuaternions(this,t)} premultiply(t){return this.multiplyQuaternions(t,this)} multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,u=e._w;return this._x=n*u+o*s+i*l-r*a,this._y=i*u+o*a+r*s-n*l,this._z=r*u+o*l+n*a-i*s,this._w=o*u-n*s-i*a-r*l,this._onChangeCallback(),this} slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let s=o*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this} const l=Math.sqrt(a),u=Math.atan2(l,s),c=Math.sin((1-e)*u)/l,h=Math.sin(e*u)/l;return this._w=o*c+this._w*h,this._x=n*c+this._x*h,this._y=i*c+this._y*h,this._z=r*c+this._z*h,this._onChangeCallback(),this} slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)} random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))} equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w} fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this} toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t} fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this} _onChange(t){return this._onChangeCallback=t,this} _onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}} class Ec{constructor(t=0,e=0,n=0){Ec.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n} set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this} setScalar(t){return this.x=t,this.y=t,this.z=t,this} setX(t){return this.x=t,this} setY(t){return this.y=t,this} setZ(t){return this.z=t,this} setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)} return this} getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}} clone(){return new this.constructor(this.x,this.y,this.z)} copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this} add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this} addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this} addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this} addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this} sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this} subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this} subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this} multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this} multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this} multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this} applyEuler(t){return this.applyQuaternion(Ac.setFromEuler(t))} applyAxisAngle(t,e){return this.applyQuaternion(Ac.setFromAxisAngle(t,e))} applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this} applyNormalMatrix(t){return this.applyMatrix3(t).normalize()} applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this} applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*i-s*n,u=a*n+s*e-r*i,c=a*i+r*n-o*e,h=-r*e-o*n-s*i;return this.x=l*a+h*-r+u*-s-c*-o,this.y=u*a+h*-o+c*-r-l*-s,this.z=c*a+h*-s+l*-o-u*-r,this} project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)} unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)} transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()} divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this} divideScalar(t){return this.multiplyScalar(1/t)} min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this} max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this} clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this} clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this} clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))} floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this} ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this} round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this} roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this} negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this} dot(t){return this.x*t.x+this.y*t.y+this.z*t.z} lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z} length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)} manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)} normalize(){return this.divideScalar(this.length()||1)} setLength(t){return this.normalize().multiplyScalar(t)} lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this} lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this} cross(t){return this.crossVectors(this,t)} crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this} projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)} projectOnPlane(t){return Cc.copy(this).projectOnVector(t),this.sub(Cc)} reflect(t){return this.sub(Cc.copy(t).multiplyScalar(2*this.dot(t)))} angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Xu(n,-1,1))} distanceTo(t){return Math.sqrt(this.distanceToSquared(t))} distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i} manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)} setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)} setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this} setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)} setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this} setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this} setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this} setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)} setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)} setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this} equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z} fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this} toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t} fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this} random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this} randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}} const Cc=new Ec,Ac=new Tc;class Pc{constructor(t=new Ec(1/0,1/0,1/0),e=new Ec(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e} set(t,e){return this.min.copy(t),this.max.copy(e),this} setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;ar&&(r=l),u>o&&(o=u),c>s&&(s=c)} return this.min.set(e,n,i),this.max.set(r,o,s),this} setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;ar&&(r=l),u>o&&(o=u),c>s&&(s=c)} return this.min.set(e,n,i),this.max.set(r,o,s),this} setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)} containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z} getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))} intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)} intersectsSphere(t){return this.clampPoint(t.center,Rc),Rc.distanceToSquared(t.center)<=t.radius*t.radius} intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant} intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Bc),Vc.subVectors(this.max,Bc),Fc.subVectors(t.a,Bc),Ic.subVectors(t.b,Bc),Nc.subVectors(t.c,Bc),zc.subVectors(Ic,Fc),kc.subVectors(Nc,Ic),Uc.subVectors(Fc,Nc);let e=[0,-zc.z,zc.y,0,-kc.z,kc.y,0,-Uc.z,Uc.y,zc.z,0,-zc.x,kc.z,0,-kc.x,Uc.z,0,-Uc.x,-zc.y,zc.x,0,-kc.y,kc.x,0,-Uc.y,Uc.x,0];return!!Wc(e,Fc,Ic,Nc,Vc)&&(e=[1,0,0,0,1,0,0,0,1],!!Wc(e,Fc,Ic,Nc,Vc)&&(Hc.crossVectors(zc,kc),e=[Hc.x,Hc.y,Hc.z],Wc(e,Fc,Ic,Nc,Vc)))} clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)} distanceToPoint(t){return Rc.copy(t).clamp(this.min,this.max).sub(t).length()} getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Rc).length(),t} intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this} union(t){return this.min.min(t.min),this.max.max(t.max),this} applyMatrix4(t){return this.isEmpty()||(Lc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Lc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Lc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Lc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Lc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Lc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Lc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Lc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Lc)),this} translate(t){return this.min.add(t),this.max.add(t),this} equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}} const Lc=[new Ec,new Ec,new Ec,new Ec,new Ec,new Ec,new Ec,new Ec],Rc=new Ec,Oc=new Pc,Fc=new Ec,Ic=new Ec,Nc=new Ec,zc=new Ec,kc=new Ec,Uc=new Ec,Bc=new Ec,Vc=new Ec,Hc=new Ec,Gc=new Ec;function Wc(t,e,n,i,r){for(let o=0,s=t.length-3;o<=s;o+=3){Gc.fromArray(t,o);const s=r.x*Math.abs(Gc.x)+r.y*Math.abs(Gc.y)+r.z*Math.abs(Gc.z),a=e.dot(Gc),l=n.dot(Gc),u=i.dot(Gc);if(Math.max(-Math.max(a,l,u),Math.min(a,l,u))>s)return!1} return!0} const jc=new Pc,qc=new Ec,Xc=new Ec;class Yc{constructor(t=new Ec,e=-1){this.center=t,this.radius=e} set(t,e){return this.center.copy(t),this.radius=e,this} setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):jc.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e} getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)} applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this} translate(t){return this.center.add(t),this} expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;qc.subVectors(t,this.center);const e=qc.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(qc,n/t),this.radius+=n} return this} union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Xc.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(qc.copy(t.center).add(Xc)),this.expandByPoint(qc.copy(t.center).sub(Xc))),this)} equals(t){return t.center.equals(this.center)&&t.radius===this.radius} clone(){return(new this.constructor).copy(this)}} const Zc=new Ec,Kc=new Ec,Jc=new Ec,Qc=new Ec,$c=new Ec,th=new Ec,eh=new Ec;class nh{constructor(t=new Ec,e=new Ec(0,0,-1)){this.origin=t,this.direction=e} set(t,e){return this.origin.copy(t),this.direction.copy(e),this} copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this} at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)} lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this} recast(t){return this.origin.copy(this.at(t,Zc)),this} closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)} distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))} distanceSqToPoint(t){const e=Zc.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Zc.copy(this.direction).multiplyScalar(e).add(this.origin),Zc.distanceToSquared(t))} distanceSqToSegment(t,e,n,i){Kc.copy(t).add(e).multiplyScalar(.5),Jc.copy(e).sub(t).normalize(),Qc.copy(this.origin).sub(Kc);const r=.5*t.distanceTo(e),o=-this.direction.dot(Jc),s=Qc.dot(this.direction),a=-Qc.dot(Jc),l=Qc.lengthSq(),u=Math.abs(1-o*o);let c,h,d,f;if(u>0) if(c=o*a-s,h=o*s-a,f=r*u,c>=0) if(h>=-f) if(h<=f){const t=1/u;c*=t,h*=t,d=c*(c+o*h+2*s)+h*(o*c+h+2*a)+l}else h=r,c=Math.max(0,-(o*h+s)),d=-c*c+h*(h+2*a)+l;else h=-r,c=Math.max(0,-(o*h+s)),d=-c*c+h*(h+2*a)+l;else h<=-f?(c=Math.max(0,-(-o*r+s)),h=c>0?-r:Math.min(Math.max(-r,-a),r),d=-c*c+h*(h+2*a)+l):h<=f?(c=0,h=Math.min(Math.max(-r,-a),r),d=h*(h+2*a)+l):(c=Math.max(0,-(o*r+s)),h=c>0?r:Math.min(Math.max(-r,-a),r),d=-c*c+h*(h+2*a)+l);else h=o>0?-r:r,c=Math.max(0,-(o*h+s)),d=-c*c+h*(h+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(c).add(this.origin),i&&i.copy(Jc).multiplyScalar(h).add(Kc),d} intersectSphere(t,e){Zc.subVectors(t.center,this.origin);const n=Zc.dot(this.direction),i=Zc.dot(Zc)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)} intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius} distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null} intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)} intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0} intersectBox(t,e){let n,i,r,o,s,a;const l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,i=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,i=(t.min.x-h.x)*l),u>=0?(r=(t.min.y-h.y)*u,o=(t.max.y-h.y)*u):(r=(t.max.y-h.y)*u,o=(t.min.y-h.y)*u),n>o||r>i?null:((r>n||isNaN(n))&&(n=r),(o=0?(s=(t.min.z-h.z)*c,a=(t.max.z-h.z)*c):(s=(t.max.z-h.z)*c,a=(t.min.z-h.z)*c),n>a||s>i?null:((s>n||n!=n)&&(n=s),(a=0?n:i,e)))} intersectsBox(t){return null!==this.intersectBox(t,Zc)} intersectTriangle(t,e,n,i,r){$c.subVectors(e,t),th.subVectors(n,t),eh.crossVectors($c,th);let o,s=this.direction.dot(eh);if(s>0){if(i)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s} Qc.subVectors(this.origin,t);const a=o*this.direction.dot(th.crossVectors(Qc,th));if(a<0)return null;const l=o*this.direction.dot($c.cross(Qc));if(l<0)return null;if(a+l>s)return null;const u=-o*Qc.dot(eh);return u<0?null:this.at(u/s,r)} applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this} equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)} clone(){return(new this.constructor).copy(this)}} class ih{constructor(){ih.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]} set(t,e,n,i,r,o,s,a,l,u,c,h,d,f,p,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this} identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this} clone(){return(new ih).fromArray(this.elements)} copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this} copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this} setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this} extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this} makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this} extractRotation(t){const e=this.elements,n=t.elements,i=1/rh.setFromMatrixColumn(t,0).length(),r=1/rh.setFromMatrixColumn(t,1).length(),o=1/rh.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this} makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=o*u,n=o*c,i=s*u,r=s*c;e[0]=a*u,e[4]=-a*c,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*u,n=a*c,i=l*u,r=l*c;e[0]=t+r*s,e[4]=i*s-n,e[8]=o*l,e[1]=o*c,e[5]=o*u,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*u,n=a*c,i=l*u,r=l*c;e[0]=t-r*s,e[4]=-o*c,e[8]=i+n*s,e[1]=n+i*s,e[5]=o*u,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*u,n=o*c,i=s*u,r=s*c;e[0]=a*u,e[4]=i*l-n,e[8]=t*l+r,e[1]=a*c,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*u,e[4]=r-t*c,e[8]=i*c+n,e[1]=c,e[5]=o*u,e[9]=-s*u,e[2]=-l*u,e[6]=n*c+i,e[10]=t-r*c}else if("XZY"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*u,e[4]=-c,e[8]=l*u,e[1]=t*c+r,e[5]=o*u,e[9]=n*c-i,e[2]=i*c-n,e[6]=s*u,e[10]=r*c+t} return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this} makeRotationFromQuaternion(t){return this.compose(sh,t,ah)} lookAt(t,e,n){const i=this.elements;return ch.subVectors(t,e),0===ch.lengthSq()&&(ch.z=1),ch.normalize(),lh.crossVectors(n,ch),0===lh.lengthSq()&&(1===Math.abs(n.z)?ch.x+=1e-4:ch.z+=1e-4,ch.normalize(),lh.crossVectors(n,ch)),lh.normalize(),uh.crossVectors(ch,lh),i[0]=lh.x,i[4]=uh.x,i[8]=ch.x,i[1]=lh.y,i[5]=uh.y,i[9]=ch.y,i[2]=lh.z,i[6]=uh.z,i[10]=ch.z,this} multiply(t){return this.multiplyMatrices(this,t)} premultiply(t){return this.multiplyMatrices(t,this)} multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],f=n[2],p=n[6],m=n[10],g=n[14],v=n[3],_=n[7],x=n[11],y=n[15],b=i[0],w=i[4],S=i[8],M=i[12],D=i[1],T=i[5],E=i[9],C=i[13],A=i[2],P=i[6],L=i[10],R=i[14],O=i[3],F=i[7],I=i[11],N=i[15];return r[0]=o*b+s*D+a*A+l*O,r[4]=o*w+s*T+a*P+l*F,r[8]=o*S+s*E+a*L+l*I,r[12]=o*M+s*C+a*R+l*N,r[1]=u*b+c*D+h*A+d*O,r[5]=u*w+c*T+h*P+d*F,r[9]=u*S+c*E+h*L+d*I,r[13]=u*M+c*C+h*R+d*N,r[2]=f*b+p*D+m*A+g*O,r[6]=f*w+p*T+m*P+g*F,r[10]=f*S+p*E+m*L+g*I,r[14]=f*M+p*C+m*R+g*N,r[3]=v*b+_*D+x*A+y*O,r[7]=v*w+_*T+x*P+y*F,r[11]=v*S+_*E+x*L+y*I,r[15]=v*M+_*C+x*R+y*N,this} multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this} determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],u=t[2],c=t[6],h=t[10],d=t[14];return t[3]*(+r*a*c-i*l*c-r*s*h+n*l*h+i*s*d-n*a*d)+t[7]*(+e*a*d-e*l*h+r*o*h-i*o*d+i*l*u-r*a*u)+t[11]*(+e*l*c-e*s*d-r*o*c+n*o*d+r*s*u-n*l*u)+t[15]*(-i*s*u-e*a*c+e*s*h+i*o*c-n*o*h+n*a*u)} transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this} setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this} invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11],f=t[12],p=t[13],m=t[14],g=t[15],v=c*m*l-p*h*l+p*a*d-s*m*d-c*a*g+s*h*g,_=f*h*l-u*m*l-f*a*d+o*m*d+u*a*g-o*h*g,x=u*p*l-f*c*l+f*s*d-o*p*d-u*s*g+o*c*g,y=f*c*a-u*p*a-f*s*h+o*p*h+u*s*m-o*c*m,b=e*v+n*_+i*x+r*y;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=v*w,t[1]=(p*h*r-c*m*r-p*i*d+n*m*d+c*i*g-n*h*g)*w,t[2]=(s*m*r-p*a*r+p*i*l-n*m*l-s*i*g+n*a*g)*w,t[3]=(c*a*r-s*h*r-c*i*l+n*h*l+s*i*d-n*a*d)*w,t[4]=_*w,t[5]=(u*m*r-f*h*r+f*i*d-e*m*d-u*i*g+e*h*g)*w,t[6]=(f*a*r-o*m*r-f*i*l+e*m*l+o*i*g-e*a*g)*w,t[7]=(o*h*r-u*a*r+u*i*l-e*h*l-o*i*d+e*a*d)*w,t[8]=x*w,t[9]=(f*c*r-u*p*r-f*n*d+e*p*d+u*n*g-e*c*g)*w,t[10]=(o*p*r-f*s*r+f*n*l-e*p*l-o*n*g+e*s*g)*w,t[11]=(u*s*r-o*c*r-u*n*l+e*c*l+o*n*d-e*s*d)*w,t[12]=y*w,t[13]=(u*p*i-f*c*i+f*n*h-e*p*h-u*n*m+e*c*m)*w,t[14]=(f*s*i-o*p*i-f*n*a+e*p*a+o*n*m-e*s*m)*w,t[15]=(o*c*i-u*s*i+u*n*a-e*c*a-o*n*h+e*s*h)*w,this} scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this} getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))} makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this} makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this} makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this} makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this} makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,s=t.y,a=t.z,l=r*o,u=r*s;return this.set(l*o+n,l*s-i*a,l*a+i*s,0,l*s+i*a,u*s+n,u*a-i*o,0,l*a-i*s,u*a+i*o,r*a*a+n,0,0,0,0,1),this} makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this} makeShear(t,e,n,i,r,o){return this.set(1,n,r,0,t,1,o,0,e,i,1,0,0,0,0,1),this} compose(t,e,n){const i=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,u=o+o,c=s+s,h=r*l,d=r*u,f=r*c,p=o*u,m=o*c,g=s*c,v=a*l,_=a*u,x=a*c,y=n.x,b=n.y,w=n.z;return i[0]=(1-(p+g))*y,i[1]=(d+x)*y,i[2]=(f-_)*y,i[3]=0,i[4]=(d-x)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(f+_)*w,i[9]=(m-v)*w,i[10]=(1-(h+p))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this} decompose(t,e,n){const i=this.elements;let r=rh.set(i[0],i[1],i[2]).length();const o=rh.set(i[4],i[5],i[6]).length(),s=rh.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],oh.copy(this);const a=1/r,l=1/o,u=1/s;return oh.elements[0]*=a,oh.elements[1]*=a,oh.elements[2]*=a,oh.elements[4]*=l,oh.elements[5]*=l,oh.elements[6]*=l,oh.elements[8]*=u,oh.elements[9]*=u,oh.elements[10]*=u,e.setFromRotationMatrix(oh),n.x=r,n.y=o,n.z=s,this} makePerspective(t,e,n,i,r,o){const s=this.elements,a=2*r/(e-t),l=2*r/(n-i),u=(e+t)/(e-t),c=(n+i)/(n-i),h=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=c,s[13]=0,s[2]=0,s[6]=0,s[10]=h,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this} makeOrthographic(t,e,n,i,r,o){const s=this.elements,a=1/(e-t),l=1/(n-i),u=1/(o-r),c=(e+t)*a,h=(n+i)*l,d=(o+r)*u;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-c,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-h,s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this} equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++) if(e[t]!==n[t])return!1;return!0} fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this} toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}} const rh=new Ec,oh=new ih,sh=new Ec(0,0,0),ah=new Ec(1,1,1),lh=new Ec,uh=new Ec,ch=new Ec,hh=new ih,dh=new Tc;class fh{constructor(t=0,e=0,n=0,i=fh.DefaultOrder){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i} get x(){return this._x} set x(t){this._x=t,this._onChangeCallback()} get y(){return this._y} set y(t){this._y=t,this._onChangeCallback()} get z(){return this._z} set z(t){this._z=t,this._onChangeCallback()} get order(){return this._order} set order(t){this._order=t,this._onChangeCallback()} set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this} clone(){return new this.constructor(this._x,this._y,this._z,this._order)} copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this} setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],o=i[4],s=i[8],a=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(e){case "XYZ":this._y=Math.asin(Xu(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(h,l),this._z=0);break;case "YXZ":this._x=Math.asin(-Xu(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case "ZXY":this._x=Math.asin(Xu(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,r));break;case "ZYX":this._y=Math.asin(-Xu(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case "YZX":this._z=Math.asin(Xu(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case "XZY":this._z=Math.asin(-Xu(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)} return this._order=e,!0===n&&this._onChangeCallback(),this} setFromQuaternion(t,e,n){return hh.makeRotationFromQuaternion(t),this.setFromRotationMatrix(hh,e,n)} setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)} reorder(t){return dh.setFromEuler(this),this.setFromQuaternion(dh,t)} equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order} fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this} toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t} _onChange(t){return this._onChangeCallback=t,this} _onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order} toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}} fh.DefaultOrder="XYZ",fh.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class ph{constructor(){this.mask=1} set(t){this.mask=(1<>>0} enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(n=n.concat(r))} return n} getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)} getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yh,t,bh),t} getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yh,wh,t),t} getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()} raycast(){} traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n)) for(let e=0,i=n.length;e0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)} return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)} return e}} clone(t){return(new this.constructor).copy(this,t)} copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e) for(let e=0;e0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)} static getBarycoord(t,e,n,i,r){Ah.subVectors(i,e),Ph.subVectors(n,e),Lh.subVectors(t,e);const o=Ah.dot(Ah),s=Ah.dot(Ph),a=Ah.dot(Lh),l=Ph.dot(Ph),u=Ph.dot(Lh),c=o*l-s*s;if(0===c)return r.set(-2,-1,-1);const h=1/c,d=(l*a-s*u)*h,f=(o*u-s*a)*h;return r.set(1-d-f,f,d)} static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rh),Rh.x>=0&&Rh.y>=0&&Rh.x+Rh.y<=1} static getUV(t,e,n,i,r,o,s,a){return this.getBarycoord(t,e,n,i,Rh),a.set(0,0),a.addScaledVector(r,Rh.x),a.addScaledVector(o,Rh.y),a.addScaledVector(s,Rh.z),a} static isFrontFacing(t,e,n,i){return Ah.subVectors(n,e),Ph.subVectors(t,e),Ah.cross(Ph).dot(i)<0} set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this} setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this} setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this} clone(){return(new this.constructor).copy(this)} copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this} getArea(){return Ah.subVectors(this.c,this.b),Ph.subVectors(this.a,this.b),.5*Ah.cross(Ph).length()} getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)} getNormal(t){return Uh.getNormal(this.a,this.b,this.c,t)} getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)} getBarycoord(t,e){return Uh.getBarycoord(t,this.a,this.b,this.c,e)} getUV(t,e,n,i,r){return Uh.getUV(t,this.a,this.b,this.c,e,n,i,r)} containsPoint(t){return Uh.containsPoint(t,this.a,this.b,this.c)} isFrontFacing(t){return Uh.isFrontFacing(this.a,this.b,this.c,t)} intersectsBox(t){return t.intersectsTriangle(this)} closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let o,s;Oh.subVectors(i,n),Fh.subVectors(r,n),Nh.subVectors(t,n);const a=Oh.dot(Nh),l=Fh.dot(Nh);if(a<=0&&l<=0)return e.copy(n);zh.subVectors(t,i);const u=Oh.dot(zh),c=Fh.dot(zh);if(u>=0&&c<=u)return e.copy(i);const h=a*c-u*l;if(h<=0&&a>=0&&u<=0)return o=a/(a-u),e.copy(n).addScaledVector(Oh,o);kh.subVectors(t,r);const d=Oh.dot(kh),f=Fh.dot(kh);if(f>=0&&d<=f)return e.copy(r);const p=d*l-a*f;if(p<=0&&l>=0&&f<=0)return s=l/(l-f),e.copy(n).addScaledVector(Fh,s);const m=u*f-d*c;if(m<=0&&c-u>=0&&d-f>=0)return Ih.subVectors(r,i),s=(c-u)/(c-u+(d-f)),e.copy(i).addScaledVector(Ih,s);const g=1/(m+p+h);return o=p*g,s=h*g,e.copy(n).addScaledVector(Oh,o).addScaledVector(Fh,s)} equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}} let Bh=0;class Vh extends Hu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Bh++}),this.uuid=qu(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0} get alphaTest(){return this._alphaTest} set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t} onBuild(){} onBeforeRender(){} onBeforeCompile(){} customProgramCacheKey(){return this.onBeforeCompile.toString()} setValues(t){if(void 0!==t) for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue} const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}} toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)} return e} if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)} return n} clone(){return(new this.constructor).copy(this)} copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()} return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this} dispose(){this.dispatchEvent({type:"dispose"})} set needsUpdate(t){!0===t&&this.version++}} class Hh extends Vh{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new mc(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)} copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}} const Gh=new Ec,Wh=new tc;class jh{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0} onUploadCallback(){} set needsUpdate(t){!0===t&&this.version++} setUsage(t){return this.usage=t,this} copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this} copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t} t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)} const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,i=n.length;e0&&(i[e]=o,r=!0)} r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t} clone(){return(new this.constructor).copy(this)} copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))} const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;tn.far?null:{distance:u,point:md.clone(),object:t}}(t,e,n,i,sd,ad,ld,pd);if(u){r&&(hd.fromBufferAttribute(r,s),dd.fromBufferAttribute(r,a),fd.fromBufferAttribute(r,l),u.uv=Uh.getUV(pd,sd,ad,ld,hd,dd,fd,new tc)),o&&(hd.fromBufferAttribute(o,s),dd.fromBufferAttribute(o,a),fd.fromBufferAttribute(o,l),u.uv2=Uh.getUV(pd,sd,ad,ld,hd,dd,fd,new tc));const t={a:s,b:a,c:l,normal:new Ec,materialIndex:0};Uh.getNormal(sd,ad,ld,t.normal),u.face=t} return u} class _d extends nd{constructor(t=1,e=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const s=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const a=[],l=[],u=[],c=[];let h=0,d=0;function f(t,e,n,i,r,o,f,p,m,g,v){const _=o/m,x=f/g,y=o/2,b=f/2,w=p/2,S=m+1,M=g+1;let D=0,T=0;const E=new Ec;for(let o=0;o0?1:-1,u.push(E.x,E.y,E.z),c.push(a/m),c.push(1-o/g),D+=1}} for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}} class Md extends Ch{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ih,this.projectionMatrix=new ih,this.projectionMatrixInverse=new ih} copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this} getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()} updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()} updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()} clone(){return(new this.constructor).copy(this)}} class Dd extends Md{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()} copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this} setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*ju*Math.atan(e),this.updateProjectionMatrix()} getFocalLength(){const t=Math.tan(.5*Wu*this.fov);return.5*this.getFilmHeight()/t} getEffectiveFOV(){return 2*ju*Math.atan(Math.tan(.5*Wu*this.fov)/this.zoom)} getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)} getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)} setViewOffset(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()} clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()} updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Wu*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s} const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()} toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}} class Td extends Ch{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n;const i=new Dd(-90,1,t,e);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const r=new Dd(-90,1,t,e);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const o=new Dd(-90,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const s=new Dd(-90,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(0,-1,0),this.add(s);const a=new Dd(-90,1,t,e);a.layers=this.layers,a.up.set(0,1,0),a.lookAt(0,0,1),this.add(a);const l=new Dd(-90,1,t,e);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)} update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,o,s,a,l]=this.children,u=t.getRenderTarget(),c=t.toneMapping,h=t.xr.enabled;t.toneMapping=0,t.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=d,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(u),t.toneMapping=c,t.xr.enabled=h,n.texture.needsPMREMUpdate=!0}} class Ed extends bc{constructor(t,e,n,i,r,o,s,a,l,u){super(t=void 0!==t?t:[],e=void 0!==e?e:301,n,i,r,o,s,a,l,u),this.isCubeTexture=!0,this.flipY=!1} get images(){return this.image} set images(t){this.image=t}} class Cd extends Sc{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new Ed(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006} fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new _d(5,5,5),r=new Sd({name:"CubemapFromEquirect",uniforms:xd(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const o=new gd(i,r),s=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new Td(1,10,this).update(t,o),e.minFilter=s,o.geometry.dispose(),o.material.dispose(),this} clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}} const Ad=new Ec,Pd=new Ec,Ld=new ec;class Rd{constructor(t=new Ec(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e} set(t,e){return this.normal.copy(t),this.constant=e,this} setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this} setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this} setFromCoplanarPoints(t,e,n){const i=Ad.subVectors(n,e).cross(Pd.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this} copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this} normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this} negate(){return this.constant*=-1,this.normal.negate(),this} distanceToPoint(t){return this.normal.dot(t)+this.constant} distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius} projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)} intersectLine(t,e){const n=t.delta(Ad),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)} intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0} intersectsBox(t){return t.intersectsPlane(this)} intersectsSphere(t){return t.intersectsPlane(this)} coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)} applyMatrix4(t,e){const n=e||Ld.getNormalMatrix(t),i=this.coplanarPoint(Ad).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this} translate(t){return this.constant-=t.dot(this.normal),this} equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant} clone(){return(new this.constructor).copy(this)}} const Od=new Yc,Fd=new Ec;class Id{constructor(t=new Rd,e=new Rd,n=new Rd,i=new Rd,r=new Rd,o=new Rd){this.planes=[t,e,n,i,r,o]} set(t,e,n,i,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(o),this} copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this} setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=n[9],f=n[10],p=n[11],m=n[12],g=n[13],v=n[14],_=n[15];return e[0].setComponents(s-i,c-a,p-h,_-m).normalize(),e[1].setComponents(s+i,c+a,p+h,_+m).normalize(),e[2].setComponents(s+r,c+l,p+d,_+g).normalize(),e[3].setComponents(s-r,c-l,p-d,_-g).normalize(),e[4].setComponents(s-o,c-u,p-f,_-v).normalize(),e[5].setComponents(s+o,c+u,p+f,_+v).normalize(),this} intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Od.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Od)} intersectsSprite(t){return Od.center.set(0,0,0),Od.radius=.7071067811865476,Od.applyMatrix4(t.matrixWorld),this.intersectsSphere(Od)} intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)0?t.max.x:t.min.x,Fd.y=i.normal.y>0?t.max.y:t.min.y,Fd.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Fd)<0)return!1} return!0} containsPoint(t){const e=this.planes;for(let n=0;n<6;n++) if(e[n].distanceToPoint(t)<0)return!1;return!0} clone(){return(new this.constructor).copy(this)}} function Nd(){let t=null,e=!1,n=null,i=null;function r(e,o){n(e,o),i=t.requestAnimationFrame(r)} return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}} function zd(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Bd={common:{diffuse:{value:new mc(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ec},uv2Transform:{value:new ec},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new tc(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new mc(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new mc(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ec}},sprite:{diffuse:{value:new mc(16777215)},opacity:{value:1},center:{value:new tc(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ec}}},Vd={basic:{uniforms:yd([Bd.common,Bd.specularmap,Bd.envmap,Bd.aomap,Bd.lightmap,Bd.fog]),vertexShader:Ud.meshbasic_vert,fragmentShader:Ud.meshbasic_frag},lambert:{uniforms:yd([Bd.common,Bd.specularmap,Bd.envmap,Bd.aomap,Bd.lightmap,Bd.emissivemap,Bd.bumpmap,Bd.normalmap,Bd.displacementmap,Bd.fog,Bd.lights,{emissive:{value:new mc(0)}}]),vertexShader:Ud.meshlambert_vert,fragmentShader:Ud.meshlambert_frag},phong:{uniforms:yd([Bd.common,Bd.specularmap,Bd.envmap,Bd.aomap,Bd.lightmap,Bd.emissivemap,Bd.bumpmap,Bd.normalmap,Bd.displacementmap,Bd.fog,Bd.lights,{emissive:{value:new mc(0)},specular:{value:new mc(1118481)},shininess:{value:30}}]),vertexShader:Ud.meshphong_vert,fragmentShader:Ud.meshphong_frag},standard:{uniforms:yd([Bd.common,Bd.envmap,Bd.aomap,Bd.lightmap,Bd.emissivemap,Bd.bumpmap,Bd.normalmap,Bd.displacementmap,Bd.roughnessmap,Bd.metalnessmap,Bd.fog,Bd.lights,{emissive:{value:new mc(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ud.meshphysical_vert,fragmentShader:Ud.meshphysical_frag},toon:{uniforms:yd([Bd.common,Bd.aomap,Bd.lightmap,Bd.emissivemap,Bd.bumpmap,Bd.normalmap,Bd.displacementmap,Bd.gradientmap,Bd.fog,Bd.lights,{emissive:{value:new mc(0)}}]),vertexShader:Ud.meshtoon_vert,fragmentShader:Ud.meshtoon_frag},matcap:{uniforms:yd([Bd.common,Bd.bumpmap,Bd.normalmap,Bd.displacementmap,Bd.fog,{matcap:{value:null}}]),vertexShader:Ud.meshmatcap_vert,fragmentShader:Ud.meshmatcap_frag},points:{uniforms:yd([Bd.points,Bd.fog]),vertexShader:Ud.points_vert,fragmentShader:Ud.points_frag},dashed:{uniforms:yd([Bd.common,Bd.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ud.linedashed_vert,fragmentShader:Ud.linedashed_frag},depth:{uniforms:yd([Bd.common,Bd.displacementmap]),vertexShader:Ud.depth_vert,fragmentShader:Ud.depth_frag},normal:{uniforms:yd([Bd.common,Bd.bumpmap,Bd.normalmap,Bd.displacementmap,{opacity:{value:1}}]),vertexShader:Ud.meshnormal_vert,fragmentShader:Ud.meshnormal_frag},sprite:{uniforms:yd([Bd.sprite,Bd.fog]),vertexShader:Ud.sprite_vert,fragmentShader:Ud.sprite_frag},background:{uniforms:{uvTransform:{value:new ec},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ud.background_vert,fragmentShader:Ud.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ud.backgroundCube_vert,fragmentShader:Ud.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ud.cube_vert,fragmentShader:Ud.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ud.equirect_vert,fragmentShader:Ud.equirect_frag},distanceRGBA:{uniforms:yd([Bd.common,Bd.displacementmap,{referencePosition:{value:new Ec},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ud.distanceRGBA_vert,fragmentShader:Ud.distanceRGBA_frag},shadow:{uniforms:yd([Bd.lights,Bd.fog,{color:{value:new mc(0)},opacity:{value:1}}]),vertexShader:Ud.shadow_vert,fragmentShader:Ud.shadow_frag}};Vd.physical={uniforms:yd([Vd.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new tc(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new mc(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new tc},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new mc(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new mc(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Ud.meshphysical_vert,fragmentShader:Ud.meshphysical_frag};const Hd={r:0,b:0,g:0};function Gd(t,e,n,i,r,o,s){const a=new mc(0);let l,u,c=!0===o?0:1,h=null,d=0,f=null;function p(e,n){e.getRGB(Hd,bd(t)),i.buffers.color.setClear(Hd.r,Hd.g,Hd.b,n,s)} return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),c=e,p(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(t){c=t,p(a,c)},render:function(i,o){let s=!1,m=!0===o.isScene?o.background:null;if(m&&m.isTexture){m=(o.backgroundBlurriness>0?n:e).get(m)} const g=t.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?p(a,c):m&&m.isColor&&(p(m,1),s=!0),(t.autoClear||s)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||306===m.mapping)?(void 0===u&&(u=new gd(new _d(1,1,1),new Sd({name:"BackgroundCubeMaterial",uniforms:xd(Vd.backgroundCube.uniforms),vertexShader:Vd.backgroundCube.vertexShader,fragmentShader:Vd.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=m,u.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=o.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,u.material.toneMapped=3001!==m.encoding,h===m&&d===m.version&&f===t.toneMapping||(u.material.needsUpdate=!0,h=m,d=m.version,f=t.toneMapping),u.layers.enableAll(),i.unshift(u,u.geometry,u.material,0,0,null)):m&&m.isTexture&&(void 0===l&&(l=new gd(new kd(2,2),new Sd({name:"BackgroundMaterial",uniforms:xd(Vd.background.uniforms),vertexShader:Vd.background.vertexShader,fragmentShader:Vd.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=m,l.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,l.material.toneMapped=3001!==m.encoding,!0===m.matrixAutoUpdate&&m.updateMatrix(),l.material.uniforms.uvTransform.value.copy(m.matrix),h===m&&d===m.version&&f===t.toneMapping||(l.material.needsUpdate=!0,h=m,d=m.version,f=t.toneMapping),l.layers.enableAll(),i.unshift(l,l.geometry,l.material,0,0,null))}}} function Wd(t,e,n,i){const r=t.getParameter(34921),o=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==o,a={},l=f(null);let u=l,c=!1;function h(e){return i.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)} function d(e){return i.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)} function f(t){const e=[],n=[],i=[];for(let t=0;t=0){const n=r[e];let i=o[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;s++}} return u.attributesNum!==s||u.index!==i}(r,x,d,y),b&&function(t,e,n,i){const r={},o=e.attributes;let s=0;const a=n.getAttributes();for(const e in a){if(a[e].location>=0){let n=o[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,s++}} u.attributes=r,u.attributesNum=s,u.index=i}(r,x,d,y)}else{const t=!0===l.wireframe;u.geometry===x.id&&u.program===d.id&&u.wireframe===t||(u.geometry=x.id,u.program=d.id,u.wireframe=t,b=!0)} null!==y&&n.update(y,34963),(b||c)&&(c=!1,function(r,o,s,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,u=s.getAttributes(),c=o.defaultAttributeValues;for(const e in u){const i=u[e];if(i.location>=0){let o=l[e];if(void 0===o&&("instanceMatrix"===e&&r.instanceMatrix&&(o=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(o=r.instanceColor)),void 0!==o){const e=o.normalized,s=o.itemSize,l=n.get(o);if(void 0===l)continue;const u=l.buffer,c=l.type,h=l.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,l=n.stride,d=o.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"} return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"} const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=o||e.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),d=t.getParameter(3379),f=t.getParameter(34076),p=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),_=h>0,x=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:_,floatFragmentTextures:x,floatVertexTextures:_&&x,maxSamples:o?t.getParameter(36183):0}} function Xd(t){const e=this;let n=null,i=0,r=!1,o=!1;const s=new Rd,a=new ec,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0} function c(t,n,i,r){const o=null!==t?t.length:0;let u=null;if(0!==o){if(u=l.value,!0!==r||null===u){const e=i+4*o,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===u||u.length0){const s=new Cd(o.height/2);return s.fromEquirectangularTexture(t,r),e.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)} return null}}} return r},dispose:function(){e=new WeakMap}}} class Zd extends Md{constructor(t=-1,e=1,n=1,i=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()} copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this} setViewOffset(t,e,n,i,r,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()} clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()} updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,o=n+t,s=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,o=r+t*this.view.width,s-=e*this.view.offsetY,a=s-e*this.view.height} this.projectionMatrix.makeOrthographic(r,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()} toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}} const Kd=[.125,.215,.35,.446,.526,.582],Jd=new Zd,Qd=new mc;let $d=null;const tf=(1+Math.sqrt(5))/2,ef=1/tf,nf=[new Ec(1,1,1),new Ec(-1,1,1),new Ec(1,1,-1),new Ec(-1,1,-1),new Ec(0,tf,ef),new Ec(0,tf,-ef),new Ec(ef,0,tf),new Ec(-ef,0,tf),new Ec(tf,ef,0),new Ec(-tf,ef,0)];class rf{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)} fromScene(t,e=0,n=.1,i=100){$d=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r} fromEquirectangular(t,e=null){return this._fromTexture(t,e)} fromCubemap(t,e=null){return this._fromTexture(t,e)} compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=lf(),this._compileMaterial(this._cubemapMaterial))} compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=af(),this._compileMaterial(this._equirectMaterial))} dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()} _setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)} _dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?a=Kd[s-t+4-1]:0===s&&(a=0),i.push(a);const l=1/(o-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=6,f=6,p=3,m=2,g=1,v=new Float32Array(p*f*d),_=new Float32Array(m*f*d),x=new Float32Array(g*f*d);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,p*f*t),_.set(h,m*f*t);const r=[t,t,t,t,t,t];x.set(r,g*f*t)} const y=new nd;y.setAttribute("position",new jh(v,p)),y.setAttribute("uv",new jh(_,m)),y.setAttribute("faceIndex",new jh(x,g)),e.push(y),r>4&&r--} return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new Ec(0,1,0);return new Sd({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:t+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:uf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)} return i} _compileMaterial(t){const e=new gd(this._lodPlanes[0],t);this._renderer.compile(e,Jd)} _sceneToCubeUV(t,e,n,i){const r=new Dd(90,1,e,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,u=a.toneMapping;a.getClearColor(Qd),a.toneMapping=0,a.autoClear=!1;const c=new Hh({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),h=new gd(new _d,c);let d=!1;const f=t.background;f?f.isColor&&(c.color.copy(f),t.background=null,d=!0):(c.color.copy(Qd),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,o[e],0),r.lookAt(s[e],0,0)):1===n?(r.up.set(0,0,o[e]),r.lookAt(0,s[e],0)):(r.up.set(0,o[e],0),r.lookAt(0,0,s[e]));const l=this._cubeSize;sf(i,n*l,e>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(h,r),a.render(t,r)} h.geometry.dispose(),h.material.dispose(),a.toneMapping=u,a.autoClear=l,t.background=f} _textureToCubeUV(t,e){const n=this._renderer,i=301===t.mapping||302===t.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=lf()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=af());const r=i?this._cubemapMaterial:this._equirectMaterial,o=new gd(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const s=this._cubeSize;sf(e,0,0,3*s,2*s),n.setRenderTarget(e),n.render(o,Jd)} _applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/f,n=Math.exp(-e*e/2);m.push(n),0===t?g+=n:tv-4?i-v+4:0),4*(this._cubeSize-_),3*_,2*_),a.setRenderTarget(e),a.render(u,Jd)}} function of(t,e,n){const i=new Sc(t,e,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i} function sf(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)} function af(){return new Sd({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:uf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})} function lf(){return new Sd({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:uf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})} function uf(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"} function cf(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())} return{get:function(r){if(r&&r.isTexture){const o=r.mapping,s=303===o||304===o,a=301===o||302===o;if(s||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=e.get(r);return null===n&&(n=new rf(t)),i=s?n.fromEquirectangular(r,i):n.fromCubemap(r,i),e.set(r,i),i.texture} if(e.has(r))return e.get(r).texture;{const o=r.image;if(s&&o&&o.height>0||a&&o&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(o)){null===n&&(n=new rf(t));const o=s?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,o),r.addEventListener("dispose",i),o.texture} return null}}} return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}} function hf(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case "WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case "EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case "WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)} return e[n]=i,i} return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}} function df(t,e,n,i){const r={},o=new WeakMap;function s(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",s),delete r[a.id];const l=o.get(a);l&&(e.remove(l),o.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--} function a(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;ee.maxTextureSize&&(p=Math.ceil(f/e.maxTextureSize),f=e.maxTextureSize);const m=new Float32Array(f*p*4*r),g=new Mc(m,f,p,r);g.type=1015,g.needsUpdate=!0;const v=4*d;for(let e=0;e0)return t;const r=e*n;let o=Sf[r];if(void 0===o&&(o=new Float32Array(r),Sf[r]=o),0!==e){i.toArray(o,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r)} return o} function Af(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n" : " "} ${r}: ${n[t]}`)} return i.join("\n")}(t.getShaderSource(e),i)} return r} function Tp(t,e){const n=function(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"} function Ep(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"} return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"} function Cp(t){return""!==t} function Ap(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)} function Pp(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)} const Lp=/^[ \t]*#include +<([\w\d./]+)>/gm;function Rp(t){return t.replace(Lp,Op)} function Op(t,e){const n=Ud[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rp(n)} const Fp=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ip(t){return t.replace(Fp,Np)} function Np(t,e,n,i){let r="";for(let t=parseInt(e);t0&&(g+="\n"),v=[f,p].filter(Cp).join("\n"),v.length>0&&(v+="\n")):(g=[zp(n),"#define SHADER_NAME "+n.shaderName,p,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Cp).join("\n"),v=[f,zp(n),"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Ud.tonemapping_pars_fragment:"",0!==n.toneMapping?Ep("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ud.encodings_pars_fragment,Tp("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Cp).join("\n")),s=Rp(s),s=Ap(s,n),s=Pp(s,n),a=Rp(a),a=Ap(a,n),a=Pp(a,n),s=Ip(s),a=Ip(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in","300 es"===n.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const x=_+v+a,y=Sp(r,35633,_+g+s),b=Sp(r,35632,x);if(r.attachShader(m,y),r.attachShader(m,b),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(y).trim(),n=r.getShaderInfoLog(b).trim();let i=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=Dp(r,y,"vertex"),n=Dp(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else ""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:v}})} let w,S;return r.deleteShader(y),r.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new wp(r,m)),w},this.getAttributes=function(){return void 0===S&&(S=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r0,R=o.clearcoat>0,O=o.iridescence>0;return{isWebGL2:c,shaderID:w,shaderName:o.type,vertexShader:D,fragmentShader:T,defines:o.defines,customVertexShaderID:E,customFragmentShaderID:C,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:f,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:d,outputEncoding:null===P?t.outputEncoding:!0===P.isXRRenderTarget?P.texture.encoding:3e3,map:!!o.map,matcap:!!o.matcap,envMap:!!y,envMapMode:y&&y.mapping,envMapCubeUVHeight:b,lightMap:!!o.lightMap,aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,objectSpaceNormalMap:1===o.normalMapType,tangentSpaceNormalMap:0===o.normalMapType,decodeVideoTexture:!!o.map&&!0===o.map.isVideoTexture&&3001===o.map.encoding,clearcoat:R,clearcoatMap:R&&!!o.clearcoatMap,clearcoatRoughnessMap:R&&!!o.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!o.clearcoatNormalMap,iridescence:O,iridescenceMap:O&&!!o.iridescenceMap,iridescenceThicknessMap:O&&!!o.iridescenceThicknessMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,specularIntensityMap:!!o.specularIntensityMap,specularColorMap:!!o.specularColorMap,opaque:!1===o.transparent&&1===o.blending,alphaMap:!!o.alphaMap,alphaTest:L,gradientMap:!!o.gradientMap,sheen:o.sheen>0,sheenColorMap:!!o.sheenColorMap,sheenRoughnessMap:!!o.sheenRoughnessMap,transmission:o.transmission>0,transmissionMap:!!o.transmissionMap,thicknessMap:!!o.thicknessMap,combine:o.combine,vertexTangents:!!o.normalMap&&!!_.attributes.tangent,vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUvs:!!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatMap||o.clearcoatRoughnessMap||o.clearcoatNormalMap||o.iridescenceMap||o.iridescenceThicknessMap||o.displacementMap||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||o.sheenColorMap||o.sheenRoughnessMap),uvsVertexOnly:!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatNormalMap||o.iridescenceMap||o.iridescenceThicknessMap||o.transmission>0||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||o.sheen>0||o.sheenColorMap||o.sheenRoughnessMap||!o.displacementMap),fog:!!v,useFog:!0===o.fog,fogExp2:v&&v.isFogExp2,flatShading:!!o.flatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:M,morphTextureStride:A,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:o.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.length>0,shadowMapType:t.shadowMap.type,toneMapping:o.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,doubleSided:2===o.side,flipSided:1===o.side,useDepthPacking:!!o.depthPacking,depthPacking:o.depthPacking||0,index0AttributeName:o.index0AttributeName,extensionDerivatives:o.extensions&&o.extensions.derivatives,extensionFragDepth:o.extensions&&o.extensions.fragDepth,extensionDrawBuffers:o.extensions&&o.extensions.drawBuffers,extensionShaderTextureLOD:o.extensions&&o.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),customProgramCacheKey:o.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines) for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){a.disableAll(),e.isWebGL2&&a.enable(0);e.supportsVertexTextures&&a.enable(1);e.instancing&&a.enable(2);e.instancingColor&&a.enable(3);e.map&&a.enable(4);e.matcap&&a.enable(5);e.envMap&&a.enable(6);e.lightMap&&a.enable(7);e.aoMap&&a.enable(8);e.emissiveMap&&a.enable(9);e.bumpMap&&a.enable(10);e.normalMap&&a.enable(11);e.objectSpaceNormalMap&&a.enable(12);e.tangentSpaceNormalMap&&a.enable(13);e.clearcoat&&a.enable(14);e.clearcoatMap&&a.enable(15);e.clearcoatRoughnessMap&&a.enable(16);e.clearcoatNormalMap&&a.enable(17);e.iridescence&&a.enable(18);e.iridescenceMap&&a.enable(19);e.iridescenceThicknessMap&&a.enable(20);e.displacementMap&&a.enable(21);e.specularMap&&a.enable(22);e.roughnessMap&&a.enable(23);e.metalnessMap&&a.enable(24);e.gradientMap&&a.enable(25);e.alphaMap&&a.enable(26);e.alphaTest&&a.enable(27);e.vertexColors&&a.enable(28);e.vertexAlphas&&a.enable(29);e.vertexUvs&&a.enable(30);e.vertexTangents&&a.enable(31);e.uvsVertexOnly&&a.enable(32);t.push(a.mask),a.disableAll(),e.fog&&a.enable(0);e.useFog&&a.enable(1);e.flatShading&&a.enable(2);e.logarithmicDepthBuffer&&a.enable(3);e.skinning&&a.enable(4);e.morphTargets&&a.enable(5);e.morphNormals&&a.enable(6);e.morphColors&&a.enable(7);e.premultipliedAlpha&&a.enable(8);e.shadowMapEnabled&&a.enable(9);e.physicallyCorrectLights&&a.enable(10);e.doubleSided&&a.enable(11);e.flipSided&&a.enable(12);e.useDepthPacking&&a.enable(13);e.dithering&&a.enable(14);e.specularIntensityMap&&a.enable(15);e.specularColorMap&&a.enable(16);e.transmission&&a.enable(17);e.transmissionMap&&a.enable(18);e.thicknessMap&&a.enable(19);e.sheen&&a.enable(20);e.sheenColorMap&&a.enable(21);e.sheenRoughnessMap&&a.enable(22);e.decodeVideoTexture&&a.enable(23);e.opaque&&a.enable(24);t.push(a.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=p[t.type];let n;if(e){const t=Vd[e];n=wd.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=u.length;t0?i.push(c):!0===s.transparent?r.push(c):n.push(c)},unshift:function(t,e,s,a,l,u){const c=o(t,e,s,a,l,u);s.transmission>0?i.unshift(c):!0===s.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||Wp),i.length>1&&i.sort(e||jp),r.length>1&&r.sort(e||jp)}}} function Xp(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new qp,t.set(e,[r])):n>=i.length?(r=new qp,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}} function Yp(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case "DirectionalLight":n={direction:new Ec,color:new mc};break;case "SpotLight":n={position:new Ec,direction:new Ec,color:new mc,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case "PointLight":n={position:new Ec,color:new mc,distance:0,decay:0};break;case "HemisphereLight":n={direction:new Ec,skyColor:new mc,groundColor:new mc};break;case "RectAreaLight":n={color:new mc,position:new Ec,halfWidth:new Ec,halfHeight:new Ec}} return t[e.id]=n,n}}} let Zp=0;function Kp(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)} function Jp(t,e){const n=new Yp,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case "DirectionalLight":case "SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tc};break;case "PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tc,shadowCameraNear:1,shadowCameraFar:1e3}} return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let t=0;t<9;t++)r.probe.push(new Ec);const o=new Ec,s=new ih,a=new ih;return{setup:function(o,s){let a=0,l=0,u=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,_=0,x=0;o.sort(Kp);const y=!0!==s?Math.PI:1;for(let t=0,e=o.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Bd.LTC_FLOAT_1,r.rectAreaLTC2=Bd.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Bd.LTC_HALF_1,r.rectAreaLTC2=Bd.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=l,r.ambient[2]=u;const b=r.hash;b.directionalLength===c&&b.pointLength===h&&b.spotLength===d&&b.rectAreaLength===f&&b.hemiLength===p&&b.numDirectionalShadows===m&&b.numPointShadows===g&&b.numSpotShadows===v&&b.numSpotMaps===_||(r.directional.length=c,r.spot.length=d,r.rectArea.length=f,r.point.length=h,r.hemi.length=p,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=v+_-x,r.spotLightMap.length=_,r.numSpotLightShadowsWithMaps=x,b.directionalLength=c,b.pointLength=h,b.spotLength=d,b.rectAreaLength=f,b.hemiLength=p,b.numDirectionalShadows=m,b.numPointShadows=g,b.numSpotShadows=v,b.numSpotMaps=_,r.version=Zp++)},setupView:function(t,e){let n=0,i=0,l=0,u=0,c=0;const h=e.matrixWorldInverse;for(let e=0,d=t.length;e=o.length?(s=new Qp(t,e),o.push(s)):s=o[r],s},dispose:function(){n=new WeakMap}}} class tm extends Vh{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)} copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}} class em extends Vh{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Ec,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)} copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}} function nm(t,e,n){let i=new Id;const r=new tc,o=new tc,s=new wc,a=new tm({depthPacking:3201}),l=new em,u={},c=n.maxTextureSize,h={0:1,1:0,2:2},d=new Sd({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new tc},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new nd;p.setAttribute("position",new jh(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new gd(p,d),g=this;function v(n,i){const o=e.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Sc(r.x,r.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,o,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,o,f,m,null)} function _(e,n,i,r,o,s){let c=null;const d=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==d)c=d;else if(c=!0===i.isPointLight?l:a,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=c.uuid,e=n.uuid;let i=u[t];void 0===i&&(i={},u[t]=i);let r=i[e];void 0===r&&(r=c.clone(),i[e]=r),c=r} return c.visible=n.visible,c.wireframe=n.wireframe,c.side=3===s?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],c.alphaMap=n.alphaMap,c.alphaTest=n.alphaTest,c.map=n.map,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.displacementMap=n.displacementMap,c.displacementScale=n.displacementScale,c.displacementBias=n.displacementBias,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===i.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=r,c.farDistance=o),c} function x(n,r,o,s,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,u=e.length;lc||r.y>c)&&(r.x>c&&(o.x=Math.floor(c/f.x),r.x=o.x*f.x,h.mapSize.x=o.x),r.y>c&&(o.y=Math.floor(c/f.y),r.y=o.y*f.y,h.mapSize.y=o.y)),null===h.map){const t=3!==this.type?{minFilter:1003,magFilter:1003}:{};h.map=new Sc(r.x,r.y,t),h.map.texture.name=u.name+".shadowMap",h.camera.updateProjectionMatrix()} t.setRenderTarget(h.map),t.clear();const p=h.getViewportCount();for(let t=0;t=1):-1!==L.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),A=P>=2);let R=null,O={};const F=t.getParameter(3088),I=t.getParameter(2978),N=(new wc).fromArray(F),z=(new wc).fromArray(I);function k(e,n,i){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;ei||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Ju:Math.floor,o=i(r*t.width),s=i(r*t.height);void 0===m&&(m=_(o,s));const a=n?_(o,s):m;a.width=o,a.height=s;return a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a} return"data" in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t} return t} function y(t){return Ku(t.width)&&Ku(t.height)} function b(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter} function w(e){t.generateMipmap(e)} function S(n,i,r,o,s=!1){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")} let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=3001===o&&!1===s?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l} function M(t,e,n){return!0===b(t,n)||t.isFramebufferTexture&&1003!==t.minFilter&&1006!==t.minFilter?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1} function D(t){return 1003===t||1004===t||1005===t?9728:9729} function T(t){const e=t.target;e.removeEventListener("dispose",T),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=g.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&C(t),0===Object.keys(r).length&&g.delete(n)} i.remove(t)}(e),e.isVideoTexture&&p.delete(e)} function E(e){const n=e.target;n.removeEventListener("dispose",E),function(e){const n=e.texture,r=i.get(e),o=i.get(n);void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget) for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else{if(t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer) for(let e=0;e0&&r.__version!==t.version){const n=t.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void I(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}} n.bindTexture(3553,r.__webglTexture,33984+e)} const L={1e3:10497,1001:33071,1002:33648},R={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function O(n,o,s){if(s?(t.texParameteri(n,10242,L[o.wrapS]),t.texParameteri(n,10243,L[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,L[o.wrapR]),t.texParameteri(n,10240,R[o.magFilter]),t.texParameteri(n,10241,R[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),1001===o.wrapS&&1001===o.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,D(o.magFilter)),t.texParameteri(n,10241,D(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(1003===o.magFilter)return;if(1005!==o.minFilter&&1008!==o.minFilter)return;if(1015===o.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&1016===o.type&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||i.get(o).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}} function F(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",T));const r=n.source;let o=g.get(r);void 0===o&&(o={},g.set(r,o));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(n);if(a!==e.__cacheKey){void 0===o[a]&&(o[a]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,i=!0),o[a].usedTimes++;const r=o[e.__cacheKey];void 0!==r&&(o[e.__cacheKey].usedTimes--,0===r.usedTimes&&C(n)),e.__cacheKey=a,e.__webglTexture=o[a].texture} return i} function I(e,r,s){let l=3553;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(l=35866),r.isData3DTexture&&(l=32879);const u=F(e,r),h=r.source;n.bindTexture(l,e.__webglTexture,33984+s);const d=i.get(h);if(h.version!==d.__version||!0===u){n.activeTexture(33984+s),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=function(t){return!a&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(r)&&!1===y(r.image);let i=x(r.image,e,!1,c);i=V(r,i);const f=y(i)||a,p=o.convert(r.format,r.encoding);let m,g=o.convert(r.type),v=S(r.internalFormat,p,g,r.encoding,r.isVideoTexture);O(l,r,f);const _=r.mipmaps,D=a&&!0!==r.isVideoTexture,T=void 0===d.__version||!0===u,E=M(r,i,f);if(r.isDepthTexture)v=6402,a?v=1015===r.type?36012:1014===r.type?33190:1020===r.type?35056:33189:1015===r.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&6402===v&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1014,g=o.convert(r.type)),1027===r.format&&6402===v&&(v=34041,1020!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=1020,g=o.convert(r.type))),T&&(D?n.texStorage2D(3553,1,v,i.width,i.height):n.texImage2D(3553,0,v,i.width,i.height,0,p,g,null));else if(r.isDataTexture) if(_.length>0&&f){D&&T&&n.texStorage2D(3553,E,v,_[0].width,_[0].height);for(let t=0,e=_.length;t>=1,e>>=1}}else if(_.length>0&&f){D&&T&&n.texStorage2D(3553,E,v,_[0].width,_[0].height);for(let t=0,e=_.length;t=34069&&l<=34074)&&t.framebufferTexture2D(36160,a,l,i.get(s).__webglTexture,0),n.bindFramebuffer(36160,null)} function z(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i||B(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const i=U(n);B(n)?d.renderbufferStorageMultisampleEXT(36161,i,r,n.width,n.height):t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=U(n);i&&!1===B(n)?t.renderbufferStorageMultisample(36161,r,35056,n.width,n.height):B(n)?d.renderbufferStorageMultisampleEXT(36161,r,35056,n.width,n.height):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let r=0;r0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture} function V(t,n){const i=t.encoding,r=t.format,o=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||1035===t.format||3e3!==i&&(3001===i?!1===a?!0===e.has("EXT_sRGB")&&1023===r?(t.format=1035,t.minFilter=1006,t.generateMipmaps=!1):n=vc.sRGBToLinear(n):1023===r&&1009===o||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n} this.allocateTextureUnit=function(){const t=A;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),A+=1,t},this.resetTextureUnits=function(){A=0},this.setTexture2D=P,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):n.bindTexture(35866,r.__webglTexture,33984+e)},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):n.bindTexture(32879,r.__webglTexture,33984+e)},this.setTextureCube=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,r,s){if(6!==r.image.length)return;const l=F(e,r),c=r.source;n.bindTexture(34067,e.__webglTexture,33984+s);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(33984+s),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=r.isCompressedTexture||r.image[0].isCompressedTexture,i=r.image[0]&&r.image[0].isDataTexture,d=[];for(let t=0;t<6;t++)d[t]=e||i?i?r.image[t].image:r.image[t]:x(r.image[t],!1,!0,u),d[t]=V(r,d[t]);const f=d[0],p=y(f)||a,m=o.convert(r.format,r.encoding),g=o.convert(r.type),v=S(r.internalFormat,m,g,r.encoding),_=a&&!0!==r.isVideoTexture,D=void 0===h.__version||!0===l;let T,E=M(r,f,p);if(O(34067,r,p),e){_&&D&&n.texStorage2D(34067,E,v,f.width,f.height);for(let t=0;t<6;t++){T=d[t].mipmaps;for(let e=0;e0&&E++,n.texStorage2D(34067,E,v,d[0].width,d[0].height));for(let t=0;t<6;t++) if(i){_?n.texSubImage2D(34069+t,0,0,0,d[t].width,d[t].height,m,g,d[t].data):n.texImage2D(34069+t,0,v,d[t].width,d[t].height,0,m,g,d[t].data);for(let e=0;e0&&!1===B(e)){const i=d?l:[l];u.__webglMultisampledFramebuffer=t.createFramebuffer(),u.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer);for(let n=0;n0&&!1===B(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],o=e.width,s=e.height;let a=16384;const l=[],u=e.stencilBuffer?33306:36096,c=i.get(e),h=!0===e.isWebGLMultipleRenderTargets;if(h) for(let e=0;ea+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=a-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==s&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(lm)))} return null!==s&&(s.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),this} _getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new am;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)} return t.joints[e.jointName]}} class cm extends bc{constructor(t,e,n,i,r,o,s,a,l,u){if(1026!==(u=void 0!==u?u:1026)&&1027!==u)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===u&&(n=1014),void 0===n&&1027===u&&(n=1020),super(null,i,r,o,s,a,u,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==a?a:1003,this.flipY=!1,this.generateMipmaps=!1}} class hm extends Hu{constructor(t,e){super();const n=this;let i=null,r=1,o=null,s="local-floor",a=null,l=null,u=null,c=null,h=null,d=null;const f=e.getContextAttributes();let p=null,m=null;const g=[],v=[],_=new Set,x=new Map,y=new Dd;y.layers.enable(1),y.viewport=new wc;const b=new Dd;b.layers.enable(2),b.viewport=new wc;const w=[y,b],S=new sm;S.layers.enable(1),S.layers.enable(2);let M=null,D=null;function T(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const n=g[e];void 0!==n&&n.dispatchEvent({type:t.type,data:t.inputSource})} function E(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",E),i.removeEventListener("inputsourceschange",C);for(let t=0;t=0&&(v[i]=null,g[i].disconnect(n))} for(let e=0;e=v.length){v.push(n),i=t;break} if(null===v[t]){v[t]=n,i=t;break}} if(-1===i)break} const r=g[i];r&&r.connect(n)}} this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=g[t];return void 0===e&&(e=new um,g[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=g[t];return void 0===e&&(e=new um,g[t]=e),e.getGripSpace()},this.getHand=function(t){let e=g[t];return void 0===e&&(e=new um,g[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a||o},this.setReferenceSpace=function(t){a=t},this.getBaseLayer=function(){return null!==c?c:h},this.getBinding=function(){return u},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(l){if(i=l,null!==i){if(p=t.getRenderTarget(),i.addEventListener("select",T),i.addEventListener("selectstart",T),i.addEventListener("selectend",T),i.addEventListener("squeeze",T),i.addEventListener("squeezestart",T),i.addEventListener("squeezeend",T),i.addEventListener("end",E),i.addEventListener("inputsourceschange",C),!0!==f.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||f.antialias,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};h=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:h}),m=new Sc(h.framebufferWidth,h.framebufferHeight,{format:1023,type:1009,encoding:t.outputEncoding,stencilBuffer:f.stencil})}else{let n=null,o=null,s=null;f.depth&&(s=f.stencil?35056:33190,n=f.stencil?1027:1026,o=f.stencil?1020:1014);const a={colorFormat:32856,depthFormat:s,scaleFactor:r};u=new XRWebGLBinding(i,e),c=u.createProjectionLayer(a),i.updateRenderState({layers:[c]}),m=new Sc(c.textureWidth,c.textureHeight,{format:1023,type:1009,depthTexture:new cm(c.textureWidth,c.textureHeight,o,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,encoding:t.outputEncoding,samples:f.antialias?4:0});t.properties.get(m).__ignoreDepthValues=c.ignoreDepthValues} m.isXRRenderTarget=!0,this.setFoveation(1),a=null,o=await i.requestReferenceSpace(s),O.setContext(i),O.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const A=new Ec,P=new Ec;function L(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()} this.updateCamera=function(t){if(null===i)return;S.near=b.near=y.near=t.near,S.far=b.far=y.far=t.far,M===S.near&&D===S.far||(i.updateRenderState({depthNear:S.near,depthFar:S.far}),M=S.near,D=S.far);const e=t.parent,n=S.cameras;L(S,e);for(let t=0;te&&(x.set(t,t.lastChangedTime),n.dispatchEvent({type:"planechanged",data:t}))}else _.add(t),x.set(t,i.lastChangedTime),n.dispatchEvent({type:"planeadded",data:t})} d=null})),this.setAnimationLoop=function(t){R=t},this.dispose=function(){}}} function dm(t,e){function n(n,i){n.opacity.value=i.opacity,i.color&&n.diffuse.value.copy(i.color),i.emissive&&n.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(n.map.value=i.map),i.alphaMap&&(n.alphaMap.value=i.alphaMap),i.bumpMap&&(n.bumpMap.value=i.bumpMap,n.bumpScale.value=i.bumpScale,1===i.side&&(n.bumpScale.value*=-1)),i.displacementMap&&(n.displacementMap.value=i.displacementMap,n.displacementScale.value=i.displacementScale,n.displacementBias.value=i.displacementBias),i.emissiveMap&&(n.emissiveMap.value=i.emissiveMap),i.normalMap&&(n.normalMap.value=i.normalMap,n.normalScale.value.copy(i.normalScale),1===i.side&&n.normalScale.value.negate()),i.specularMap&&(n.specularMap.value=i.specularMap),i.alphaTest>0&&(n.alphaTest.value=i.alphaTest);const r=e.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*e} let o,s;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?o=i.map:i.specularMap?o=i.specularMap:i.displacementMap?o=i.displacementMap:i.normalMap?o=i.normalMap:i.bumpMap?o=i.bumpMap:i.roughnessMap?o=i.roughnessMap:i.metalnessMap?o=i.metalnessMap:i.alphaMap?o=i.alphaMap:i.emissiveMap?o=i.emissiveMap:i.clearcoatMap?o=i.clearcoatMap:i.clearcoatNormalMap?o=i.clearcoatNormalMap:i.clearcoatRoughnessMap?o=i.clearcoatRoughnessMap:i.iridescenceMap?o=i.iridescenceMap:i.iridescenceThicknessMap?o=i.iridescenceThicknessMap:i.specularIntensityMap?o=i.specularIntensityMap:i.specularColorMap?o=i.specularColorMap:i.transmissionMap?o=i.transmissionMap:i.thicknessMap?o=i.thicknessMap:i.sheenColorMap?o=i.sheenColorMap:i.sheenRoughnessMap&&(o=i.sheenRoughnessMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uvTransform.value.copy(o.matrix)),i.aoMap?s=i.aoMap:i.lightMap&&(s=i.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uv2Transform.value.copy(s.matrix))} return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,bd(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,i,r,o,s){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(t,i):i.isMeshToonMaterial?(n(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,i)):i.isMeshPhongMaterial?(n(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,i)):i.isMeshStandardMaterial?(n(t,i),function(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap);n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}(t,i),i.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,i,s)):i.isMeshMatcapMaterial?(n(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,i)):i.isMeshDepthMaterial?n(t,i):i.isMeshDistanceMaterial?(n(t,i),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?n(t,i):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,o):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}} function fm(t,e,n,i){let r={},o={},s=[];const a=n.isWebGL2?t.getParameter(35375):0;function l(t,e,n){const i=t.value;if(void 0===n[e]){if("number"==typeof i)n[e]=i;else{const t=Array.isArray(i)?i:[i],r=[];for(let e=0;e0){i=n%16;const t=16-i;0!==i&&t-o.boundary<0&&(n+=16-i,r.__offset=n)} n+=o.storage} i=n%16,i>0&&(n+=16-i);t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t0&&function(t,e,n){const i=G.isWebGL2;null===N&&(N=new Sc(1,1,{generateMipmaps:!0,type:H.has("EXT_color_buffer_half_float")?1016:1009,minFilter:1008,samples:i&&!0===o?4:0}));m.getDrawingBufferSize(k),i?N.setSize(k.x,k.y):N.setSize(Ju(k.x),Ju(k.y));const r=m.getRenderTarget();m.setRenderTarget(N),m.clear();const s=m.toneMapping;m.toneMapping=0,Dt(t,e,n),m.toneMapping=s,X.updateMultisampleRenderTarget(N),X.updateRenderTargetMipmap(N),m.setRenderTarget(r)}(r,e,n),i&&W.viewport(w.copy(i)),r.length>0&&Dt(r,e,n),s.length>0&&Dt(s,e,n),a.length>0&&Dt(a,e,n),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1)} function Dt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,o=t.length;r0?p[p.length-1]:null,f.pop(),h=f.length>0?f[f.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(t,e,n){q.get(t.texture).__webglTexture=e,q.get(t.depthTexture).__webglTexture=n;const i=q.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===H.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=q.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){x=t,v=e,_=n;let i=!0,r=null,o=!1,s=!1;if(t){const n=q.get(t);void 0!==n.__useDefaultFramebuffer?(W.bindFramebuffer(36160,null),i=!1):void 0===n.__webglFramebuffer?X.setupRenderTarget(t):n.__hasExternalTextures&&X.rebindTextures(t,q.get(t.texture).__webglTexture,q.get(t.depthTexture).__webglTexture);const a=t.texture;(a.isData3DTexture||a.isDataArrayTexture||a.isCompressedArrayTexture)&&(s=!0);const l=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=l[e],o=!0):r=G.isWebGL2&&t.samples>0&&!1===X.useMultisampledRTT(t)?q.get(t).__webglMultisampledFramebuffer:l,w.copy(t.viewport),S.copy(t.scissor),M=t.scissorTest}else w.copy(P).multiplyScalar(E).floor(),S.copy(L).multiplyScalar(E).floor(),M=R;if(W.bindFramebuffer(36160,r)&&G.drawBuffers&&i&&W.drawBuffers(t,r),W.viewport(w),W.scissor(S),W.setScissorTest(M),o){const i=q.get(t.texture);dt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(s){const i=q.get(t.texture),r=e||0;dt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)} y=-1},this.readRenderTargetPixels=function(t,e,n,i,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){W.bindFramebuffer(36160,a);try{const s=t.texture,a=s.format,l=s.type;if(1023!==a&&ut.convert(a)!==dt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const u=1016===l&&(H.has("EXT_color_buffer_half_float")||G.isWebGL2&&H.has("EXT_color_buffer_float"));if(!(1009===l||ut.convert(l)===dt.getParameter(35738)||1015===l&&(G.isWebGL2||H.has("OES_texture_float")||H.has("WEBGL_color_buffer_float"))||u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&dt.readPixels(e,n,i,r,ut.convert(a),ut.convert(l),o)}finally{const t=null!==x?q.get(x).__webglFramebuffer:null;W.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),o=Math.floor(e.image.height*i);X.setTexture2D(e,0),dt.copyTexSubImage2D(3553,n,0,0,t.x,t.y,r,o),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,o=e.image.height,s=ut.convert(n.format),a=ut.convert(n.type);X.setTexture2D(n,0),dt.pixelStorei(37440,n.flipY),dt.pixelStorei(37441,n.premultiplyAlpha),dt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?dt.texSubImage2D(3553,i,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?dt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):dt.texSubImage2D(3553,i,t.x,t.y,s,a,e.image),0===i&&n.generateMipmaps&&dt.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,l=ut.convert(i.format),u=ut.convert(i.type);let c;if(i.isData3DTexture)X.setTexture3D(i,0),c=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(i,0),c=35866} dt.pixelStorei(37440,i.flipY),dt.pixelStorei(37441,i.premultiplyAlpha),dt.pixelStorei(3317,i.unpackAlignment);const h=dt.getParameter(3314),d=dt.getParameter(32878),f=dt.getParameter(3316),p=dt.getParameter(3315),g=dt.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;dt.pixelStorei(3314,v.width),dt.pixelStorei(32878,v.height),dt.pixelStorei(3316,t.min.x),dt.pixelStorei(3315,t.min.y),dt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?dt.texSubImage3D(c,r,e.x,e.y,e.z,o,s,a,l,u,v.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),dt.compressedTexSubImage3D(c,r,e.x,e.y,e.z,o,s,a,l,v.data)):dt.texSubImage3D(c,r,e.x,e.y,e.z,o,s,a,l,u,v),dt.pixelStorei(3314,h),dt.pixelStorei(32878,d),dt.pixelStorei(3316,f),dt.pixelStorei(3315,p),dt.pixelStorei(32877,g),0===r&&i.generateMipmaps&&dt.generateMipmap(c),W.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?X.setTextureCube(t,0):t.isData3DTexture?X.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?X.setTexture2DArray(t,0):X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){v=0,_=0,x=null,W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends pm{}).prototype.isWebGL1Renderer=!0;class mm extends Ch{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))} copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this} toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.backgroundIntensity=this.backgroundIntensity),e} get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate} set autoUpdate(t){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=t}} class gm extends bc{constructor(t,e,n,i,r,o,s,a,l){super(t,e,n,i,r,o,s,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const u=this;"requestVideoFrameCallback" in t&&t.requestVideoFrameCallback((function e(){u.needsUpdate=!0,t.requestVideoFrameCallback(e)}))} clone(){return new this.constructor(this.image).copy(this)} update(){const t=this.image;!1==="requestVideoFrameCallback" in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}} function vm(t,e,n){return xm(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)} function _m(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)} function xm(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)} class ym{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}} evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let o;n:{i:if(!(t=r)break t;{const s=e[1];t=r)break e} o=n,n=0}} for(;n>>1;te;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=vm(n,r,o),this.values=vm(this.values,r*t,o*t)} return this} validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break} if(null!==o&&o>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,o),t=!1;break} o=i} if(void 0!==i&&xm(i)) for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}} return t} optimize(){const t=vm(this.times),e=vm(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=t.length-1;let o=1;for(let s=1;s0){t[o]=t[r];for(let t=r*n,i=o*n,s=0;s!==n;++s)e[i+s]=e[t+s];++o} return o!==t.length?(this.times=vm(t,0,o),this.values=vm(e,0,o*n)):(this.times=t,this.values=e),this} clone(){const t=vm(this.times,0),e=vm(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}} Mm.prototype.TimeBufferType=Float32Array,Mm.prototype.ValueBufferType=Float32Array,Mm.prototype.DefaultInterpolation=2301;class Dm extends Mm{} Dm.prototype.ValueTypeName="bool",Dm.prototype.ValueBufferType=Array,Dm.prototype.DefaultInterpolation=2300,Dm.prototype.InterpolantFactoryMethodLinear=void 0,Dm.prototype.InterpolantFactoryMethodSmooth=void 0;class Tm extends Mm{} Tm.prototype.ValueTypeName="color";class Em extends Mm{} Em.prototype.ValueTypeName="number";class Cm extends ym{constructor(t,e,n,i){super(t,e,n,i)} interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)Tc.slerpFlat(r,0,o,l-s,o,l,a);return r}} class Am extends Mm{InterpolantFactoryMethodLinear(t){return new Cm(this.times,this.values,this.getValueSize(),t)}} Am.prototype.ValueTypeName="quaternion",Am.prototype.DefaultInterpolation=2301,Am.prototype.InterpolantFactoryMethodSmooth=void 0;class Pm extends Mm{} Pm.prototype.ValueTypeName="string",Pm.prototype.ValueBufferType=Array,Pm.prototype.DefaultInterpolation=2300,Pm.prototype.InterpolantFactoryMethodLinear=void 0,Pm.prototype.InterpolantFactoryMethodSmooth=void 0;class Lm extends Mm{} Lm.prototype.ValueTypeName="vector";Error;class Rm{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1} start(){this.startTime=Om(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0} stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1} getElapsedTime(){return this.getDelta(),this.elapsedTime} getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Om();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t} return t}} function Om(){return("undefined"==typeof performance?Date:performance).now()} const Fm=new RegExp("[\\[\\]\\.:\\/]","g"),Im="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Nm=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]")+/(WCOD+)?/.source.replace("WCOD",Im)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]")+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]")+"$"),zm=["material","materials","bones","map"];class km{constructor(t,e,n){this.path=e,this.parsedPath=n||km.parseTrackName(e),this.node=km.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound} static create(t,e,n){return t&&t.isAnimationObjectGroup?new km.Composite(t,e,n):new km(t,e,n)} static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Fm,"")} static parseTrackName(t){const e=Nm.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==zm.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)} if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n} static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n} if(t.children){const n=function(t){for(let i=0;i x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);"," vec4 x12 = x0.xyxy + C.xxzz;"," x12.xy -= i1;"," i = mod289(i); // Avoid truncation effects in permutation"," vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))","\t\t+ i.x + vec3(0.0, i1.x, 1.0 ));"," vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);"," m = m*m ;"," m = m*m ;"," vec3 x = 2.0 * fract(p * C.www) - 1.0;"," vec3 h = abs(x) - 0.5;"," vec3 ox = floor(x + 0.5);"," vec3 a0 = x - ox;"," m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );"," vec3 g;"," g.x = a0.x * x0.x + h.x * x0.y;"," g.yz = a0.yz * x12.xz + h.yz * x12.yw;"," return 130.0 * dot(m, g);","}","void main() {","vec2 p = vUv;","p -= vec2(0.5);","p *= 1. - (distortion * 0.03);","p += vec2(0.5);","float ty = time*speed;","float yt = p.y - ty;","float offset = snoise(vec2(yt*3.0,0.0))*0.2;","offset = offset * distortion * offset * distortion * offset;","offset += snoise(vec2(yt*50.0,0.0))*distortion2*0.001;","gl_FragColor = texture2D(tDiffuse, vec2(fract(p.x + offset), fract(p.y+ offset)));","}"].join("\n")},Qm={uniforms:{tDiffuse:{type:"t",value:null},time:{type:"f",value:0},amount:{type:"f",value:.5},size:{type:"f",value:4}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float time;","uniform float amount;","uniform float size;","varying vec2 vUv;","float rand(vec2 co){","return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);","}","void main() {","vec2 p = vUv;","vec4 color = texture2D(tDiffuse, p);","float xs = floor(gl_FragCoord.x / size);","float ys = floor(gl_FragCoord.y / size);","vec4 snow = vec4(rand(vec2(xs * time,ys * time))*amount);","gl_FragColor = color+ snow;","}"].join("\n")};function $m(t,e){return($m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)} var tg=new r({define:[{namespace:"layout",assign:".cb-layout",component:il},{namespace:"cursor",component:sl},{namespace:"loader",assign:".cb-loader",component:ll},{namespace:"divider",assign:".cb-divider",component:Ul},{namespace:"button",assign:".cb-btn",component:Vl},{namespace:"navbar",assign:".cb-navbar",component:Gl},{namespace:"menu",assign:".cb-menu",component:wu},{namespace:"intouch",assign:".cb-intouch",component:Mu},{namespace:"tophead",assign:".cb-tophead",component:Tu},{namespace:"overview",assign:".cb-overview",component:Iu},{namespace:"splitshow",assign:".cb-splitshow",component:zu},{namespace:"screenshot",assign:".cb-screenshot",component:Uu},{namespace:"outro",assign:".cb-outro",component:Vu},{namespace:"footer",assign:".cb-footer",component:function(t){var e,n;function i(){var e;return(e=t.apply(this,arguments)||this).header=e.el.querySelector(".cb-footer-header"),e.bgMedia=e.el.querySelector(".cb-footer-bg-media"),e.bgVideo=e.bgMedia.querySelector("video"),e.action=e.el.querySelector(".cb-footer-action"),e.actionBtn=e.action.querySelector("a"),e.tag=e.el.querySelectorAll(".cb-footer-tag"),e.link=e.el.querySelectorAll(".cb-footer-link"),e.sceneVisible=!1,e} n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,$m(e,n);var r=i.prototype;return r.onInit=function(){try{var t=this;return Promise.resolve(t.loadScene()).then((function(){t.magicShow()}))}catch(t){return Promise.reject(t)}},r.loadScene=function(){try{var t=this;return Ss.isTouch||(t.bgVideo.style.display="none",t.bgVideo.pause(),Ss.create({trigger:t.el,onToggle:function(e){e.progress,e.direction;var n=e.isActive;t.sceneVisible=n,n?t.bgVideo.play():t.bgVideo.pause()}}),t.sceneTexture=new gm(t.bgVideo),t.sceneTexture.minFilter=1006,t.sceneTexture.magFilter=1006,t.sceneMaterial=new Hh({map:t.sceneTexture}),t.sceneGeometry=new kd(1600,900,1,1),t.scenePlane=new gd(t.sceneGeometry,t.sceneMaterial),t.scenePlane.z=0,t.sceneFov=45,t.sceneCamera=new Dd(t.sceneFov,t.bgMedia.offsetWidth/t.bgMedia.offsetHeight,20,3e3),t.sceneCamera.position.z=1e3,t.sceneMain=new mm,t.sceneMain.add(t.scenePlane),t.sceneRenderer=new pm({antialias:!1,alpha:!1,powerPreference:"high-performance"}),t.sceneRenderer.setSize(t.bgMedia.offsetWidth,t.bgMedia.offsetHeight),t.bgMedia.appendChild(t.sceneRenderer.domElement),t.sceneComposer=new Zm(t.sceneRenderer),t.sceneRenderPass=new Km(t.sceneMain,t.sceneCamera),t.sceneBadTVPass=new qm(Jm),t.sceneStaticPass=new qm(Qm),t.sceneComposer.addPass(t.sceneRenderPass),t.sceneComposer.addPass(t.sceneBadTVPass),t.sceneComposer.addPass(t.sceneStaticPass),t.sceneBadTVPass.uniforms.distortion.value=0,t.sceneBadTVPass.uniforms.distortion2.value=0,t.sceneBadTVPass.uniforms.speed.value=.22,t.sceneBadTVPass.uniforms.rollSpeed.value=0,t.sceneStaticPass.uniforms.amount.value=.03,t.sceneStaticPass.uniforms.size.value=3,Hi.ticker.add((function(e){t.sceneVisible&&(t.sceneComposer.render(.1),t.sceneBadTVPass.uniforms.time.value=e,t.sceneStaticPass.uniforms.time.value=e)})),window.addEventListener("resize",(function(){setTimeout((function(){if(t.sceneRenderer.setSize(t.bgMedia.offsetWidth,t.bgMedia.offsetHeight),t.sceneCamera.aspect=t.bgMedia.offsetWidth/t.bgMedia.offsetHeight,t.sceneCamera.updateProjectionMatrix(),t.sceneCamera.aspect>16/9){var e=Math.tan(t.sceneFov/2*Um),n=t.sceneCamera.aspect/(16/9);t.sceneCamera.fov=2*(Math.atan(e/n)*Bm)}else t.sceneCamera.fov=t.sceneFov}),1e3)})),t.actionBtn.addEventListener("mouseenter",(function(){Hi.to(t.sceneBadTVPass.uniforms.distortion,{value:5,duration:.5}),Hi.to(t.sceneStaticPass.uniforms.amount,{value:.1,duration:.5})})),t.actionBtn.addEventListener("mouseleave",(function(){Hi.to(t.sceneBadTVPass.uniforms.distortion,{value:0,duration:.5}),Hi.to(t.sceneStaticPass.uniforms.amount,{value:.03,duration:.5})}))),Promise.resolve()}catch(t){return Promise.reject(t)}},r.magicShow=function(){var t,e;this.header&&mu(this.header.firstElementChild,{type:"lines",stagger:.3}),this.actionBtn&&(t=this.actionBtn,void 0===e&&(e={}),Ss.create({trigger:t,animation:yu(t,e),once:!0})),this.tag.length&&this.link.length&&xu([this.tag,this.link])},i}(o)}]});window.app=tg,window.addEventListener("pagehide",(function(){return window.scrollTo(0,0)}))}]);-->