1import{c as Sf,f as ii,u as ri,j as N,M as Mf,a as bf,N as Ef,b as Tf,d as wf,e as Af,g as Rf,h as zh,i as Cf,S as ga,k as xa,l as kh,r as Pf,m as Df,n as Lf,o as ke,p as If,Q as Nf,q as Uf,s as Of,t as Ff,v as Hh,R as xt,w as go,x as Bf,y as zf,z as Js,B as Yn,A as Xr,C as hn,D as xo,G as ut,T as Qe,E as En,P as es,F as gn,H as kf,I as Qs,J as Hf,K as Vh,L as Vf,O as Gf,U as cn,V as Wf,W as Pi,X as dr,Y as Xf,Z as qf,_ as Di,$ as Yf,a0 as jf,a1 as Gh,a2 as $f,a3 as Kf,a4 as Wi,a5 as Zf,a6 as Jf,a7 as Qf,a8 as Wh,a9 as ed,aa as sc}from"./index-dE8a1mPK.js";import{i as Xh,D as td,f as yl,E as qh,L as xi,a as Ni,C as Yh,A as jh,b as jn,c as $h,d as $n,h as nd,e as Sl,g as pr,u as Kh,G as Zh,j as ea,S as ac,k as id,l as rd,m as sd,n as ad,o as od,p as Jh,B as Qh,X as eu,Y as _o,q as ld,r as tu,P as oc,R as cd,s as hd,t as ud,v as fd,w as Pa,x as dd,T as pd,y as md}from"./grid-chart.module.css-B4DgdMZ7.js";import{I as ls}from"./IconX-B50qDTAe.js";import{I as gd}from"./IconExternalLink-DcQXcLz7.js";import{S as xd}from"./SimpleGrid-DkEuk0DW.js";import{S as _d}from"./Select-DebRlW67.js";import{H as vd}from"./HandleLink-CMsO54nu.js";import{C as yd}from"./ConnectAccountModal-CtLwaYHv.js";import{u as Sd}from"./time-format-A04hRRvf.js";import{I as Md}from"./IconMessage-ByV_OeXR.js";import{I as lc}from"./IconPhoto-Cq-lzySQ.js";import{I as nu}from"./IconChevronRight-Bs3jiBox.js";import{I as vo}from"./Image-Ia4YApv6.js";import{F as bd}from"./FileButton-CykIGdWi.js";import{T as yo}from"./Textarea-BtbUvWWM.js";import{I as Ed}from"./IconTrash-DIXYcrq7.js";import{C as Td}from"./Code-YtMEZkZ5.js";import"./OptionsDropdown-wonErrz5.js";import"./CheckIcon-DkMc45y2.js";import"./IconInfoCircle-CQg5L7ni.js";import"./IconUpload-CR5P8PK7.js";import"./IconArrowLeft-cAVPTBNq.js";import"./get-env-uyVen0u2.js";const[wd,Pr]=Sf("Drawer component was not found in tree");var si={root:"m_f11b401e",header:"m_5a7c2c9",content:"m_b8a05bbd",inner:"m_31cd769a"};const Ad={},_a=ii((i,e)=>{const t=ri("DrawerBody",Ad,i),{classNames:n,className:r,style:s,styles:a,vars:o,...l}=t,c=Pr();return N.jsx(Mf,{ref:e,...c.getStyles("body",{classNames:n,style:s,styles:a,className:r}),...l})});_a.classes=si;_a.displayName="@mantine/core/DrawerBody";const Rd={},va=ii((i,e)=>{const t=ri("DrawerCloseButton",Rd,i),{classNames:n,className:r,style:s,styles:a,vars:o,...l}=t,c=Pr();return N.jsx(bf,{ref:e,...c.getStyles("close",{classNames:n,style:s,styles:a,className:r}),...l})});va.classes=si;va.displayName="@mantine/core/DrawerCloseButton";const Cd={},ya=ii((i,e)=>{const t=ri("DrawerContent",Cd,i),{classNames:n,className:r,style:s,styles:a,vars:o,children:l,radius:c,__hidden:u,...f}=t,h=Pr(),d=h.scrollAreaComponent||Ef;return N.jsx(Tf,{...h.getStyles("content",{className:r,style:s,styles:a,classNames:n}),innerProps:h.getStyles("inner",{className:r,style:s,styles:a,classNames:n}
1),ref:e,...f,radius:c||h.radius||0,"data-hidden":u||void 0,children:N.jsx(d,{style:{height:"calc(100vh - var(--drawer-offset) * 2)"},children:l})})});ya.classes=si;ya.displayName="@mantine/core/DrawerContent";const Pd={},Sa=ii((i,e)=>{const t=ri("DrawerHeader",Pd,i),{classNames:n,className:r,style:s,styles:a,vars:o,...l}=t,c=Pr();return N.jsx(wf,{ref:e,...c.getStyles("header",{classNames:n,style:s,styles:a,className:r}),...l})});Sa.classes=si;Sa.displayName="@mantine/core/DrawerHeader";const Dd={},Ma=ii((i,e)=>{const t=ri("DrawerOverlay",Dd,i),{classNames:n,className:r,style:s,styles:a,vars:o,...l}=t,c=Pr();return N.jsx(Af,{ref:e,...c.getStyles("overlay",{classNames:n,style:s,styles:a,className:r}),...l})});Ma.classes=si;Ma.displayName="@mantine/core/DrawerOverlay";function Ld(i){switch(i){case"top":return"flex-start";case"bottom":return"flex-end";default:return}}function Id(i){if(i==="top"||i==="bottom")return"0 0 calc(100% - var(--drawer-offset, 0rem) * 2)"}const Nd={top:"slide-down",bottom:"slide-up",left:"slide-right",right:"slide-left"},Ud={top:"slide-down",bottom:"slide-up",right:"slide-right",left:"slide-left"},Od={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:xa("modal"),position:"left"},Fd=kh((i,{position:e,size:t,offset:n})=>({root:{"--drawer-size":Df(t,"drawer-size"),"--drawer-flex":Id(e),"--drawer-height":e==="left"||e==="right"?void 0:"var(--drawer-size)","--drawer-align":Ld(e),"--drawer-justify":e==="right"?"flex-end":void 0,"--drawer-offset":Pf(n)}})),ba=ii((i,e)=>{const t=ri("DrawerRoot",Od,i),{classNames:n,className:r,style:s,styles:a,unstyled:o,vars:l,scrollAreaComponent:c,position:u,transitionProps:f,radius:h,...d}=t,{dir:g}=Rf(),v=zh({name:"Drawer",classes:si,props:t,className:r,style:s,classNames:n,styles:a,unstyled:o,vars:l,varsResolver:Fd}),m=(g==="rtl"?Ud:Nd)[u];return N.jsx(wd,{value:{scrollAreaComponent:c,getStyles:v,radius:h},children:N.jsx(Cf,{ref:e,...v("root"),transitionProps:{transition:m,...f},"data-offset-scrollbars":c===ga.Autosize||void 0,unstyled:o,...d})})});ba.classes=si;ba.displayName="@mantine/core/DrawerRoot";const[Bd,zd]=Lf();function iu({children:i}){const[e,t]=ke.useState([]),[n,r]=ke.useState(xa("modal"));return N.jsx(Bd,{value:{stack:e,addModal:(s,a)=>{t(o=>[...new Set([...o,s])]),r(o=>typeof a=="number"&&typeof o=="number"?Math.max(o,a):o)},removeModal:s=>t(a=>a.filter(o=>o!==s)),getZIndex:s=>`calc(${n} + ${e.indexOf(s)} + 1)`,currentId:e[e.length-1],maxZIndex:n},children:i})}iu.displayName="@mantine/core/DrawerStack";const kd={},Ea=ii((i,e)=>{const t=ri("DrawerTitle",kd,i),{classNames:n,className:r,style:s,styles:a,vars:o,...l}=t,c=Pr();return N.jsx(If,{ref:e,...c.getStyles("title",{classNames:n,style:s,styles:a,className:r}),...l})});Ea.classes=si;Ea.displayName="@mantine/core/DrawerTitle";const Hd={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:xa("modal"),withOverlay:!0,withCloseButton:!0},Rn=ii((i,e)=>{const{title:t,withOverlay:n,overlayProps:r,withCloseButton:s,closeButtonProps:a,children:o,opened:l,stackId:c,zIndex:u,...f}=ri("Drawer",Hd,i),h=zd(),d=!!t||s,g=h&&c?{closeOnEscape:h.currentId===c,trapFocus:h.currentId===c,zIndex:h.getZIndex(c)}:{},v=n===!1?!1:c&&h?h.currentId===c:l;return ke.useEffect(()=>{h&&c&&(l?h.addModal(c,u||xa("modal")):h.removeModal(c))},[l,c,u]),N.jsxs(ba,{ref:e,opened:l,zIndex:h&&c?h.getZIndex(c):u,...f,...g,children:[n&&N.jsx(Ma,{visible:v,transitionProps:h&&c?{duration:0}:void 0,...r}),N.jsxs(ya,{__hidden:h&&c&&l?c!==h.currentId:!1,children:[d&&N.jsxs(Sa,{children:[t&&N.jsx(Ea,{children:t}),s&&N.jsx(va,{...a})]}),N.jsx(_a,{children:o})]})]})});Rn.classes=si;Rn.displayName="@mantine/core/Drawer";Rn.Root=ba;Rn.Overlay=Ma;Rn.Content=ya;Rn.Body=_a;Rn.Header=Sa;Rn.Title=Ea;Rn.CloseButton=va;Rn.Stack=iu;var Vd=class extends Nf{constructor(i,e){super(i,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(i){i._type="infinite",super.setOptions(i)}getOptimisticResult(i){return i._type="infinite",super.getOptimisticResult(i)}
1fetchNextPage(i){return this.fetch({...i,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(i){return this.fetch({...i,meta:{fetchMore:{direction:"backward"}}})}createResult(i,e){var g,v;const{state:t}=i,n=super.createResult(i,e),{isFetching:r,isRefetching:s,isError:a,isRefetchError:o}=n,l=(v=(g=t.fetchMeta)==null?void 0:g.fetchMore)==null?void 0:v.direction,c=a&&l==="forward",u=r&&l==="forward",f=a&&l==="backward",h=r&&l==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Of(e,t.data),hasPreviousPage:Uf(e,t.data),isFetchNextPageError:c,isFetchingNextPage:u,isFetchPreviousPageError:f,isFetchingPreviousPage:h,isRefetchError:o&&!c&&!f,isRefetching:s&&!u&&!h}}};function Gd(i,e){return Ff(i,Vd)}/** 2 * @license @tabler/icons-react v3.43.0 - MIT 3 * 4 * This source code is licensed under the MIT license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Wd=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}],["path",{d:"M16 19h6",key:"svg-2"}],["path",{d:"M19 16v6",key:"svg-3"}]],ru=Hh("outline","pencil-plus","PencilPlus",Wd);/** 7 * @license @tabler/icons-react v3.43.0 - MIT 8 * 9 * This source code is licensed under the MIT license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Xd=[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 7a5 5 0 1 0 5 5",key:"svg-1"}],["path",{d:"M13 3.055a9 9 0 1 0 7.941 7.945",key:"svg-2"}],["path",{d:"M15 6v3h3l3 -3h-3v-3l-3 3",key:"svg-3"}],["path",{d:"M15 9l-3 3",key:"svg-4"}]],qd=Hh("outline","target-arrow","TargetArrow",Xd);var Yd=["type","layout","connectNulls","ref"],jd=["key"];function yr(i){"@babel/helpers - typeof";return yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yr(i)}function cc(i,e){if(i==null)return{};var t=$d(i,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(t[n]=i[n])}return t}function $d(i,e){if(i==null)return{};var t={};for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){if(e.indexOf(n)>=0)continue;t[n]=i[n]}return t}function $r(){return $r=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},$r.apply(this,arguments)}function hc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function on(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hc(Object(t),!0).forEach(function(n){bn(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):hc(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Xi(i){return Qd(i)||Jd(i)||Zd(i)||Kd()}function Kd(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 12In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zd(i,e){if(i){if(typeof i=="string")return So(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return So(i,e)}}function Jd(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Qd(i){if(Array.isArray(i))return So(i)}function So(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}function ep(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function uc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,au(n.key),n)}}function tp(i,e,t){return e&&uc(i.prototype,e),t&&uc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function np(i,e,t){return e=ta(e),ip(i,su()?Reflect.construct(e,t||[],ta(i).constructor):e.apply(i,t))}function ip(i,e){if(e&&(yr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rp(i)}function rp(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function su(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(su=function(){return!!i})()}
vendor: 19,006 bytes, line 12
12function ta(i){return ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ta(i)}function sp(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Mo(i,e)}function Mo(i,e){return Mo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Mo(i,e)}function bn(i,e,t){return e=au(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function au(i){var e=ap(i,"string");return yr(e)=="symbol"?e:e+""}function ap(i,e){if(yr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(yr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var cs=function(i){function e(){var t;ep(this,e);for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t=np(this,e,[].concat(r)),bn(t,"state",{isAnimationFinished:!0,totalLength:0}),bn(t,"generateSimpleStrokeDasharray",function(a,o){return"".concat(o,"px ").concat(a-o,"px")}),bn(t,"getStrokeDasharray",function(a,o,l){var c=l.reduce(function(p,w){return p+w});if(!c)return t.generateSimpleStrokeDasharray(o,a);for(var u=Math.floor(a/c),f=a%c,h=o-a,d=[],g=0,v=0;g<l.length;v+=l[g],++g)if(v+l[g]>f){d=[].concat(Xi(l.slice(0,g)),[f-v]);break}var m=d.length%2===0?[0,h]:[h];return[].concat(Xi(e.repeat(l,u)),Xi(d),m).map(function(p){return"".concat(p,"px")}).join(", ")}),bn(t,"id",Kh("recharts-line-")),bn(t,"pathRef",function(a){t.mainCurve=a}),bn(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),bn(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return sp(e,i),tp(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var s=this.props,a=s.points,o=s.xAxis,l=s.yAxis,c=s.layout,u=s.children,f=yl(u,qh);if(!f)return null;var h=function(v,m){return{x:v.x,y:v.y,value:v.value,errorVal:pr(v.payload,m)}},d={clipPath:n?"url(#clipPath-".concat(r,")"):null};return xt.createElement(xi,d,f.map(function(g){return xt.cloneElement(g,{key:"bar-".concat(g.props.dataKey),data:a,xAxis:o,yAxis:l,layout:c,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,r,s){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var o=this.props,l=o.dot,c=o.points,u=o.dataKey,f=Ni(this.props,!1),h=Ni(l,!0),d=c.map(function(v,m){var p=on(on(on({key:"dot-".concat(m),r:3},f),h),{},{index:m,cx:v.x,cy:v.y,value:v.value,dataKey:u,payload:v.payload,points:c});return e.renderDotItem(l,p)}),g={clipPath:n?"url(#clipPath-".concat(r?"":"dots-").concat(s,")"):null};return xt.createElement(xi,$r({className:"recharts-line-dots",key:"dots"},g),d)}},{key:"renderCurveStatically",value:function(n,r,s,a){var o=this.props,l=o.type,c=o.layout,u=o.connectNulls;o.ref;var f=cc(o,Yd),h=on(on(on({},Ni(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:r?"url(#clipPath-".concat(s,")"):null,points:n},a),{},{type:l,layout:c,connectNulls:u});return xt.createElement(Yh,$r({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,r){var s=this,a=this.props,o=a.points,l=a.strokeDasharray,c=a.isAnimationActive,u=a.animationBegin,f=a.animationDuration,h=a.animationEasing,d=a.animationId,g=a.animateNewValues,v=a.width,m=a.height,p=this.state,w=p.prevPoints,E=p.totalLength;return xt.createElement(jh,{begin:u,duration:f,isActive:c,easing:h,from:{t:0},to:{t:1},key:"line-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(S){var b=S.t;if(w){var T=w.length/o.length,L=o.map(function(U,te){var ee=Math.floor(te*T);if(w[ee]){var $=w[ee],ne=jn($.x,U.x),K=jn($.y,U.y);return on(on({},U),{},{x:ne(b),y:K(b)})}if(g){var X=jn(v*2,U.x),ge=jn(m/2,U.y);return on(on({},U),{},{x:X(b),y:ge(b)})}return on(on({},U),{},{x:U.x,y:U.y})});return s.renderCurveStatically(L,n,r)}var x=jn(0,E),A=x(b),k;if(l){var B="".concat(l).split(/[,\s]+/gim).map(function(U){return parseFloat(U)});k=s.getStrokeDasharray(A,E,B)}else k=s.generateSimpleStrokeDasharray(E,A);return s.renderCurveStatically(o,n,r,{strokeDasharray:k})})}},{key:"renderCurve",value:function(n,r){var s=this.props,a=s.points,o=s.isAnimationActive,l=this.state,c=l.prevPoints,u=l.totalLength;return o&&a&&a.length&&(!c&&u>0||!$h(c,a))?this.renderCurveWithAnimation(n,r):this.renderCurveStatically(a,n,r)}},{key:"render",value:function(){var n,r=this.props,s=r.hide,a=r.dot,o=r.points,l=r.className,c=r.xAxis,u=r.yAxis,f=r.top,h=r.left,d=r.width,g=r.height,v=r.isAnimationActive,m=r.id;if(s||!o||!o.length)return null;var p=this.state.isAnimationFinished,w=o.length===1,E=go("recharts-line",l),S=c&&c.allowDataOverflow,b=u&&u.allowDataOverflow,T=S||b,L=$n(m)?this.id:m,x=(n=Ni(a,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},A=x.r,k=A===void 0?3:A,B=x.strokeWidth,U=B===void 0?2:B,te=nd(a)?a:{},ee=te.clipDot,$=ee===void 0?!0:ee,ne=k*2+U;return xt.createElement(xi,{className:E},S||b?xt.createElement("defs",null,xt.createElement("clipPath",{id:"clipPath-".concat(L)},xt.createElement("rect",{x:S?h:h-d/2,y:b?f:f-g/2,width:S?d:d*2,height:b?g:g*2})),!$&&xt.createElement("clipPath",{id:"clipPath-dots-".concat(L)},xt.createElement("rect",{x:h-ne/2,y:f-ne/2,width:d+ne,height:g+ne}))):null,!w&&this.renderCurve(T,L),this.renderErrorBar(T,L),(w||a)&&this.renderDots(T,$,L),(!v||p)&&Sl.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(n,r){return n.animationId!==r.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:r.curPoints}:n.points!==r.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,r){for(var s=n.length%2!==0?[].concat(Xi(n),[0]):n,a=[],o=0;o<r;++o)a=[].concat(Xi(a),Xi(s));return a}},{key:"renderDotItem",value:function(n,r){var s;if(xt.isValidElement(n))s=xt.cloneElement(n,r);else if(Xh(n))s=n(r);else{var a=r.key,o=cc(r,jd),l=go("recharts-line-dot",typeof n!="boolean"?n.className:"");s=xt.createElement(td,$r({key:a},o,{className:l}))}return s}}])}(ke.PureComponent);bn(cs,"displayName","Line");bn(cs,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Zh.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});bn(cs,"getComposedData",function(i){var e=i.props,t=i.xAxis,n=i.yAxis,r=i.xAxisTicks,s=i.yAxisTicks,a=i.dataKey,o=i.bandSize,l=i.displayedData,c=i.offset,u=e.layout,f=l.map(function(h,d){var g=pr(h,a);return u==="horizontal"?{x:ea({axis:t,ticks:r,bandSize:o,entry:h,index:d}),y:$n(g)?null:n.scale(g),value:g,payload:h}:{x:$n(g)?null:t.scale(g),y:ea({axis:n,ticks:s,bandSize:o,entry:h,index:d}),value:g,payload:h}});return on({points:f,layout:u},c)});function Sr(i){"@babel/helpers - typeof";return Sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sr(i)}function op(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function lp(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,cu(n.key),n)}}function cp(i,e,t){return e&&lp(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function hp(i,e,t){return e=na(e),up(i,ou()?Reflect.construct(e,t||[],na(i).constructor):e.apply(i,t))}function up(i,e){if(e&&(Sr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fp(i)}function fp(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ou(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ou=function(){return!!i})()}function na(i){return na=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},na(i)}function dp(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&bo(i,e)}function bo(i,e){return bo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bo(i,e)}function lu(i,e,t){return e=cu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function cu(i){var e=pp(i,"string");return Sr(e)=="symbol"?e:e+""}function pp(i,e){if(Sr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(Sr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ta=function(i){function e(){return op(this,e),hp(this,e,arguments)}return dp(e,i),cp(e,[{key:"render",value:function(){return null}}])}(ke.Component);lu(Ta,"displayName","ZAxis");lu(Ta,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var mp=["option","isActive"];function Kr(){return Kr=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Kr.apply(this,arguments)}function gp(i,e){if(i==null)return{};var t=xp(i,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(t[n]=i[n])}return t}function xp(i,e){if(i==null)return{};var t={};for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){if(e.indexOf(n)>=0)continue;t[n]=i[n]}return t}function _p(i){var e=i.option,t=i.isActive,n=gp(i,mp);return typeof e=="string"?ke.createElement(ac,Kr({option:ke.createElement(id,Kr({type:e},n)),isActive:t,shapeType:"symbols"},n)):ke.createElement(ac,Kr({option:e,isActive:t,shapeType:"symbols"},n))}function Mr(i){"@babel/helpers - typeof";return Mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mr(i)}function Zr(){return Zr=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Zr.apply(this,arguments)}function fc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function mn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fc(Object(t),!0).forEach(function(n){vi(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):fc(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function vp(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function dc(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,uu(n.key),n)}}function yp(i,e,t){return e&&dc(i.prototype,e),t&&dc(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Sp(i,e,t){return e=ia(e),Mp(i,hu()?Reflect.construct(e,t||[],ia(i).constructor):e.apply(i,t))}function Mp(i,e){if(e&&(Mr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bp(i)}function bp(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function hu(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hu=function(){return!!i})()}function ia(i){return ia=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ia(i)}function Ep(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Eo(i,e)}function Eo(i,e){return Eo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Eo(i,e)}function vi(i,e,t){return e=uu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function uu(i){var e=Tp(i,"string");return Mr(e)=="symbol"?e:e+""}function Tp(i,e){if(Mr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(Mr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var wa=function(i){function e(){var t;vp(this,e);for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t=Sp(this,e,[].concat(r)),vi(t,"state",{isAnimationFinished:!1}),vi(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0})}),vi(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1})}),vi(t,"id",Kh("recharts-scatter-")),t}return Ep(e,i),yp(e,[{key:"renderSymbolsStatically",value:function(n){var r=this,s=this.props,a=s.shape,o=s.activeShape,l=s.activeIndex,c=Ni(this.props,!1);return n.map(function(u,f){var h=l===f,d=h?o:a,g=mn(mn({},c),u);return xt.createElement(xi,Zr({className:"recharts-scatter-symbol",key:"symbol-".concat(u==null?void 0:u.cx,"-").concat(u==null?void 0:u.cy,"-").concat(u==null?void 0:u.size,"-").concat(f)},rd(r.props,u,f),{role:"img"}),xt.createElement(_p,Zr({option:d,isActive:h,key:"symbol-".concat(f)},g)))})}},{key:"renderSymbolsWithAnimation",value:function(){var n=this,r=this.props,s=r.points,a=r.isAnimationActive,o=r.animationBegin,l=r.animationDuration,c=r.animationEasing,u=r.animationId,f=this.state.prevPoints;return xt.createElement(jh,{begin:o,duration:l,isActive:a,easing:c,from:{t:0},to:{t:1},key:"pie-".concat(u),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(h){var d=h.t,g=s.map(function(v,m){var p=f&&f[m];if(p){var w=jn(p.cx,v.cx),E=jn(p.cy,v.cy),S=jn(p.size,v.size);return mn(mn({},v),{},{cx:w(d),cy:E(d),size:S(d)})}var b=jn(0,v.size);return mn(mn({},v),{},{size:b(d)})});return xt.createElement(xi,null,n.renderSymbolsStatically(g))})}},{key:"renderSymbols",value:function(){var n=this.props,r=n.points,s=n.isAnimationActive,a=this.state.prevPoints;return s&&r&&r.length&&(!a||!$h(a,r))?this.renderSymbolsWithAnimation():this.renderSymbolsStatically(r)}},{key:"renderErrorBar",value:function(){var n=this.props.isAnimationActive;if(n&&!this.state.isAnimationFinished)return null;var r=this.props,s=r.points,a=r.xAxis,o=r.yAxis,l=r.children,c=yl(l,qh);return c?c.map(function(u,f){var h=u.props,d=h.direction,g=h.dataKey;return xt.cloneElement(u,{key:"".concat(d,"-").concat(g,"-").concat(s[f]),data:s,xAxis:a,yAxis:o,layout:d==="x"?"vertical":"horizontal",dataPointFormatter:function(m,p){return{x:m.cx,y:m.cy,value:d==="x"?+m.node.x:+m.node.y,errorVal:pr(m,p)}}})}):null}},{key:"renderLine",value:function(){var n=this.props,r=n.points,s=n.line,a=n.lineType,o=n.lineJointType,l=Ni(this.props,!1),c=Ni(s,!1),u,f;if(a==="joint")u=r.map(function(E){return{x:E.cx,y:E.cy}});else if(a==="fitting"){var h=sd(r),d=h.xmin,g=h.xmax,v=h.a,m=h.b,p=function(S){return v*S+m};u=[{x:d,y:p(d)},{x:g,y:p(g)}]}var w=mn(mn(mn({},l),{},{fill:"none",stroke:l&&l.fill},c),{},{points:u});return xt.isValidElement(s)?f=xt.cloneElement(s,w):Xh(s)?f=s(w):f=xt.createElement(Yh,Zr({},w,{type:o})),xt.createElement(xi,{className:"recharts-scatter-line",key:"recharts-scatter-line"},f)}},{key:"render",value:function(){var n=this.props,r=n.hide,s=n.points,a=n.line,o=n.className,l=n.xAxis,c=n.yAxis,u=n.left,f=n.top,h=n.width,d=n.height,g=n.id,v=n.isAnimationActive;if(r||!s||!s.length)return null;var m=this.state.isAnimationFinished,p=go("recharts-scatter",o),w=l&&l.allowDataOverflow,E=c&&c.allowDataOverflow,S=w||E,b=$n(g)?this.id:g;return xt.createElement(xi,{className:p,clipPath:S?"url(#clipPath-".concat(b,")"):null},w||E?xt.createElement("defs",null,xt.createElement("clipPath",{id:"clipPath-".concat(b)},xt.createElement("rect",{x:w?u:u-h/2,y:E?f:f-d/2,width:w?h:h*2,height:E?d:d*2}))):null,a&&this.renderLine(),this.renderErrorBar(),xt.createElement(xi,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!v||m)&&Sl.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(n,r){return n.animationId!==r.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:r.curPoints}:n.points!==r.curPoints?{curPoints:n.points}:null}}])}(ke.PureComponent);vi(wa,"displayName","Scatter");vi(wa,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!Zh.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});vi(wa,"getComposedData",function(i){var e=i.xAxis,t=i.yAxis,n=i.zAxis,r=i.item,s=i.displayedData,a=i.xAxisTicks,o=i.yAxisTicks,l=i.offset,c=r.props.tooltipType,u=yl(r.props.children,ad),f=$n(e.dataKey)?r.props.dataKey:e.dataKey,h=$n(t.dataKey)?r.props.dataKey:t.dataKey,d=n&&n.dataKey,g=n?n.range:Ta.defaultProps.range,v=g&&g[0],m=e.scale.bandwidth?e.scale.bandwidth():0,p=t.scale.bandwidth?t.scale.bandwidth():0,w=s.map(function(E,S){var b=pr(E,f),T=pr(E,h),L=!$n(d)&&pr(E,d)||"-",x=[{name:$n(e.dataKey)?r.props.name:e.name||e.dataKey,unit:e.unit||"",value:b,payload:E,dataKey:f,type:c},{name:$n(t.dataKey)?r.props.name:t.name||t.dataKey,unit:t.unit||"",value:T,payload:E,dataKey:h,type:c}];L!=="-"&&x.push({name:n.name||n.dataKey,unit:n.unit||"",value:L,payload:E,dataKey:d,type:c});var A=ea({axis:e,ticks:a,bandSize:m,entry:E,index:S,dataKey:f}),k=ea({axis:t,ticks:o,bandSize:p,entry:E,index:S,dataKey:h}
12),B=L!=="-"?n.scale(L):v,U=Math.sqrt(Math.max(B,0)/Math.PI);return mn(mn({},E),{},{cx:A,cy:k,x:A-U,y:k-U,xAxis:e,yAxis:t,zAxis:n,width:2*U,height:2*U,size:B,node:{x:b,y:T,z:L},tooltipPayload:x,tooltipPosition:{x:A,y:k},payload:E},u&&u[S]&&u[S].props)});return mn({points:w},l)});var wp=od({chartName:"ComposedChart",GraphicalChild:[cs,Jh,Qh,wa],axisComponents:[{axisType:"xAxis",AxisComp:eu},{axisType:"yAxis",AxisComp:_o},{axisType:"zAxis",AxisComp:Ta}],formatAxisMap:ld});const Ap={withXAxis:!0,withYAxis:!0,withTooltip:!0,tooltipAnimationDuration:0,tickLine:"y",strokeDasharray:"5 5",gridAxis:"x",withDots:!0,connectNulls:!0,strokeWidth:2,curveType:"monotone"},Rp=kh((i,{textColor:e,gridColor:t})=>({root:{"--chart-text-color":e?Js(e,i):void 0,"--chart-grid-color":t?Js(t,i):void 0}})),Ml=ii((i,e)=>{const t=ri("CompositeChart",Ap,i),{classNames:n,className:r,style:s,styles:a,unstyled:o,vars:l,data:c,withLegend:u,legendProps:f,series:h,onMouseLeave:d,dataKey:g,withTooltip:v,withXAxis:m,withYAxis:p,gridAxis:w,tickLine:E,xAxisProps:S,yAxisProps:b,unit:T,tooltipAnimationDuration:L,strokeDasharray:x,gridProps:A,tooltipProps:k,referenceLines:B,withDots:U,dotProps:te,activeDotProps:ee,strokeWidth:$,connectNulls:ne,curveType:K,dir:X,valueFormatter:ge,children:_e,lineProps:ve,xAxisLabel:Ee,yAxisLabel:We,withRightYAxis:Je,rightYAxisLabel:Ue,rightYAxisProps:ie,withPointLabels:q,areaProps:F,barProps:O,withBarValueLabel:P,minBarSize:W,maxBarWidth:he,composedChartProps:pe,...R}=t,G=Bf(),I=w!=="none"&&(E==="x"||E==="xy"),J=w!=="none"&&(E==="y"||E==="xy"),[D,j]=ke.useState(null),ae=D!==null,re=z=>{j(null),d==null||d(z)},{resolvedClassNames:H,resolvedStyles:y}=zf({classNames:n,styles:a,props:t}),Se=zh({name:"CompositeChart",classes:tu,props:t,className:r,style:s,classNames:n,styles:a,unstyled:o,vars:l,varsResolver:Rp}),Fe=h.map(z=>{const Z=Js(z.color,G),oe=ae&&D!==z.name;return z.type==="line"?ke.createElement(cs,{...Se("line"),key:z.name,name:z.name,dataKey:z.name,dot:U?{fillOpacity:oe?0:1,strokeOpacity:oe?0:1,strokeWidth:1,fill:Z,stroke:Z,...te}:!1,activeDot:U?{fill:"var(--mantine-color-white)",stroke:Z,...ee}:!1,fill:Z,stroke:Z,strokeWidth:$,isAnimationActive:!1,fillOpacity:oe?0:1,strokeOpacity:oe?.5:1,connectNulls:ne,type:K,strokeDasharray:z.strokeDasharray,yAxisId:z.yAxisId||"left",label:q?N.jsx(oc,{valueFormatter:ge}):void 0,...typeof ve=="function"?ve(z):ve}):z.type==="area"?ke.createElement(Jh,{...Se("area"),key:z.name,name:z.name,type:K,dataKey:z.name,fill:Z,strokeWidth:$,stroke:Z,isAnimationActive:!1,connectNulls:ne,dot:U?{fillOpacity:oe?0:1,strokeOpacity:oe?0:1,strokeWidth:1,fill:Z,stroke:Z,...te}:!1,activeDot:U?{fill:G.white,stroke:Z,strokeWidth:2,r:4,...ee}:!1,fillOpacity:oe?0:.2,strokeOpacity:oe?.5:1,strokeDasharray:z.strokeDasharray,yAxisId:z.yAxisId||"left",label:q?N.jsx(oc,{valueFormatter:ge}):void 0,...typeof F=="function"?F(z):F}):z.type==="bar"?ke.createElement(Qh,{...Se("bar"),key:z.name,name:z.name,dataKey:z.name,fill:Z,stroke:Z,isAnimationActive:!1,fillOpacity:oe?.1:1,strokeOpacity:oe?.2:0,yAxisId:z.yAxisId||"left",minPointSize:W,...typeof O=="function"?O(z):O},P&&N.jsx(Sl,{position:"top",fontSize:12,fill:"var(--chart-bar-label-color, var(--mantine-color-dimmed))",formatter:ge})):null}),C=B==null?void 0:B.map((z,Z)=>{const oe=Js(z.color,G);return N.jsx(cd,{stroke:z.color?oe:"var(--chart-grid-color)",strokeWidth:1,yAxisId:z.yAxisId||"left",...z,label:{value:z.label,fill:z.color?oe:"currentColor",fontSize:12,position:z.labelPosition??"insideBottomLeft"},...Se("referenceLine")},Z)}),_={axisLine:!1,type:"number",tickLine:J?{stroke:"currentColor"}:!1,allowDecimals:!0,unit:T,tickFormatter:ge,...Se("axis")};return N.jsx(Yn,{ref:e,...Se("root"),onMouseLeave:re,dir:X||"ltr",...R,children:N.jsx(hd,{...Se("container"),children:N.jsxs(wp,{data:c,maxBarSize:he,margin:{bottom:Ee?30:void 0,left:We?10:void 0,right:We?5:void 0},...pe,children:[u&&N.jsx(ud,{verticalAlign:"top",content:z=>N.jsx(fd,{payload:z.payload,onHighlight:j,legendPosition:(f==null?void 0:f.verticalAlign)||"top",classNames:H,styles:y,series:h}),...f}),N.jsxs(eu,{hide:!m,dataKey:g,tick:{transform:"translate(0, 10)",fontSize:12,fill:"currentColor"},stroke:"",interval:"preserveStartEnd",tickLine:I?{stroke:"currentColor"}:!1,minTickGap:5,...Se("axis"),...S,children:[Ee&&N.jsx(Pa,{position:"insideBottom",offset:-20,fontSize:12,...Se("axisLabel"),children:Ee}),S==null?void 0:S.children]}),N.jsxs(_o,{yAxisId:"left",orientation:"left",tick:{transform:"translate(-10, 0)",fontSize:12,fill:"currentColor"},hide:!p,..._,...b,children:[We&&N.jsx(Pa,{position:"insideLeft",angle:-90,textAnchor:"middle",fontSize:12,offset:-5,...Se("axisLabel"),children:We}),b==null?void 0:b.children]}),N.jsxs(_o,{yAxisId:"right",orientation:"right",tick:{transform:"translate(10, 0)",fontSize:12,fill:"currentColor"},hide:!Je,..._,...ie,children:[Ue&&N.jsx(Pa,{position:"insideRight",angle:90,textAnchor:"middle",fontSize:12,offset:-5,...Se("axisLabel"),children:Ue}),b==null?void 0:b.children]}),N.jsx(dd,{strokeDasharray:x,vertical:w==="y"||w==="xy",horizontal:w==="x"||w==="xy",...Se("grid"),...A}),v&&N.jsx(pd,{animationDuration:L,isAnimationActive:L!==0,position:{y:0},cursor:{stroke:"var(--chart-grid-color)",strokeWidth:1,strokeDasharray:x},content:({label:z,payload:Z})=>N.jsx(md,{label:z,payload:Z,unit:T,classNames:H,styles:y,series:h,valueFormatter:ge}),...k}),Fe,C,_e]})})})});Ml.displayName="@mantine/charts/CompositeChart";Ml.classes=tu;/** 13 * @license 14 * Copyright 2010-2026 Three.js Authors 15 * SPDX-License-Identifier: MIT 16 */const bl="185",mr={ROTATE:0,DOLLY:1,PAN:2},ur={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Cp=0,pc=1,Pp=2,Ws=1,Dp=2,qr=3,Si=0,en=1,un=2,Kn=0,gr=1,mc=2,gc=3,xc=4,Lp=5,Li=100,Ip=101,Np=102,Up=103,Op=104,Fp=200,Bp=201,zp=202,kp=203,To=204,wo=205,Hp=206,Vp=207,Gp=208,Wp=209,Xp=210,qp=211,Yp=212,jp=213,$p=214,Ao=0,Ro=1,Co=2,br=3,Po=4,Do=5,Lo=6,Io=7,fu=0,Kp=1,Zp=2,On=0,du=1,pu=2,mu=3,gu=4,xu=5,_u=6,vu=7,yu=300,Fi=301,Er=302,Da=303,La=304,Aa=306,ra=1e3,Nn=1001,sa=1002,Ht=1003,Jp=1004,fs=1005,qt=1006,Ia=1007,Ui=1008,fn=1009,Su=1010,Mu=1011,ts=1012,El=1013,Bn=1014,Tn=1015,Qn=1016,Tl=1017,wl=1018,ns=1020,bu=35902,Eu=35899,Tu=1021,wu=1022,wn=1023,ei=1026,Oi=1027,Al=1028,Rl=1029,Bi=1030,Cl=1031,Pl=1033,Xs=33776,qs=33777,Ys=33778,js=33779,No=35840,Uo=35841,Oo=35842,Fo=35843,Bo=36196,zo=37492,ko=37496,Ho=37488,Vo=37489,aa=37490,Go=37491,Wo=37808,Xo=37809,qo=37810,Yo=37811,jo=37812,$o=37813,Ko=37814,Zo=37815,Jo=37816,Qo=37817,el=37818,tl=37819,nl=37820,il=37821,rl=36492,sl=36494,al=36495,ol=36283,ll=36284,oa=36285,cl=36286,Qp=3200,hl=0,em=1,_i="",Jt="srgb",la="srgb-linear",ca="linear",dt="srgb",qi=7680,_c=519,tm=512,nm=513,im=514,Dl=515,rm=516,sm=517,Ll=518,am=519,ul=35044,vc="300 es",Un=2e3,is=2001;function om(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function ha(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function lm(){const i=ha("canvas");return i.style.display="block",i}const yc={};function ua(...i){const e="THREE."+i.shift();console.log(e,...i)}function Au(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}
16function Ze(...i){i=Au(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ot(...i){i=Au(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function xr(...i){const e=i.join(" ");e in yc||(yc[e]=!0,Ze(...i))}function cm(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const hm={[Ao]:Ro,[Co]:Lo,[Po]:Io,[br]:Do,[Ro]:Ao,[Lo]:Co,[Io]:Po,[Do]:br};class bi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Wt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],$s=Math.PI/180,fl=180/Math.PI;function Zn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Wt[i&255]+Wt[i>>8&255]+Wt[i>>16&255]+Wt[i>>24&255]+"-"+Wt[e&255]+Wt[e>>8&255]+"-"+Wt[e>>16&15|64]+Wt[e>>24&255]+"-"+Wt[t&63|128]+Wt[t>>8&255]+"-"+Wt[t>>16&255]+Wt[t>>24&255]+Wt[n&255]+Wt[n>>8&255]+Wt[n>>16&255]+Wt[n>>24&255]).toLowerCase()}function st(i,e,t){return Math.max(e,Math.min(t,i))}function um(i,e){return(i%e+e)%e}function Na(i,e,t){return(1-t)*i+t*e}function In(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function _t(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const fm={DEG2RAD:$s},Zl=class Zl{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 9,981 bytes, line 16
16sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(st(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Zl.prototype.isVector2=!0;let de=Zl;class ti{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],h=s[a+0],d=s[a+1],g=s[a+2],v=s[a+3];if(f!==v||l!==h||c!==d||u!==g){let m=l*h+c*d+u*g+f*v;m<0&&(h=-h,d=-d,g=-g,v=-v,m=-m);let p=1-o;if(m<.9995){const w=Math.acos(m),E=Math.sin(w);p=Math.sin(p*w)/E,o=Math.sin(o*w)/E,l=l*p+h*o,c=c*p+d*o,u=u*p+g*o,f=f*p+v*o}else{l=l*p+h*o,c=c*p+d*o,u=u*p+g*o,f=f*p+v*o;const w=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=w,c*=w,u*=w,f*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[a],h=s[a+1],d=s[a+2],g=s[a+3];return e[t]=o*g+u*f+l*d-c*h,e[t+1]=l*g+u*h+c*f-o*d,e[t+2]=c*g+u*d+o*h-l*f,e[t+3]=u*g-o*f-l*h-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(r/2),f=o(s/2),h=l(n/2),d=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=h*u*f+c*d*g,this._y=c*d*f-h*u*g,this._z=c*u*g+h*d*f,this._w=c*u*f-h*d*g;break;case"YXZ":this._x=h*u*f+c*d*g,this._y=c*d*f-h*u*g,this._z=c*u*g-h*d*f,this._w=c*u*f+h*d*g;break;case"ZXY":this._x=h*u*f-c*d*g,this._y=c*d*f+h*u*g,this._z=c*u*g+h*d*f,this._w=c*u*f-h*d*g;break;case"ZYX":this._x=h*u*f-c*d*g,this._y=c*d*f+h*u*g,this._z=c*u*g-h*d*f,this._w=c*u*f+h*d*g;break;case"YZX":this._x=h*u*f+c*d*g,this._y=c*d*f+h*u*g,this._z=c*u*g-h*d*f,this._w=c*u*f-h*d*g;break;case"XZY":this._x=h*u*f-c*d*g,this._y=c*d*f-h*u*g,this._z=c*u*g+h*d*f,this._w=c*u*f+h*d*g;break;default:Ze("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=n+o+f;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(a-r)*d}else if(n>o&&n>f){const d=2*Math.sqrt(1+n-o-f);this._w=(u-l)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+c)/d}else if(o>f){const d=2*Math.sqrt(1+o-n-f);this._w=(s-c)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+f-n-o);this._w=(a-r)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(st(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-r*o,this._w=a*u-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Jl=class Jl{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Sc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Sc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}
vendor: 5,421 bytes, line 16
16applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),u=2*(o*t-s*r),f=2*(s*n-a*t);return this.x=t+l*c+a*f-o*u,this.y=n+l*u+o*c-s*f,this.z=r+l*f+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this.z=st(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this.z=st(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ua.copy(this).projectOnVector(e),this.sub(Ua)}reflect(e){return this.sub(Ua.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(st(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Jl.prototype.isVector3=!0;let V=Jl;const Ua=new V,Sc=new ti,Ql=class Ql{constructor(e,t,n,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],f=n[7],h=n[2],d=n[5
vendor: 25,024 bytes, line 16
16],g=n[8],v=r[0],m=r[3],p=r[6],w=r[1],E=r[4],S=r[7],b=r[2],T=r[5],L=r[8];return s[0]=a*v+o*w+l*b,s[3]=a*m+o*E+l*T,s[6]=a*p+o*S+l*L,s[1]=c*v+u*w+f*b,s[4]=c*m+u*E+f*T,s[7]=c*p+u*S+f*L,s[2]=h*v+d*w+g*b,s[5]=h*m+d*E+g*T,s[8]=h*p+d*S+g*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],f=u*a-o*c,h=o*l-u*s,d=c*s-a*l,g=t*f+n*h+r*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/g;return e[0]=f*v,e[1]=(r*c-u*n)*v,e[2]=(o*n-r*a)*v,e[3]=h*v,e[4]=(u*t-r*l)*v,e[5]=(r*s-o*t)*v,e[6]=d*v,e[7]=(n*l-c*t)*v,e[8]=(a*t-n*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return xr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Oa.makeScale(e,t)),this}rotate(e){return xr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Oa.makeRotation(-e)),this}translate(e,t){return xr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Oa.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Ql.prototype.isMatrix3=!0;let je=Ql;const Oa=new je,Mc=new je().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),bc=new je().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function dm(){const i={enabled:!0,workingColorSpace:la,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===dt&&(r.r=Jn(r.r),r.g=Jn(r.g),r.b=Jn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===dt&&(r.r=_r(r.r),r.g=_r(r.g),r.b=_r(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===_i?ca:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return xr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return xr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[la]:{primaries:e,whitePoint:n,transfer:ca,toXYZ:Mc,fromXYZ:bc,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Jt},outputColorSpaceConfig:{drawingBufferColorSpace:Jt}},[Jt]:{primaries:e,whitePoint:n,transfer:dt,toXYZ:Mc,fromXYZ:bc,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Jt}}}),i}const lt=dm();function Jn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function _r(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Yi;class pm{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Yi===void 0&&(Yi=ha("canvas")),Yi.width=e.width,Yi.height=e.height;const r=Yi.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Yi}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ha("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=Jn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Jn(t[n]/255)*255):t[n]=Jn(t[n]);return{data:t,width:e.width,height:e.height}}else return Ze("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let mm=0;class Il{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:mm++}),this.uuid=Zn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Fa(r[a].image)):s.push(Fa(r[a]))}else s=Fa(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Fa(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?pm.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Ze("Texture: Unable to serialize Texture."),{})}let gm=0;const Ba=new V;class Yt extends bi{constructor(e=Yt.DEFAULT_IMAGE,t=Yt.DEFAULT_MAPPING,n=Nn,r=Nn,s=qt,a=Ui,o=wn,l=fn,c=Yt.DEFAULT_ANISOTROPY,u=_i){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:gm++}),this.uuid=Zn(),this.name="",this.source=new Il(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new de(0,0),this.repeat=new de(1,1),this.center=new de(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new je,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Ba).x}get height(){return this.source.getSize(Ba).y}get depth(){return this.source.getSize(Ba).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Ze(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ze(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==yu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ra:e.x=e.x-Math.floor(e.x);break;case Nn:e.x=e.x<0?0:1;break;case sa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ra:e.y=e.y-Math.floor(e.y);break;case Nn:e.y=e.y<0?0:1;break;case sa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Yt.DEFAULT_IMAGE=null;Yt.DEFAULT_MAPPING=yu;Yt.DEFAULT_ANISOTROPY=1;const ec=class ec{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],u=l[4],f=l[8],h=l[1],d=l[5],g=l[9],v=l[2],m=l[6],p=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-v)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+v)<.1&&Math.abs(g+m)<.1&&Math.abs(c+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,S=(d+1)/2,b=(p+1)/2,T=(u+h)/4,L=(f+v)/4,x=(g+m)/4;return E>S&&E>b?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=T/n,s=L/n):S>b?S<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),n=T/r,s=x/r):b<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(b),n=L/s,r=x/s),this.set(n,r,s,t),this}let w=Math.sqrt((m-g)*(m-g)+(f-v)*(f-v)+(h-u)*(h-u));return Math.abs(w)<.001&&(w=1),this.x=(m-g)/w,this.y=(f-v)/w,this.z=(h-u)/w,this.w=Math.acos((c+d+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=st(this.x,e.x,t.x),this.y=st(this.y,e.y,t.y),this.z=st(this.z,e.z,t.z),this.w=st(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=st(this.x,e,t),this.y=st(this.y,e,t),this.z=st(this.z,e,t),this.w=st(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(st(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}};ec.prototype.isVector4=!0;let At=ec;class xm extends bi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new At(0,0,e,t),this.scissorTest=!1,this.viewport=new At(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new Yt(r),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:qt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new Il(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Fn extends xm{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Ru extends Yt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ht,this.minFilter=Ht,this.wrapR=Nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class _m extends Yt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ht,this.minFilter=Ht,this.wrapR=Nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ma=class ma{constructor(e,t,n,r,s,a,o,l,c,u,f,h,d,g,v,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,u,f,h,d,g,v,m)}set(e,t,n,r,s,a,o,l,c,u,f,h,d,g,v,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=r,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=f,p[14]=h,p[3]=d,p[7]=g,p[11]=v,p[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 ma().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,r=1/ji.setFromMatrixColumn(e,0).length(),s=1/ji.setFromMatrixColumn(e,1).length(),a=1/ji.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=a*u,d=a*f,g=o*u,v=o*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=d+g*c,t[5]=h-v*c,t[9]=-o*l,t[2]=v-h*c,t[6]=g+d*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*u,d=l*f,g=c*u,v=c*f;t[0]=h+v*o,t[4]=g*o-d,t[8]=a*c,t[1]=a*f,t[5]=a*u,t[9]=-o,t[2]=d*o-g,t[6]=v+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*u,d=l*f,g=c*u,v=c*f;t[0]=h-v*o,t[4]=-a*f,t[8]=g+d*o,t[1]=d+g*o,t[5]=a*u,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*u,d=a*f,g=o*u,v=o*f;t[0]=l*u,t[4]=g*c-d,t[8]=h*c+v,t[1]=l*f,t[5]=v*c+h,t[9]=d*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,d=a*c,g=o*l,v=o*c;t[0]=l*u,t[4]=v-h*f,t[8]=g*f+d,t[1]=f,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=d*f+g,t[10]=h-v*f}else if(e.order==="XZY"){const h=a*l,d=a*c,g=o*l,v=o*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+v,t[5]=a*u,t[9]=d*f-g,t[2]=g*f-d,t[6]=o*u,t[10]=v*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(vm,e,ym)}lookAt(e,t,n){const r=this.elements;return sn.subVectors(e,t),sn.lengthSq()===0&&(sn.z=1),sn.normalize(),ci.crossVectors(n,sn),ci.lengthSq()===0&&(Math.abs(n.z)===1?sn.x+=1e-4:sn.z+=1e-4,sn.normalize(),ci.crossVectors(n,sn)),ci.normalize(),ds.crossVectors(sn,ci),r[0]=ci.x,r[4]=ds.x,r[8]=sn.x,r[1]=ci.y,r[5]=ds.y,r[9]=sn.y,r[2]=ci.z,r[6]=ds.z,r[10]=sn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],f=n[5],h=n[9],d=n[13],g=n[2],v=n[6],m=n[10],p=n[14],w=n[3],E=n[7],S=n[11],b=n[15],T=r[0],L=r[4],x=r[8],A=r[12],k=r[1],B=r[5],U=r[9],te=r[13],ee=r[2],$=r[6],ne=r[10],K=r[14],X=r[3],ge=r[7],_e=r[11],ve=r[15];return s[0]=a*T+o*k+l*ee+c*X,s[4]=a*L+o*B+l*$+c*ge,s[8]=a*x+o*U+l*ne+c*_e,s[12]=a*A+o*te+l*K+c*ve,s[1]=u*T+f*k+h*ee+d*X,s[5]=u*L+f*B+h*$+d*ge,s[9]=u*x+f*U+h*ne+d*_e,s[13]=u*A+f*te+h*K+d*ve,s[2]=g*T+v*k+m*ee+p*X,s[6]=g*L+v*B+m*$+p*ge,s[10]=g*x+v*U+m*ne+p*_e,s[14]=g*A+v*te+m*K+p*ve,s[3]=w*T+E*k+S*ee+b*X,s[7]=w*L+E*B+S*$+b*ge,s[11]=w*x+E*U+S*ne+b*_e,s[15]=w*A+E*te+S*K+b*ve,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],d=e[14],g=e[3],v=e[7],m=e[11],p=e[15],w=l*d-c*h,E=o*d-c*f,S=o
vendor: 4,856 bytes, line 16
16*h-l*f,b=a*d-c*u,T=a*h-l*u,L=a*f-o*u;return t*(v*w-m*E+p*S)-n*(g*w-m*b+p*T)+r*(g*E-v*b+p*L)-s*(g*S-v*T+m*L)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],u=e[10];return t*(a*u-o*c)-n*(s*u-o*l)+r*(s*c-a*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],d=e[11],g=e[12],v=e[13],m=e[14],p=e[15],w=t*o-n*a,E=t*l-r*a,S=t*c-s*a,b=n*l-r*o,T=n*c-s*o,L=r*c-s*l,x=u*v-f*g,A=u*m-h*g,k=u*p-d*g,B=f*m-h*v,U=f*p-d*v,te=h*p-d*m,ee=w*te-E*U+S*B+b*k-T*A+L*x;if(ee===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const $=1/ee;return e[0]=(o*te-l*U+c*B)*$,e[1]=(r*U-n*te-s*B)*$,e[2]=(v*L-m*T+p*b)*$,e[3]=(h*T-f*L-d*b)*$,e[4]=(l*k-a*te-c*A)*$,e[5]=(t*te-r*k+s*A)*$,e[6]=(m*S-g*L-p*E)*$,e[7]=(u*L-h*S+d*E)*$,e[8]=(a*U-o*k+c*x)*$,e[9]=(n*k-t*U-s*x)*$,e[10]=(g*T-v*S+p*w)*$,e[11]=(f*S-u*T-d*w)*$,e[12]=(o*A-a*B-l*x)*$,e[13]=(t*B-n*A+r*x)*$,e[14]=(v*E-g*b-m*w)*$,e[15]=(u*b-f*E+h*w)*$,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+n,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,f=o+o,h=s*c,d=s*u,g=s*f,v=a*u,m=a*f,p=o*f,w=l*c,E=l*u,S=l*f,b=n.x,T=n.y,L=n.z;return r[0]=(1-(v+p))*b,r[1]=(d+S)*b,r[2]=(g-E)*b,r[3]=0,r[4]=(d-S)*T,r[5]=(1-(h+p))*T,r[6]=(m+w)*T,r[7]=0,r[8]=(g+E)*L,r[9]=(m-w)*L,r[10]=(1-(h+v))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=ji.set(r[0],r[1],r[2]).length();const o=ji.set(r[4],r[5],r[6]).length(),l=ji.set(r[8],r[9],r[10]).length();s<0&&(a=-a),yn.copy(this);const c=1/a,u=1/o,f=1/l;return yn.elements[0]*=c,yn.elements[1]*=c,yn.elements[2]*=c,yn.elements[4]*=u,yn.elements[5]*=u,yn.elements[6]*=u,yn.elements[8]*=f,yn.elements[9]*=f,yn.elements[10]*=f,t.setFromRotationMatrix(yn),n.x=a,n.y=o,n.z=l,this}makePerspective(e,t,n,r,s,a,o=Un,l=!1){const c=this.elements,u=2*s/(t-e),f=2*s/(n-r),h=(t+e)/(t-e),d=(n+r)/(n-r);let g,v;if(l)g=s/(a-s),v=a*s/(a-s);else if(o===Un)g=-(a+s)/(a-s),v=-2*a*s/(a-s);else if(o===is)g=-a/(a-s),v=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=f,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=v,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Un,l=!1){const c=this.elements,u=2/(t-e),f=2/(n-r),h=-(t+e)/(t-e),d=-(n+r)/(n-r);let g,v;if(l)g=1/(a-s),v=a/(a-s);else if(o===Un)g=-2/(a-s),v=-(a+s)/(a-s);else if(o===is)g=-1/(a-s),v=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=f,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=g,c[14]=v,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};ma.prototype.isMatrix4=!0;let pt=ma;const ji=new V,yn=new pt,vm=new V(0,0,0),ym=new V(1,1,1),ci=new V,ds=new V,sn=new V,Ec=new pt,Tc=new ti;class Mi{constructor(e=0,t=0,n=0,r=Mi.DEFAULT_ORDER){this.isEuler
vendor: 24,720 bytes, line 16
16=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],f=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(st(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-st(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(st(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-st(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(st(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-st(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Ze("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ec.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ec,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Tc.setFromEuler(this),this.setFromQuaternion(Tc,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Mi.DEFAULT_ORDER="XYZ";class Nl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Sm=0;const wc=new V,$i=new ti,Hn=new pt,ps=new V,Nr=new V,Mm=new V,bm=new ti,Ac=new V(1,0,0),Rc=new V(0,1,0),Cc=new V(0,0,1),Pc={type:"added"},Em={type:"removed"},Ki={type:"childadded",child:null},za={type:"childremoved",child:null};class kt extends bi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Sm++}),this.uuid=Zn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=kt.DEFAULT_UP.clone();const e=new V,t=new Mi,n=new ti,r=new V(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new pt},normalMatrix:{value:new je}}),this.matrix=new pt,this.matrixWorld=new pt,this.matrixAutoUpdate=kt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Nl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return $i.setFromAxisAngle(e,t),this.quaternion.multiply($i),this}rotateOnWorldAxis(e,t){return $i.setFromAxisAngle(e,t),this.quaternion.premultiply($i),this}rotateX(e){return this.rotateOnAxis(Ac,e)}rotateY(e){return this.rotateOnAxis(Rc,e)}rotateZ(e){return this.rotateOnAxis(Cc,e)}translateOnAxis(e,t){return wc.copy(e).applyQuaternion(this.quaternion),this.position.add(wc.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ac,e)}translateY(e){return this.translateOnAxis(Rc,e)}translateZ(e){return this.translateOnAxis(Cc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Hn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ps.copy(e):ps.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Nr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Hn.lookAt(Nr,ps,this.up):Hn.lookAt(ps,Nr,this.up),this.quaternion.setFromRotationMatrix(Hn),r&&(Hn.extractRotation(r.matrixWorld),$i.setFromRotationMatrix(Hn),this.quaternion.premultiply($i.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ot("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Pc),Ki.child=e,this.dispatchEvent(Ki),Ki.child=null):ot("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Em),za.child=e,this.dispatchEvent(za),za.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Hn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Hn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Hn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Pc),Ki.child=e,this.dispatchEvent(Ki),Ki.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nr,e,Mm),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nr,bm,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),f=a(e.shapes),h=a(e.skeletons),d=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}kt.DEFAULT_UP=new V(0,1,0);kt.DEFAULT_MATRIX_AUTO_UPDATE=!0;kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class fr extends kt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Tm={type:"move"};class ka{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new fr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new fr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new V,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new V),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new fr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new V,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new V,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),p=this._getHandJoint(c,v);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),d=.02,g=.005;c.inputState.pinching&&h>d+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=d-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Tm)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new fr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Cu={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},hi={h:0,s:0,l:0},ms={h:0,s:0,l:0};function Ha(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class at{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Jt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,lt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=lt.workingColorSpace){return this.r=e,this.g=t,this.b=n,lt.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=lt.workingColorSpace){if(e=um(e,1),t=st(t,0,1),n=st(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Ha(a,s,e+1/3),this.g=Ha(a,s,e),this.b=Ha(a,s,e-1/3)}return lt.colorSpaceToWorking(this,r),this}setStyle(e,t=Jt){function n(s){s!==void 0&&parseFloat(s)<1&&Ze("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ze("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ze("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Jt){const n=Cu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ze("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Jn(e.r),this.g=Jn(e.g),this.b=Jn(e.b),this}copyLinearToSRGB(e){return this.r=_r(e.r),this.g=_r(e.g),this.b=_r(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Jt){return lt.workingToColorSpace(Xt.copy(this),e),Math.round(st(Xt.r*255,0,255))*65536+Math.round(st(Xt.g*255,0,255))*256+Math.round(st(Xt.b*255,0,255))}getHexString(e=Jt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=lt.workingColorSpace){lt.workingToColorSpace(Xt.copy(this),t);const n=Xt.r,r=Xt.g,s=Xt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=u<=.5?f/(a+o):f/(2-a-o),a){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=lt.workingColorSpace){return lt.workingToColorSpace(Xt.copy(this),t),e.r=Xt.r,e.g=Xt.g,e.b=Xt.b,e}getStyle(e=Jt){lt.workingToColorSpace(Xt.copy(this),e);const t=Xt.r,n=Xt.g,r=Xt.b;return e!==Jt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(hi),this.setHSL(hi.h+e,hi.s+t,hi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 4,456 bytes, line 16
16lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(hi),e.getHSL(ms);const n=Na(hi.h,ms.h,t),r=Na(hi.s,ms.s,t),s=Na(hi.l,ms.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Xt=new at;at.NAMES=Cu;class wm extends kt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Mi,this.environmentIntensity=1,this.environmentRotation=new Mi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Sn=new V,Vn=new V,Va=new V,Gn=new V,Zi=new V,Ji=new V,Dc=new V,Ga=new V,Wa=new V,Xa=new V,qa=new At,Ya=new At,ja=new At;class _n{constructor(e=new V,t=new V,n=new V){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Sn.subVectors(e,t),r.cross(Sn);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Sn.subVectors(r,t),Vn.subVectors(n,t),Va.subVectors(e,t);const a=Sn.dot(Sn),o=Sn.dot(Vn),l=Sn.dot(Va),c=Vn.dot(Vn),u=Vn.dot(Va),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const h=1/f,d=(c*l-o*u)*h,g=(a*u-o*l)*h;return s.set(1-d-g,g,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Gn)===null?!1:Gn.x>=0&&Gn.y>=0&&Gn.x+Gn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Gn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Gn.x),l.addScaledVector(a,Gn.y),l.addScaledVector(o,Gn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return qa.setScalar(0),Ya.setScalar(0),ja.setScalar(0),qa.fromBufferAttribute(e,t),Ya.fromBufferAttribute(e,n),ja.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(qa,s.x),a.addScaledVector(Ya,s.y),a.addScaledVector(ja,s.z),a}static isFrontFacing(e,t,n,r){return Sn.subVectors(n,t),Vn.subVectors(e,t),Sn.cross(Vn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Sn.subVectors(this.c,this.b),Vn.subVectors(this.a,this.b),Sn.cross(Vn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return _n.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return _n.getBarycoord(e,this.a,this.b,this.c,t)}
vendor: 29,835 bytes, line 16
16getInterpolation(e,t,n,r,s){return _n.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return _n.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return _n.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Zi.subVectors(r,n),Ji.subVectors(s,n),Ga.subVectors(e,n);const l=Zi.dot(Ga),c=Ji.dot(Ga);if(l<=0&&c<=0)return t.copy(n);Wa.subVectors(e,r);const u=Zi.dot(Wa),f=Ji.dot(Wa);if(u>=0&&f<=u)return t.copy(r);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Zi,a);Xa.subVectors(e,s);const d=Zi.dot(Xa),g=Ji.dot(Xa);if(g>=0&&d<=g)return t.copy(s);const v=d*c-l*g;if(v<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(Ji,o);const m=u*g-d*f;if(m<=0&&f-u>=0&&d-g>=0)return Dc.subVectors(s,r),o=(f-u)/(f-u+(d-g)),t.copy(r).addScaledVector(Dc,o);const p=1/(m+v+h);return a=v*p,o=h*p,t.copy(n).addScaledVector(Zi,a).addScaledVector(Ji,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ni{constructor(e=new V(1/0,1/0,1/0),t=new V(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Mn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Mn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Mn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Mn):Mn.fromBufferAttribute(s,a),Mn.applyMatrix4(e.matrixWorld),this.expandByPoint(Mn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),gs.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),gs.copy(n.boundingBox)),gs.applyMatrix4(e.matrixWorld),this.union(gs)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Mn),Mn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ur),xs.subVectors(this.max,Ur),Qi.subVectors(e.a,Ur),er.subVectors(e.b,Ur),tr.subVectors(e.c,Ur),ui.subVectors(er,Qi),fi.subVectors(tr,er),Ei.subVectors(Qi,tr);let t=[0,-ui.z,ui.y,0,-fi.z,fi.y,0,-Ei.z,Ei.y,ui.z,0,-ui.x,fi.z,0,-fi.x,Ei.z,0,-Ei.x,-ui.y,ui.x,0,-fi.y,fi.x,0,-Ei.y,Ei.x,0];return!$a(t,Qi,er,tr,xs)||(t=[1,0,0,0,1,0,0,0,1],!$a(t,Qi,er,tr,xs))?!1:(_s.crossVectors(ui,fi),t=[_s.x,_s.y,_s.z],$a(t,Qi,er,tr,xs))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Mn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Mn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Wn=[new V,new V,new V,new V,new V,new V,new V,new V],Mn=new V,gs=new ni,Qi=new V,er=new V,tr=new V,ui=new V,fi=new V,Ei=new V,Ur=new V,xs=new V,_s=new V,Ti=new V;function $a(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Ti.fromArray(i,s);const o=r.x*Math.abs(Ti.x)+r.y*Math.abs(Ti.y)+r.z*Math.abs(Ti.z),l=e.dot(Ti),c=t.dot(Ti),u=n.dot(Ti);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const It=new V,vs=new de;let Am=0;class vn extends bi{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Am++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ul,this.updateRanges=[],this.gpuType=Tn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)vs.fromBufferAttribute(this,t),vs.applyMatrix3(e),this.setXY(t,vs.x,vs.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix3(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix4(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyNormalMatrix(e),this.setXYZ(t,It.x,It.y,It.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.transformDirection(e),this.setXYZ(t,It.x,It.y,It.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=In(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=_t(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=In(t,this.array)),t}setX(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=In(t,this.array)),t}setY(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=In(t,this.array)),t}setZ(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=In(t,this.array)),t}setW(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),n=_t(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),n=_t(n,this.array),r=_t(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),n=_t(n,this.array),r=_t(r,this.array),s=_t(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ul&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Pu extends vn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Du extends vn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class bt extends vn{constructor(e,t,n){super(new Float32Array(e),t,n)}}const Rm=new ni,Or=new V,Ka=new V;class hs{constructor(e=new V,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Rm.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Or.subVectors(e,this.center);const t=Or.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Or,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Ka.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Or.copy(e.center).add(Ka)),this.expandByPoint(Or.copy(e.center).sub(Ka))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let Cm=0;const pn=new pt,Za=new kt,nr=new V,an=new ni,Fr=new ni,zt=new V;class jt extends bi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Cm++}),this.uuid=Zn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(om(e)?Du:Pu)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new je().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return pn.makeRotationFromQuaternion(e),this.applyMatrix4(pn),this}rotateX(e){return pn.makeRotationX(e),this.applyMatrix4(pn),this}rotateY(e){return pn.makeRotationY(e),this.applyMatrix4(pn),this}rotateZ(e){return pn.makeRotationZ(e),this.applyMatrix4(pn),this}translate(e,t,n){return pn.makeTranslation(e,t,n),this.applyMatrix4(pn),this}scale(e,t,n){return pn.makeScale(e,t,n),this.applyMatrix4(pn),this}lookAt(e){return Za.lookAt(e),Za.updateMatrix(),this.applyMatrix4(Za.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(nr).negate(),this.translate(nr.x,nr.y,nr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new bt(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Ze("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ni);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ot("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new V(-1/0,-1/0,-1/0),new V(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];an.setFromBufferAttribute(s),this.morphTargetsRelative?(zt.addVectors(this.boundingBox.min,an.min),this.boundingBox.expandByPoint(zt),zt.addVectors(this.boundingBox.max,an.max),this.boundingBox.expandByPoint(zt)):(this.boundingBox.expandByPoint(an.min),this.boundingBox.expandByPoint(an.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ot('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new hs);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ot("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new V,1/0);return}if(e){const n=this.boundingSphere.center;if(an.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Fr.setFromBufferAttribute(o),this.morphTargetsRelative?(zt.addVectors(an.min,Fr.min),an.expandByPoint(zt),zt.addVectors(an.max,Fr.max),an.expandByPoint(zt)):(an.expandByPoint(Fr.min),an.expandByPoint(Fr.max))}an.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)zt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(zt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)zt.fromBufferAttribute(o,c),l&&(nr.fromBufferAttribute(e,c),zt.add(nr)),r=Math.max(r,n.distanceToSquared(zt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ot('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ot("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new vn(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let x=0;x<n.count;x++)o[x]=new V,l[x]=new V;const c=new V,u=new V,f=new V,h=new de,d=new de,g=new de,v=new V,m=new V;function p(x,A,k){c.fromBufferAttribute(n,x),u.fromBufferAttribute(n,A),f.fromBufferAttribute(n,k),h.fromBufferAttribute(s,x),d.fromBufferAttribute(s,A),g.fromBufferAttribute(s,k),u.sub(c),f.sub(c),d.sub(h),g.sub(h);const B=1/(d.x*g.y-g.x*d.y);isFinite(B)&&(v.copy(u).multiplyScalar(g.y).addScaledVector(f,-d.y).multiplyScalar(B),m.copy(f).multiplyScalar(d.x).addScaledVector(u,-g.x).multiplyScalar(B),o[x].add(v),o[A].add(v),o[k].add(v),l[x].add(m),l[A].add(m),l[k].add(m))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let x=0,A=w.length;x<A;++x){const k=w[x],B=k.start,U=k.count;for(let te=B,ee=B+U;te<ee;te+=3)p(e.getX(te+0),e.getX(te+1),e.getX(te+2))}const E=new V,S=new V,b=new V,T=new V;function L(x){b.fromBufferAttribute(r,x),T.copy(b);const A=o[x];E.copy(A),E.sub(b.multiplyScalar(b.dot(A))).normalize(),S.crossVectors(T,A);const B=S.dot(l[x])<0?-1:1;a.setXYZW(x,E.x,E.y,E.z,B)}for(let x=0,A=w.length;x<A;++x){const k=w[x],B=k.start,U=k.count;for(let te=B,ee=B+U;te<ee;te+=3)L(e.getX(te+0)),L(e.getX(te+1)),L(e.getX(te+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new vn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);const r=new V,s=new V,a=new V,o=new V,l=new V,c=new V,u=new V,f=new V;if(e)for(let h=0,d=e.count;h<d;h+=3){const g=e.getX(h+0),v=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,m),u.subVectors(a,s),f.subVectors(r,s),u.cross(f),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,v),c.fromBufferAttribute(n,m),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,d=t.count;h<d;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),f.subVectors(r,s),u.cross(f),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)zt.fromBufferAttribute(e,t),zt.normalize(),e.setXYZ(t,zt.x,zt.y,zt.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,f=o.normalized,h=new c.constructor(l.length*u);let d=0,g=0;for(let v=0,m=l.length;v<m;v++){o.isInterleavedBufferAttribute?d=l[v]*o.data.stride+o.offset:d=l[v]*u;for(let p=0;p<u;p++)h[g++]=c[d++]}return new vn(h,u,f)}if(this.index===null)return Ze("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new jt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,f=c.length;u<f;u++){const h=c[u],d=e(h,n);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,h=c.length;f<h;f++){const d=c[f];u.push(d.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let h=0,d=f.length;h<d;h++)u.push(f[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Pm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ul,this.updateRanges=[],this.version=0,this.uuid=Zn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Kt=new V;class fa{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Kt.fromBufferAttribute(this,t),Kt.applyMatrix4(e),this.setXYZ(t,Kt.x,Kt.y,Kt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Kt.fromBufferAttribute(this,t),Kt.applyNormalMatrix(e),this.setXYZ(t,Kt.x,Kt.y,Kt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Kt.fromBufferAttribute(this,t),Kt.transformDirection(e),this.setXYZ(t,Kt.x,Kt.y,Kt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=In(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=_t(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=_t(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=_t(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=_t(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=_t(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=In(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=In(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=In(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=In(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=_t(t,this.array),n=_t(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=_t(t,this.array),n=_t(n,this.array),r=_t(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=_t(t,this.array),n=_t(n,this.array),r=_t(r,this.array),s=_t(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){ua("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new vn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new fa(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){ua("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let Dm=0;class Dr extends bi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Dm++}),this.uuid=Zn(),this.name="",this.type="Material",this.blending=gr,this.side=Si,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=To,this.blendDst=wo,this.blendEquation=Li,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new at(0,0,0),this.blendAlpha=0,this.depthFunc=br,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=_c,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=qi,this.stencilZFail=qi,this.stencilZPass=qi,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.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Ze(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ze(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 16,661 bytes, line 16
16n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==gr&&(n.blending=this.blending),this.side!==Si&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==To&&(n.blendSrc=this.blendSrc),this.blendDst!==wo&&(n.blendDst=this.blendDst),this.blendEquation!==Li&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==br&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==_c&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==qi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==qi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==qi&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new at().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new de().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new de().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,767 bytes, line 16
16adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ul extends Dr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new at(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let ir;const Br=new V,rr=new V,sr=new V,ar=new de,zr=new de,Lu=new pt,ys=new V,kr=new V,Ss=new V,Lc=new de,Ja=new de,Ic=new de;class Iu extends kt{constructor(e=new Ul){if(super(),this.isSprite=!0,this.type="Sprite",ir===void 0){ir=new jt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Pm(t,5);ir.setIndex([0,1,2,0,2,3]),ir.setAttribute("position",new fa(n,3,0,!1)),ir.setAttribute("uv",new fa(n,2,3,!1))}this.geometry=ir,this.material=e,this.center=new de(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ot('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),rr.setFromMatrixScale(this.matrixWorld),Lu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),sr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&rr.multiplyScalar(-sr.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;Ms(ys.set(-.5,-.5,0),sr,a,rr,r,s),Ms(kr.set(.5,-.5,0),sr,a,rr,r,s),Ms(Ss.set(.5,.5,0),sr,a,rr,r,s),Lc.set(0,0),Ja.set(1,0),Ic.set(1,1);let o=e.ray.intersectTriangle(ys,kr,Ss,!1,Br);if(o===null&&(Ms(kr.set(-.5,.5,0),sr,a,rr,r,s),Ja.set(0,1),o=e.ray.intersectTriangle(ys,Ss,kr,!1,Br),o===null))return;const l=e.ray.origin.distanceTo(Br);l<e.near||l>e.far||t.push({distance:l,point:Br.clone(),uv:_n.getInterpolation(Br,ys,kr,Ss,Lc,Ja,Ic,new de),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ms(i,e,t,n,r,s){ar.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(zr.x=s*ar.x-r*ar.y,zr.y=r*ar.x+s*ar.y):zr.copy(ar),i.copy(e),i.x+=zr.x,i.y+=zr.y,i.applyMatrix4(Lu)}const Xn=new V,Qa=new V,bs=new V,di=new V,eo=new V,Es=new V,to=new V;class Ol{constructor(e=new V,t=new V(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Xn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Xn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Xn.copy(this.origin).addScaledVector(this.direction,t),Xn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Qa.copy(e).add(t).multiplyScalar(.5),bs.copy(t).sub(e).normalize(),di.copy(this.origin).sub(Qa);const s=e.distanceTo(t)*.5,a=-this.direction.dot(bs),o=di.dot(this.direction),l=-di.dot(bs),c=di.lengthSq(),u=Math.abs(1-a*a);let f,h,d,g;if(u>0)if(f=a*l-o,h=a*o-l,g=s*u,f>=0)if(h>=-g)if(h<=g){const v=1/u;f*=v,h*=v,d=f*(f+a*h+2*o)+h*(a*f+h+2*l)+c}else h=s,f=Math.max(0,-(a*h+o)),d=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(a*h+o)),d=-f*f+h*(h+2*l)+c;else h<=-g?(f=Math.max(0,-(-a*s+o)),h=f>0?-s:Math.min(Math.max(-s,-l),s),d=-f*f+h*(h+2*l)+c):h<=g?(f=0,h=Math.min(Math.max(-s,-l),s),d=h*(h+2*l)+c):(f=Math.max(0,-(a*s+o)),h=f>0?s:Math.min(Math.max(-s,-l),s),d=-f*f+h*(h+2*l)+c);else h=a>0?-s:s,f=Math.max(0,-(a*h+o)),d=-f*f+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Qa).addScaledVector(bs,h),d}intersectSphere(e,t){Xn.subVectors(e.center,this.origin);const n=Xn.dot(this.direction),r=Xn.dot(Xn)-n*n,s=e.radius*e.radiu
vendor: 7,929 bytes, line 16
16s;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(o=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Xn)!==null}intersectTriangle(e,t,n,r,s){eo.subVectors(t,e),Es.subVectors(n,e),to.crossVectors(eo,Es);let a=this.direction.dot(to),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;di.subVectors(this.origin,e);const l=o*this.direction.dot(Es.crossVectors(di,Es));if(l<0)return null;const c=o*this.direction.dot(eo.cross(di));if(c<0||l+c>a)return null;const u=-o*di.dot(to);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class zi extends Dr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new at(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.envMapRotation=new Mi,this.combine=fu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Nc=new pt,wi=new Ol,Ts=new hs,Uc=new V,ws=new V,As=new V,Rs=new V,no=new V,Cs=new V,Oc=new V,Ps=new V;class Ot extends kt{constructor(e=new jt,t=new zi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Cs.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],f=s[l];u!==0&&(no.fromBufferAttribute(f,e),a?Cs.addScaledVector(no,u):Cs.addScaledVector(no.sub(t),u))}t.add(Cs)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ts.copy(n.boundingSphere),Ts.applyMatrix4(s),wi.copy(e.ray).recast(e.near),!(Ts.containsPoint(wi.origin)===!1&&(wi.intersectSphere(Ts,Uc)===null||wi.origin.distanceToSquared(Uc)>(e.far-e.near)**2))&&(Nc.copy(s).invert(),wi.copy(e.ray).applyMatrix4(Nc),!(n.boundingBox!==null&&wi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,wi)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,h=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,v=h.length;g<v;g++){const m=h[g],p=a[m.materialIndex],w=Math.max(m.start,d.start),E=Math.min(o.count,Math.min(m.start+m.count,d.start+d.count));for(let S=w,b=E;S<b;S+=3){const T=o.getX(S),L=o.getX(S+1),x=o.getX(S+2);r=Ds(this,p,e,n,c,u,f,T,L,x),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,d.start),v=Math.min(o.count,d.start+d.count);for(let m=g,p=v;m<p;m+=3){const w=o.getX(m),E=o.getX(m+1),S=o.getX(m+2);r=Ds(this,a,e,n,c,u,f,w,E,S),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,v=h.length;g<v;g++){const m=h[g],p=a[m.materialIndex],w=Math.max(m.start,d.start),E=Math.min(l.count,Math.min(m.start+m.count,d.start+d.count));for(let S=w,b=E;S<b;S+=3){const T=S,L=S+1,x=S+2;r=Ds(this,p,e,n,c,u,f,T,L,x),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,d.start),v=Math.min(l.count,d.start+d.count);for(let m=g,p=v;m<p;m+=3){const w=m,E=m+1,S=m+2;r=Ds(this,a,e,n,c,u,f,w,E,S),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function Lm(i,e,t,n,r,s,a,o){let l;if(e.side===en?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Si,o),l===null)return null;Ps.copy(o),Ps.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Ps);return c<t.near||c>t.far?null:{distance:c,point:Ps.clone(),object:i}}function Ds(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ws),i.getVertexPosition(l,As),i.getVertexPosition(c,Rs);const u=Lm(i,e,t,n,ws,As,Rs,Oc);if(u){const f=new V;_n.getBarycoord(Oc,ws,As,Rs,f),r&&(u.uv=_n.getInterpolatedAttribute(r,o,l,c,f,new de)),s&&(u.uv1=_n.getInterpolatedAttribute(s,o,l,c,f,new de)),a&&(u.normal=_n.getInterpolatedAttribute(a,o,l,c,f,new V),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new V,materialIndex:0};_n.getNormal(ws,As,Rs,h.normal),u.face=h,u.barycoord=f}return u}class Nu extends Yt{constructor(e=null,t=1,n=1,r,s,a,o,l,c=Ht,u=Ht,f,h){super(null,a,o,l,c,u,r,s,f,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fc extends vn{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const or=new pt,Bc=new pt,Ls=[],zc=new ni,Im=new pt,Hr=new Ot,Vr=new hs;class Nm extends Ot{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Fc(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,Im)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ni),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;
16n++)this.getMatrixAt(n,or),zc.copy(e.boundingBox).applyMatrix4(or),this.boundingBox.union(zc)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new hs),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,or),Vr.copy(e.boundingSphere).applyMatrix4(or),this.boundingSphere.union(Vr)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=r[a+o]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(Hr.geometry=this.geometry,Hr.material=this.material,Hr.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Vr.copy(this.boundingSphere),Vr.applyMatrix4(n),e.ray.intersectsSphere(Vr)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,or),Bc.multiplyMatrices(n,or),Hr.matrixWorld=Bc,Hr.raycast(e,Ls);for(let a=0,o=Ls.length;a<o;a++){const l=Ls[a];l.instanceId=s,l.object=this,t.push(l)}Ls.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Fc(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new Nu(new Float32Array(r*this.count),r,this.count,Al,Tn));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=r*e;return s[l]=o,s.set(n,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const io=new V,Um=new V,Om=new je;class gi{constructor(e=new V(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=io.subVectors(n,t).cross(Um.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){const r=e.delta(io),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Om.getNormalMatrix(e),r=this.coplanarPoint(io).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ai=new hs,Fm=new de(.5,.5),Is=new V;class Fl{constructor(e=new gi,t=new gi,n=new gi,r=new gi,s=new gi,a=new gi){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;
vendor: 4,517 bytes, line 16
16n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Un,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],u=s[4],f=s[5],h=s[6],d=s[7],g=s[8],v=s[9],m=s[10],p=s[11],w=s[12],E=s[13],S=s[14],b=s[15];if(r[0].setComponents(c-a,d-u,p-g,b-w).normalize(),r[1].setComponents(c+a,d+u,p+g,b+w).normalize(),r[2].setComponents(c+o,d+f,p+v,b+E).normalize(),r[3].setComponents(c-o,d-f,p-v,b-E).normalize(),n)r[4].setComponents(l,h,m,S).normalize(),r[5].setComponents(c-l,d-h,p-m,b-S).normalize();else if(r[4].setComponents(c-l,d-h,p-m,b-S).normalize(),t===Un)r[5].setComponents(c+l,d+h,p+m,b+S).normalize();else if(t===is)r[5].setComponents(l,h,m,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ai.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ai.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ai)}intersectsSprite(e){Ai.center.set(0,0,0);const t=Fm.distanceTo(e.center);return Ai.radius=.7071067811865476+t,Ai.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ai)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Is.x=r.normal.x>0?e.max.x:e.min.x,Is.y=r.normal.y>0?e.max.y:e.min.y,Is.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Is)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Uu extends Yt{constructor(e=[],t=Fi,n,r,s,a,o,l,c,u){super(e,t,n,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Bl extends Yt{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Tr extends Yt{constructor(e,t,n=Bn,r,s,a,o=Ht,l=Ht,c,u=ei,f=1){if(u!==ei&&u!==Oi)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:f};super(h,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Il(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Bm extends Tr{constructor(e,t=Bn,n=Fi,r,s,a=Ht,o=Ht,l,c=ei){const u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,a,o,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Ou extends Yt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Tt extends jt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],f=[];let h=0,d=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new bt(c,3)),this.setAttribute("normal",new bt(u,3)),this.setAttribute("uv",new bt(f,2));function g(v,m,p,w,E,S,b,T,L,x,A){const k=S/L,B=b/x,U=S/2,te=b/2,ee=T/2,$=L+1,ne=x+1;let K=0,X=0;const ge=new V;for(let _e=0;_e<ne;_e++){const ve=_e*B-te;for(let Ee=0;Ee<$;Ee++){const We=Ee*k-U;ge[v]=We*w,ge[m]=ve*E,ge[p]=ee,c.push(ge.x,ge.y,ge.z),ge[v]=0,ge[m]=0,ge[p]=T>0?1:-1,u.push(ge.x,ge.y,ge.z),f.push(Ee/L),f.push(1-_e/x),K+=1}}for(let _e=0;_e<x;_e++)for(let ve=0;ve<L;ve++){const Ee=h+ve+$*_e,We=h+ve+$*(_e+1),Je=h+(ve+1)+$*(_e+1),Ue=h+(ve+1)+$*_e;l.push(Ee,We,Ue),l.push(We,Je,Ue),X+=6}o.addGroup(d,X,A),d+=X,h+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tt(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class zl extends jt{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radiu
vendor: 2,464 bytes, line 16
16s:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new V,u=new de;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let f=0,h=3;f<=t;f++,h+=3){const d=n+f/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),u.x=(a[h]/e+1)/2,u.y=(a[h+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new bt(a,3)),this.setAttribute("normal",new bt(o,3)),this.setAttribute("uv",new bt(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class vr extends jt{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],f=[],h=[],d=[];let g=0;const v=[],m=n/2;let p=0;w(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(u),this.setAttribute("position",new bt(f,3)),this.setAttribute("normal",new bt(h,3)),this.setAttribute("uv",new bt(d,2));function w(){const S=new V,b=new V;let T=0;const L=(t-e)/n;for(let x=0;x<=s;x++){const A=[],k=x/s,B=k*(t-e)+e;for(let U=0;U<=r;U++){const te=U/r,ee=te*l+o,$=Math.sin(ee),ne=Math.cos(ee);b.x=B*$,b.y=-k*n+m,b.z=B*ne,f.push(b.x,b.y,b.z),S.set($,L,ne).normalize(),h.push(S.x,S.y,S.z),d.push(te,1-k),A.push(g++)}v.push(A)}for(let x=0;x<r;x++)for(let A=0;A<s;A++){const k=v[A][x],B=v[A+1][x],U=v[A+1][x+1],te=v[A][x+1];(e>0||A!==0)&&(u.push(k,B,te),T+=3),(t>0||A!==s-1)&&(u.push(B,U,te),T+=3)}c.addGroup(p,T,0),p+=T}function E(S){const b=g,T=new de,L=new V;let x=0;const A=S===!0?e:t,k=S===!0?1:-1;for(let U=1;U<=r;U++)f.push(0,m*k,0),h.push(0,k,0),d.push(.5,.5),g++;const B=g;for(let U=0;U<=r;U++){const ee=U/r*l+o,$=Math.cos(ee),ne=Math.sin(ee);L.x=A*ne,L.y=m*k,L.z=A*$,f.push(L.x,L.y,L.z),h.push(0,k,0),T.x=$*.5+.5,T.y=ne*.5*k+.5,d.push(T.x,T.y),g++}for(let U=0;U<r;U++){const te=b+U,ee=B+U;S===!0?u.push(ee,ee+1,te):u.push(ee+1,ee,te),x+=3}c.addGroup(p,x,S===!0?1:2),p+=x}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vr(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class kl extends vr{constructor(e=1,t=1,n=32,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,s,a,o),this.type="C
16oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new kl(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class kn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Ze("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const u=n[r],h=n[r+1]-u,d=(a-u)/h;return(r+d)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new de:new V);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new V,r=[],s=[],a=[],o=new V,l=new pt;for(let d=0;d<=e;d++){const g=d/e;r[d]=this.getTangentAt(g,new V)}s[0]=new V,a[0]=new V;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),f=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),h<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),a[d]=a[d-1].clone(),o.crossVectors(r[d-1],r[d]),o.length()>Number.EPSILON){o.normalize();const g=Math.acos(st(r[d-1].dot(r[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(o,g))}a[d].crossVectors(r[d],s[d])}if(t===!0){let d=Math.acos(st(s[0].dot(s[e]),-1,1));d/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(d=-d);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],d*g)),a[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Hl extends kn{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new de){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),h=l-this.aX,d=c-this.aY;l=h*u-d*f+this.aX,c=h*f+d*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class zm extends Hl{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Vl(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,f){let h=(a-s)/c-(o-s)/(c+u)+(o-a)/u,d=(o-a)/u-(l-a)/(u+f)+(l-o)/f;h*=u,d*=u,r(a,o,h,d)}
vendor: 4,145 bytes, line 16
16,calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const kc=new V,Hc=new V,ro=new Vl,so=new Vl,ao=new Vl;class km extends kn{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new V){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(Hc.subVectors(r[0],r[1]).add(r[0]),c=Hc);const f=r[o%s],h=r[(o+1)%s];if(this.closed||o+2<s?u=r[(o+2)%s]:(kc.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=kc),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(u),d);v<1e-4&&(v=1),g<1e-4&&(g=v),m<1e-4&&(m=v),ro.initNonuniformCatmullRom(c.x,f.x,h.x,u.x,g,v,m),so.initNonuniformCatmullRom(c.y,f.y,h.y,u.y,g,v,m),ao.initNonuniformCatmullRom(c.z,f.z,h.z,u.z,g,v,m)}else this.curveType==="catmullrom"&&(ro.initCatmullRom(c.x,f.x,h.x,u.x,this.tension),so.initCatmullRom(c.y,f.y,h.y,u.y,this.tension),ao.initCatmullRom(c.z,f.z,h.z,u.z,this.tension));return n.set(ro.calc(l),so.calc(l),ao.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new V().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Vc(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function Hm(i,e){const t=1-i;return t*t*e}function Vm(i,e){return 2*(1-i)*i*e}function Gm(i,e){return i*i*e}function Jr(i,e,t,n){return Hm(i,e)+Vm(i,t)+Gm(i,n)}function Wm(i,e){const t=1-i;return t*t*t*e}function Xm(i,e){const t=1-i;return 3*t*t*i*e}function qm(i,e){return 3*(1-i)*i*i*e}function Ym(i,e){return i*i*i*e}function Qr(i,e,t,n,r){return Wm(i,e)+Xm(i,t)+qm(i,n)+Ym(i,r)}class Fu extends kn{constructor(e=new de,t=new de,n=new de,r=new de){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new de){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Qr(e,r.x,s.x,a.x,o.x),Qr(e,r.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class jm extends kn{constructor(e=new V,t=new V,n=new V,r=new V){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new V){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Qr(e,r.x,s.x,a.x,o.x),Qr(e,r.y,s.y,a.y,o.y),Qr(e,r.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Bu extends kn{constructor(e=new de,t=new de){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new de){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 8,520 bytes, line 16
16getTangent(e,t=new de){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class $m extends kn{constructor(e=new V,t=new V){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new V){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new V){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class zu extends kn{constructor(e=new de,t=new de,n=new de){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new de){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Jr(e,r.x,s.x,a.x),Jr(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Km extends kn{constructor(e=new V,t=new V,n=new V){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new V){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Jr(e,r.x,s.x,a.x),Jr(e,r.y,s.y,a.y),Jr(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ku extends kn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new de){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],u=r[a>r.length-2?r.length-1:a+1],f=r[a>r.length-3?r.length-1:a+2];return n.set(Vc(o,l.x,c.x,u.x,f.x),Vc(o,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new de().fromArray(r))}return this}}var dl=Object.freeze({__proto__:null,ArcCurve:zm,CatmullRomCurve3:km,CubicBezierCurve:Fu,CubicBezierCurve3:jm,EllipseCurve:Hl,LineCurve:Bu,LineCurve3:$m,QuadraticBezierCurve:zu,QuadraticBezierCurve3:Km,SplineCurve:ku});class Zm extends kn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new dl[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const a=r[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const a=s[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(new dl[r.type]().fromJSON(r))}return this}}class wr extends Zm{constructor(e){super(),this.type="Path",this.currentPoint=new de,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Bu(this.currentPoint.clone(),new de(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const s=new zu(this.currentPoint.clone(),new de(e,t),new de(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,a){const o=new Fu(this.currentPoint.clone(),new de(e,t),new de(n,r),new de(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new ku(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,r,s,a),this}absarc(e,t,n,r,s,a){return this.absellipse(e,t,n,n,r,s,a),this}ellipse(e,t,n,r,s,a,o,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,a,o,l),this}absellipse(e,t,n,r,s,a,o,l){const c=new Hl(e,t,n,r,s,a,o,l);if(this.curves.length>0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Gl extends wr{constructor(e){super(e),this.uuid=Zn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(new wr().fromJSON(r))}return this}}function Jm(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=Hu(i,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=ig(i,e,s,t)),i.length>80*t){o=i[0],l=i[1];let u=o,f=l;for(let h=t;h<r;h+=t){const d=i[h],g=i[h+1];d<o&&(o=d),g<l&&(l=g),d>u&&(u=d),g>f&&(f=g)}c=Math.max(u-o,f-l),c=c!==0?32767/c:0}return rs(s,a,t,o,l,c,0),a}function Hu(i,e,t,n,r){let s;if(r===pg(i,e,t,n)>0)for(let a=e;a<t;a+=n)s=Gc(a/n|0,i[a],i[a+1],s);else for(let a=t-n;a>=e;a-=n)s=Gc(a/n|0,i[a],i[a+1],s);return s&&Ar(s,s.next)&&(as(s),s=s.next),s}function ki(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Ar(t,t.next)||Rt(t.prev,t,t.next)===0)){if(as(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function rs(i,e,t,n,r,s,a){if(!i)return;!a&&s&&lg(i,n,r,s);let o=i;for(;i.prev!==i.next;){const l=i.prev,c=i.next;if(s?eg(i,n,r,s):Qm(i)){e.push(l.i,i.i,c.i),as(i),i=c.next,o=c.next;continue}if(i=c,i===o){a?a===1?(i=tg(ki(i),e),rs(i,e,t,n,r,s,2)):a===2&&ng(i,e,t,n,r,s
vendor: 4,299 bytes, line 16
16):rs(ki(i),e,t,n,r,s,1);break}}}function Qm(i){const e=i.prev,t=i,n=i.next;if(Rt(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,u=Math.min(r,s,a),f=Math.min(o,l,c),h=Math.max(r,s,a),d=Math.max(o,l,c);let g=n.next;for(;g!==e;){if(g.x>=u&&g.x<=h&&g.y>=f&&g.y<=d&&Yr(r,o,s,l,a,c,g.x,g.y)&&Rt(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function eg(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Rt(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,u=r.y,f=s.y,h=a.y,d=Math.min(o,l,c),g=Math.min(u,f,h),v=Math.max(o,l,c),m=Math.max(u,f,h),p=pl(d,g,e,t,n),w=pl(v,m,e,t,n);let E=i.prevZ,S=i.nextZ;for(;E&&E.z>=p&&S&&S.z<=w;){if(E.x>=d&&E.x<=v&&E.y>=g&&E.y<=m&&E!==r&&E!==a&&Yr(o,u,l,f,c,h,E.x,E.y)&&Rt(E.prev,E,E.next)>=0||(E=E.prevZ,S.x>=d&&S.x<=v&&S.y>=g&&S.y<=m&&S!==r&&S!==a&&Yr(o,u,l,f,c,h,S.x,S.y)&&Rt(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;E&&E.z>=p;){if(E.x>=d&&E.x<=v&&E.y>=g&&E.y<=m&&E!==r&&E!==a&&Yr(o,u,l,f,c,h,E.x,E.y)&&Rt(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;S&&S.z<=w;){if(S.x>=d&&S.x<=v&&S.y>=g&&S.y<=m&&S!==r&&S!==a&&Yr(o,u,l,f,c,h,S.x,S.y)&&Rt(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function tg(i,e){let t=i;do{const n=t.prev,r=t.next.next;!Ar(n,r)&&Gu(n,t,t.next,r)&&ss(n,r)&&ss(r,n)&&(e.push(n.i,t.i,r.i),as(t),as(t.next),t=i=r),t=t.next}while(t!==i);return ki(t)}function ng(i,e,t,n,r,s){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&ug(a,o)){let l=Wu(a,o);a=ki(a,a.next),l=ki(l,l.next),rs(a,e,t,n,r,s,0),rs(l,e,t,n,r,s,0);return}o=o.next}a=a.next}while(a!==i)}function ig(i,e,t,n){const r=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*n,l=s<a-1?e[s+1]*n:i.length,c=Hu(i,o,l,n,!1);c===c.next&&(c.steiner=!0),r.push(hg(c))}r.sort(rg);for(let s=0;s<r.length;s++)t=sg(r[s],t);return t}function rg(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function sg(i,e){const t=ag(i,e);if(!t)return e;const n=Wu(t,i);return ki(n,n.next),ki(t,t.next)}function ag(i,e){let t=e;const n=i.x,r=i.y;let s=-1/0,a;if(Ar(i,t))return t;do{if(Ar(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,a=t.x<t.next.x?t:t.next,f===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let u=1/0;t=a;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Vu(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){const f=Math.abs(r-t.y)/(n-t.x);ss(t,i)&&(f<u||f===u&&(t.x>a.x||t.x===a.x&&og(a,t)))&&(a=t,u=f)}t=t.next}while(t!==o);return a}function og(i,e){return Rt(i.prev,i,e.prev)<0&&Rt(e.next,i,i.next)<0}function lg(i,e,t,n){let r=i;do r.z===0&&(r.z=pl(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,cg(r)}function cg(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let a=n,o=0;for(let c=0;c<t&&(o++,a=a.nextZ,!!a);c++);let l=t;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||n.z<=a.z)?(r=n,n=n.nextZ,o--):(r=a,a=a.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=a}s.nextZ=null,t*=2}while(e>1);return i}function pl(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function hg(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Vu(i,e,t,n,r,s,a,o){return(r-a)*(e-o)>=(i-a)*(s-o)&&(i-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(r-a)*(n-o)}function Yr(i,e,t,n,r,s,a,o){return!(i===a&&e===o)&&Vu(i,e,t,n,r,s,a,o)}function ug(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!fg(i,e)&&(ss(i,e)&&ss(e,i)&&dg(i,e)&&(Rt(i.prev,i,e.prev)||Rt(i,e.prev,e))||Ar(i,e)&&Rt(i.prev,i,i.next)>0&&Rt(e.prev,e,e.next)>0)}function Rt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Ar(i,e){return i.x===e.x&&i.y===e.y}function Gu(i,e,t,n){const r=Us(Rt(i,e,t)),s=Us(Rt(i,e,n)),a=Us(Rt(t,n,i)),o=Us(Rt(t,n,e));return!!(r!==s&&a!==o||r===0&&Ns(i,t,e)||s===0&&Ns(i,n,e)||a===0&&Ns(t,i,n)||o===0&&Ns(t,e,n))}function Ns(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Us(i){return i>0?1:i<0?-1:0}function fg(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Gu(t,t.next,i,e))return!0;t=t.next}
16while(t!==i);return!1}function ss(i,e){return Rt(i.prev,i,i.next)<0?Rt(i,e,i.next)>=0&&Rt(i,i.prev,e)>=0:Rt(i,e,i.prev)<0||Rt(i,i.next,e)<0}function dg(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function Wu(i,e){const t=ml(i.i,i.x,i.y),n=ml(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Gc(i,e,t,n){const r=ml(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function as(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function ml(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function pg(i,e,t,n){let r=0;for(let s=e,a=t-n;s<t;s+=n)r+=(i[a]-i[s])*(i[s+1]+i[a+1]),a=s;return r}class mg{static triangulate(e,t,n=2){return Jm(e,t,n)}}class An{static area(e){const t=e.length;let n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return An.area(e)<0}static triangulateShape(e,t){const n=[],r=[],s=[];Wc(e),Xc(n,e);let a=e.length;t.forEach(Wc);for(let l=0;l<t.length;l++)r.push(a),a+=t[l].length,Xc(n,t[l]);const o=mg.triangulate(n,r);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Wc(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function Xc(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class Wl extends jt{constructor(e=new Gl([new de(.5,.5),new de(-.5,.5),new de(-.5,-.5),new de(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new bt(r,3)),this.setAttribute("uv",new bt(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1;let h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:d-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3;const p=t.extrudePath,w=t.UVGenerator!==void 0?t.UVGenerator:gg;let E,S=!1,b,T,L,x;if(p){E=p.getSpacedPoints(u),S=!0,h=!1;const R=p.isCatmullRomCurve3?p.closed:!1;b=p.computeFrenetFrames(u,R),T=new V,L=new V,x=new V}h||(m=0,d=0,g=0,v=0);const A=o.extractPoints(c);let k=A.shape;const B=A.holes;if(!An.isClockWise(k)){k=k.reverse();for(let R=0,G=B.length;R<G;R++){const I=B[R];An.isClockWise(I)&&(B[R]=I.reverse())}}function te(R){const I=10000000000000001e-36;let J=R[0];for(let D=1;D<=R.length;D++){const j=D%R.length,ae=R[j],re=ae.x-J.x,H=ae.y-J.y,y=re*re+H*H,Se=Math.max(Math.abs(ae.x),Math.abs(ae.y),Math.abs(J.x),Math.abs(J.y)),Fe=I*Se*Se;if(y<=Fe){R.splice(j,1),D--;continue}J=ae}}te(k),B.forEach(te);const ee=B.length,$=k;for(let R=0;R<ee;R++){const G=B[R];k=k.concat(G)}function ne(R,G,I){return G||ot("ExtrudeGeometry: vec does not exist"),R.clone().addScaledVector(G,I)}const K=k.length;function X(R,G,I){let J,D,j;const ae=R.x-G.x,re=R.y-G.y,H=I.x-R.x,y=I.y-R.y,Se=ae*ae+re*re,Fe=ae*y-re*H;if(Math.abs(Fe)>Number.EPSILON){const C=Math.sqrt(Se),_=Math.sqrt(H*H+y*y),z=G.x-re/C,Z=G.y+ae/C,oe=I.x-y/_,Me=I.y+H/_,be=((oe-z)*y-(Me-Z)*H)/(ae*y-re*H);J=z+ae*be-R.x,D=Z+re*be-R.y;const fe=J*J+D*D;if(fe<=2)return new de(J,D);j=Math.sqrt(fe/2)}else{let C=!1;ae>Number.EPSILON?H>Number.EPSILON&&(C=!0):ae<-Number.EPSILON?H<-Number.EPSILON&&(C=!0):Math.sign(re)===Math.sign(y)&&(C=!0),C?(J=-re,D=ae,j=Math.sqrt(Se)):(J=ae,D=re,j=Math.sqrt(Se/2))}return new de(J/j,D/j)}const ge=[];for(let R=0,G=$.length,I=G-1,J=R+1;R<G;R++,I++,J++)I===G&&(I=0),J===G&&(J=0),ge[R]=X($[R],$[I],$[J]);const _e=[];let ve,Ee=ge.concat();for(let R=0,G=ee;R<G;R++){const I=B[R];ve=[];for(let J=0,D=I.length,j=D-1,ae=J+1;J<D;J++,j++,ae++)j===D&&(j=0),ae===D&&(ae=0),ve[J]=X(I[J],I[j],I[ae]);_e.push(ve),Ee=Ee.concat(ve)}let We;if(m===0)We=An.triangulateShape($,B);else{const R=[],G=[];for(let I=0;I<m;I++){const J=I/m,D=d*Math.cos(J*Math.PI/2),j=g*Math.sin(J*Math.PI/2)+v;for(let ae=0,re=$.length;ae<re;ae++){const H=ne($[ae],ge[ae],j);O(H.x,H.y,-D),J===0&&R.push(H)}for(let ae=0,re=ee;ae<re;ae++){const H=B[ae];ve=_e[ae];const y=[];for(let Se=0,Fe=H.length;Se<Fe;Se++){const C=ne(H[Se],ve[Se],j);O(C.x,C.y,-D),J===0&&y.push(C)}J===0&&G.push(y)}}We=An.triangulateShape(R,G)}const Je=We.length,Ue=g+v;for(let R=0;R<K;R++){const G=h?ne(k[R],Ee[R],Ue):k[R];S?(L.copy(b.normals[0]).multiplyScalar(G.x),T.copy(b.binormals[0]).multiplyScalar(G.y),x.copy(E[0]).add(L).add(T),O(x.x,x.y,x.z)):O(G.x,G.y,0)}for(let R=1;R<=u;R++)for(let G=0;G<K;G++){const I=h?ne(k[G],Ee[G],Ue):k[G];S?(L.copy(b.normals[R]).multiplyScalar(I.x),T.copy(b.binormals[R]).multiplyScalar(I.y),x.copy(E[R]).add(L).add(T),O(x.x,x.y,x.z)):O(I.x,I.y,f/u*R)}for(let R=m-1;R>
vendor: 5,204 bytes, line 16
16=0;R--){const G=R/m,I=d*Math.cos(G*Math.PI/2),J=g*Math.sin(G*Math.PI/2)+v;for(let D=0,j=$.length;D<j;D++){const ae=ne($[D],ge[D],J);O(ae.x,ae.y,f+I)}for(let D=0,j=B.length;D<j;D++){const ae=B[D];ve=_e[D];for(let re=0,H=ae.length;re<H;re++){const y=ne(ae[re],ve[re],J);S?O(y.x,y.y+E[u-1].y,E[u-1].x+I):O(y.x,y.y,f+I)}}}ie(),q();function ie(){const R=r.length/3;if(h){let G=0,I=K*G;for(let J=0;J<Je;J++){const D=We[J];P(D[2]+I,D[1]+I,D[0]+I)}G=u+m*2,I=K*G;for(let J=0;J<Je;J++){const D=We[J];P(D[0]+I,D[1]+I,D[2]+I)}}else{for(let G=0;G<Je;G++){const I=We[G];P(I[2],I[1],I[0])}for(let G=0;G<Je;G++){const I=We[G];P(I[0]+K*u,I[1]+K*u,I[2]+K*u)}}n.addGroup(R,r.length/3-R,0)}function q(){const R=r.length/3;let G=0;F($,G),G+=$.length;for(let I=0,J=B.length;I<J;I++){const D=B[I];F(D,G),G+=D.length}n.addGroup(R,r.length/3-R,1)}function F(R,G){let I=R.length;for(;--I>=0;){const J=I;let D=I-1;D<0&&(D=R.length-1);for(let j=0,ae=u+m*2;j<ae;j++){const re=K*j,H=K*(j+1),y=G+J+re,Se=G+D+re,Fe=G+D+H,C=G+J+H;W(y,Se,Fe,C)}}}function O(R,G,I){l.push(R),l.push(G),l.push(I)}function P(R,G,I){he(R),he(G),he(I);const J=r.length/3,D=w.generateTopUV(n,r,J-3,J-2,J-1);pe(D[0]),pe(D[1]),pe(D[2])}function W(R,G,I,J){he(R),he(G),he(J),he(G),he(I),he(J);const D=r.length/3,j=w.generateSideWallUV(n,r,D-6,D-3,D-2,D-1);pe(j[0]),pe(j[1]),pe(j[3]),pe(j[1]),pe(j[2]),pe(j[3])}function he(R){r.push(l[R*3+0]),r.push(l[R*3+1]),r.push(l[R*3+2])}function pe(R){s.push(R.x),s.push(R.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return xg(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];n.push(o)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new dl[r.type]().fromJSON(r)),new Wl(n,e.options)}}const gg={generateTopUV:function(i,e,t,n,r){const s=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new de(s,a),new de(o,l),new de(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],h=e[r*3],d=e[r*3+1],g=e[r*3+2],v=e[s*3],m=e[s*3+1],p=e[s*3+2];return Math.abs(o-u)<Math.abs(a-c)?[new de(a,1-l),new de(c,1-f),new de(h,1-g),new de(v,1-p)]:[new de(o,1-l),new de(u,1-f),new de(d,1-g),new de(m,1-p)]}};function xg(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Rr extends jt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,u=l+1,f=e/o,h=t/l,d=[],g=[],v=[],m=[];for(let p=0;p<u;p++){const w=p*h-a;for(let E=0;E<c;E++){const S=E*f-s;g.push(S,-w,0),v.push(0,0,1),m.push(E/o),m.push(1-p/l)}}for(let p=0;p<l;p++)for(let w=0;w<o;w++){const E=w+c*p,S=w+c*(p+1),b=w+1+c*(p+1),T=w+1+c*p;d.push(E,S,T),d.push(S,b,T)}this.setIndex(d),this.setAttribute("position",new bt(g,3)),this.setAttribute("normal",new bt(v,3)),this.setAttribute("uv",new bt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rr(e.width,e.height,e.widthSegments,e.heightSegments)}}class Xl extends jt{constructor(e=.5,t=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],u=[];let f=e;const h=(t-e)/r,d=new V,g=new de;for(let v=0;v<=r;v++){for(let m=0;m<=n;m++){const p=s+m/n*a;d.x=f*Math.cos(p),d.y=f*Math.sin(p),l.push(d.x,d.y,d.z),c.push(0,0,1),g.x=(d.x/t+1)/2,g.y=(d.y/t+1)/2,u.push(g.x,g.y)}f+=h}for(let v=0;v<r;v++){const m=v*(n+1);for(let p=0;p<n;p++){const w=p+m,E=w,S=w+n+1,b=w+n+2,T=w+1;o.push(E,S,T),o.push(S,b,T)}}this.setIndex(o),this.setAttribute("position",new bt(l,3)),this.setAttribute("normal",new bt(c,3)),this.setAttribute("uv",new bt(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xl(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ql extends jt{constructor(e=new Gl([new de(0,.5),new de(-.5,-.5),new de(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(o,l,u),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new bt(r,3)),this.setAttribute("normal",new bt(s,3)),this.setAttribute("uv",new bt(a,2));function c(u){const f=r.length/3,h=u.extractPoints(t);let d=h.shape;const g=h.holes;An.isClockWise(d)===!1&&(d=d.reverse());for(let m=0,p=g.length;m<p;m++){const w=g[m];An.isClockWise(w)===!0&&(g[m]=w.reverse())}const v=An.triangulateShape(d,g);for(let m=0,p=g.length;m<p;m++){const w=g[m];d=d.concat(w)}for(let m=0,p=d.length;m<p;m++){const w=d[m];r.push(w.x,w.y,0),s.push(0,0,1),a.push(w.x,w.y)}for(let m=0,p=v.length;m<p;
16m++){const w=v[m],E=w[0]+f,S=w[1]+f,b=w[2]+f;n.push(E,S,b),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return _g(t,e)}static fromJSON(e,t){const n=[];for(let r=0,s=e.shapes.length;r<s;r++){const a=t[e.shapes[r]];n.push(a)}return new ql(n,e.curveSegments)}}function _g(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,n=i.length;t<n;t++){const r=i[t];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e}function Cr(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(qc(r))r.isRenderTargetTexture?(Ze("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(qc(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function Zt(i){const e={};for(let t=0;t<i.length;t++){const n=Cr(i[t]);for(const r in n)e[r]=n[r]}return e}function qc(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function vg(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Xu(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:lt.workingColorSpace}const yg={clone:Cr,merge:Zt};var Sg=`void main() { 17 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 18}`,Mg=`void main() { 19 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 20}`;class zn extends Dr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Sg,this.fragmentShader=Mg,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Cr(e.uniforms),this.uniformsGroups=vg(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new at().setHex(r.value);break;case"v2":this.uniforms[n].value=new de().fromArray(r.value);break;case"v3":this.uniforms[n].value=new V().fromArray(r.value);break;case"v4":this.uniforms[n].value=new At().fromArray(r.value);break;case"m3":this.uniforms[n].value=new je().fromArray(r.value);break;
20case"m4":this.uniforms[n].value=new pt().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class bg extends zn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ln extends Dr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new at(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new at(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hl,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Mi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Eg extends Dr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Qp,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Tg extends Dr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Yc={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(jc(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!jc(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function jc(i){try{const e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class wg{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){o++,s===!1&&r.onStart!==void 0&&r.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,r.onProgress!==void 0&&r.onProgress(u,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){const f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,h=c.length;f<h;f+=2){const d=c[f],g=c[f+1];if(d.global&&(d.lastIndex=0),d.test(u))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Ag=new wg;class Yl{constructor(e){this.manager=e!==void 0?e:Ag,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Yl.DEFAULT_MATERIAL_NAME="__DEFAULT";const qn={};
vendor: 4,581 bytes, line 20
20class Rg extends Error{constructor(e,t){super(e),this.response=t}}class Cg extends Yl{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Yc.get(`file:${e}`);if(s!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0);return}if(qn[e]!==void 0){qn[e].push({onLoad:t,onProgress:n,onError:r});return}qn[e]=[],qn[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&Ze("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=qn[e],f=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=h?parseInt(h):0,g=d!==0;let v=0;const m=new ReadableStream({start(p){w();function w(){f.read().then(({done:E,value:S})=>{if(E)p.close();else{v+=S.byteLength;const b=new ProgressEvent("progress",{lengthComputable:g,loaded:v,total:d});for(let T=0,L=u.length;T<L;T++){const x=u[T];x.onProgress&&x.onProgress(b)}p.enqueue(S),w()}},E=>{p.error(E)})}}});return new Response(m)}else throw new Rg(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o==="")return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(o),h=f&&f[1]?f[1].toLowerCase():void 0,d=new TextDecoder(h);return c.arrayBuffer().then(g=>d.decode(g))}}}).then(c=>{Yc.add(`file:${e}`,c);const u=qn[e];delete qn[e];for(let f=0,h=u.length;f<h;f++){const d=u[f];d.onLoad&&d.onLoad(c)}}).catch(c=>{const u=qn[e];if(u===void 0)throw this.manager.itemError(e),c;delete qn[e];for(let f=0,h=u.length;f<h;f++){const d=u[f];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class qu extends kt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new at(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class Pg extends qu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(kt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new at(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const oo=new pt,$c=new V,Kc=new V;class Dg{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new de(512,512),this.mapType=fn,this.map=null,this.mapPass=null,this.matrix=new pt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fl,this._frameExtents=new de(1,1),this._viewportCount=1,this._viewports=[new At(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;$c.setFromMatrixPosition(e.matrixWorld),t.position.copy($c),Kc.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Kc),t.updateMatrixWorld(),oo.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(oo,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===is||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(oo)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.n
vendor: 4,221 bytes, line 20
20ormalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Os=new V,Fs=new ti,Pn=new V;class Yu extends kt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new pt,this.projectionMatrix=new pt,this.projectionMatrixInverse=new pt,this.coordinateSystem=Un,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Os,Fs,Pn),Pn.x===1&&Pn.y===1&&Pn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Os,Fs,Pn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Os,Fs,Pn),Pn.x===1&&Pn.y===1&&Pn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Os,Fs,Pn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const pi=new V,Zc=new de,Jc=new de;class xn extends Yu{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=fl*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan($s*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return fl*2*Math.atan(Math.tan($s*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){pi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(pi.x,pi.y).multiplyScalar(-e/pi.z),pi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(pi.x,pi.y).multiplyScalar(-e/pi.z)}getViewSize(e,t){return this.getViewBounds(e,Zc,Jc),t.subVectors(Jc,Zc)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan($s*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class jl extends Yu{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
20phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Lg extends Dg{constructor(){super(new jl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ig extends qu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(kt.DEFAULT_UP),this.updateMatrix(),this.target=new kt,this.shadow=new Lg}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}const lr=-90,cr=1;class Ng extends kt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new xn(lr,cr,e,t);r.layers=this.layers,this.add(r);const s=new xn(lr,cr,e,t);s.layers=this.layers,this.add(s);const a=new xn(lr,cr,e,t);a.layers=this.layers,this.add(a);const o=new xn(lr,cr,e,t);o.layers=this.layers,this.add(o);const l=new xn(lr,cr,e,t);l.layers=this.layers,this.add(l);const c=new xn(lr,cr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Un)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===is)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=v,e.setRenderTarget(n,5,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,h,d),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class Ug extends xn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const Qc=new pt;class Og{constructor(e,t,n=0,r=1/0){this.ray=new Ol(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Nl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ot("Raycaster:
20Unsupported camera type: "+t.type)}setFromXRController(e){return Qc.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Qc),this}intersectObject(e,t=!0,n=[]){return gl(e,this,n,t),n.sort(eh),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)gl(e[r],this,n,t);return n.sort(eh),n}}function eh(i,e){return i.distance-e.distance}function gl(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)gl(s[a],e,t,!0)}}class Fg{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Ze("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),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 e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class th{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=st(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(st(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const tc=class tc{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};tc.prototype.isMatrix2=!0;let nh=tc;const ih=new de;class ju{constructor(e=new de(1/0,1/0),t=new de(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=ih.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ih).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}class Ri{constructor(){this.type="ShapePath",this.color=new at,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new wr,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,a){return this.currentPath.bezierCurveTo(e,t,n,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1;const f=c.length;for(let h=0,d=f-1;h<f;d=h++){const g=c[h],v=c[d];g.y>l.y!=v.y>l.y&&l.x<(v.x-g.x)*(l.y-g.y)/(v.y-g.y)+g.x&&(u=!u)}return u}function t(l,c){const u=c.getCenter(new de);if(e(u,l))return u;const f=u.y,h=[],d=l.length;for(let g=0;g<d;g++){const v=l[g],m=l[(g+1)%d];if(v.y>f!=m.y>f){const p=v.x+(f-v.y)*(m.x-v.x)/(m.y-v.y);h.push(p)}}return h.length>1&&(h.sort((g,v)=>g-v),u.x=(h[0]+h[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Ze('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");const r=n==="nonzero"?l=>l!==0:l=>(l&1)!==0,s=[];for(const l of this.subPaths){const c=l.getPoints();if(c.length<3)continue;const u=An.area(c);if(u===0)continue;const f=new ju;for(let h=0;h<c.length;h++)f.expandByPoint(c[h]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){const c=s[l];let u=0;for(let f=l-1;f>=0;f--){const h=s[f];if(h.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,h.points)){c.container=h.exclude?h.container:h,u=h.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(const l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");const a=[],o=new Map;for(const l of s){if(l.exclude||l.role!=="outer")continue;const c=new Gl;c.curves=l.subPath.curves,a.push(c),o.set(l,c)}for(const l of s){if(l.exclude||l.role!=="hole")continue;const c=o.get(l.container);if(!c)continue;const u=new wr;u.curves=l.subPath.curves,c.holes.push(u)}return a}}class Bg extends bi{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Ze("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function rh(i,e,t,n){const r=zg(n);switch(t){case Tu:return i*e;case Al:return i*e/r.components*r.byteLength;case Rl:return i*e/r.components*r.byteLength;case Bi:return i*e*2/r.components*r.byteLength;case Cl:return i*e*2/r.components*r.byteLength;case wu:return i*e*3/r.components*r.byteLength;case wn:return i*e*4/r.components*r.byteLength;case Pl:return i*e*4/r.components*r.byteLength;case Xs:case qs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ys:case js:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Uo:case Fo:return Math.max(i,16)*Math.max(e,8)/4;case No:case Oo:return Math.max(i,8)*Math.max(e,8)/2;case Bo:case zo:case Ho:case Vo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ko:case aa:case Go:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Wo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Xo:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case qo:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Yo:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case jo:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case $o:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Ko:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Zo:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Jo:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Qo:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case el:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case tl:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case nl:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case il:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case rl:case sl:case al:return Math.ceil(i/4)*Math.ceil(e/4)*16;case ol:case ll:return Math.ceil(i/4)*Math.ceil(e/4)*8;case oa:case cl:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function zg(i){switch(i){case fn:case Su:return{byteLength:1,components:1};
vendor: 5,119 bytes, lines 20-83
20case ts:case Mu:case Qn:return{byteLength:2,components:1};case Tl:case wl:return{byteLength:2,components:4};case Bn:case El:case Tn:return{byteLength:4,components:1};case bu:case Eu:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:bl}}));typeof window<"u"&&(window.__THREE__?Ze("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=bl);/** 21 * @license 22 * Copyright 2010-2026 Three.js Authors 23 * SPDX-License-Identifier: MIT 24 */function $u(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function kg(i){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,f=c.byteLength,h=i.createBuffer();i.bindBuffer(l,h),i.bufferData(l,c,u),o.onUploadCallback();let d;if(c instanceof Float32Array)d=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)d=i.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?d=i.HALF_FLOAT:d=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)d=i.SHORT;else if(c instanceof Uint32Array)d=i.UNSIGNED_INT;else if(c instanceof Int32Array)d=i.INT;else if(c instanceof Int8Array)d=i.BYTE;else if(c instanceof Uint8Array)d=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)d=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function n(o,l,c){const u=l.array,f=l.updateRanges;if(i.bindBuffer(c,o),f.length===0)i.bufferSubData(c,0,u);else{f.sort((d,g)=>d.start-g.start);let h=0;for(let d=1;d<f.length;d++){const g=f[h],v=f[d];v.start<=g.start+g.count+1?g.count=Math.max(g.count,v.start+v.count-g.start):(++h,f[h]=v)}f.length=h+1;for(let d=0,g=f.length;d<g;d++){const v=f[d];i.bufferSubData(c,v.start*u.BYTES_PER_ELEMENT,u,v.start,v.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Hg=`#ifdef USE_ALPHAHASH 25 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 26#endif`,Vg=`#ifdef USE_ALPHAHASH 27 const float ALPHA_HASH_SCALE = 0.05; 28 float hash2D( vec2 value ) { 29 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 30 } 31 float hash3D( vec3 value ) { 32 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 33 } 34 float getAlphaHashThreshold( vec3 position ) { 35 float maxDeriv = max( 36 length( dFdx( position.xyz ) ), 37 length( dFdy( position.xyz ) ) 38 ); 39 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 40 vec2 pixScales = vec2( 41 exp2( floor( log2( pixScale ) ) ), 42 exp2( ceil( log2( pixScale ) ) ) 43 ); 44 vec2 alpha = vec2( 45 hash3D( floor( pixScales.x * position.xyz ) ), 46 hash3D( floor( pixScales.y * position.xyz ) ) 47 ); 48 float lerpFactor = fract( log2( pixScale ) ); 49 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 50 float a = min( lerpFactor, 1.0 - lerpFactor ); 51 vec3 cases = vec3( 52 x * x / ( 2.0 * a * ( 1.0 - a ) ), 53 ( x - 0.5 * a ) / ( 1.0 - a ), 54 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 55 ); 56 float threshold = ( x < ( 1.0 - a ) ) 57 ? ( ( x < a ) ? cases.x : cases.y ) 58 : cases.z; 59 return clamp( threshold , 1.0e-6, 1.0 ); 60 } 61#endif`,Gg=`#ifdef USE_ALPHAMAP 62 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 63#endif`,Wg=`#ifdef USE_ALPHAMAP 64 uniform sampler2D alphaMap; 65#endif`,Xg=`#ifdef USE_ALPHATEST 66 #ifdef ALPHA_TO_COVERAGE 67 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 68 if ( diffuseColor.a == 0.0 ) discard; 69 #else 70 if ( diffuseColor.a < alphaTest ) discard; 71 #endif 72#endif`,qg=`#ifdef USE_ALPHATEST 73 uniform float alphaTest; 74#endif`,Yg=`#ifdef USE_AOMAP 75 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 76 reflectedLight.indirectDiffuse *= ambientOcclusion; 77 #if defined( USE_CLEARCOAT ) 78 clearcoatSpecularIndirect *= ambientOcclusion; 79 #endif 80 #if defined( USE_SHEEN ) 81 sheenSpecularIndirect *= ambientOcclusion; 82 #endif 83 #if defined( USE_ENVMAP ) && defined( STANDARD )
84 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 85 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 86 #endif 87#endif`,jg=`#ifdef USE_AOMAP 88 uniform sampler2D aoMap; 89 uniform float aoMapIntensity; 90#endif`,$g=`#ifdef USE_BATCHING 91 #if ! defined( GL_ANGLE_multi_draw ) 92 #define gl_DrawID _gl_DrawID 93 uniform int _gl_DrawID; 94 #endif 95 uniform highp sampler2D batchingTexture; 96 uniform highp usampler2D batchingIdTexture; 97 mat4 getBatchingMatrix( const in float i ) { 98 int size = textureSize( batchingTexture, 0 ).x; 99 int j = int( i ) * 4; 100 int x = j % size; 101 int y = j / size; 102 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 103 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 104 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 105 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 106 return mat4( v1, v2, v3, v4 ); 107 } 108 float getIndirectIndex( const in int i ) { 109 int size = textureSize( batchingIdTexture, 0 ).x; 110 int x = i % size; 111 int y = i / size; 112 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 113 } 114#endif 115#ifdef USE_BATCHING_COLOR 116 uniform sampler2D batchingColorTexture; 117 vec4 getBatchingColor( const in float i ) { 118 int size = textureSize( batchingColorTexture, 0 ).x; 119 int j = int( i ); 120 int x = j % size; 121 int y = j / size; 122 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); 123 } 124#endif`,Kg=`#ifdef USE_BATCHING 125 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 126#endif`,Zg=`vec3 transformed = vec3( position ); 127#ifdef USE_ALPHAHASH 128 vPosition = vec3( position ); 129#endif`,Jg=`vec3 objectNormal = vec3( normal ); 130#ifdef USE_TANGENT 131 vec3 objectTangent = vec3( tangent.xyz ); 132#endif`,Qg=`float G_BlinnPhong_Implicit( ) { 133 return 0.25; 134} 135float D_BlinnPhong( const in float shininess, const in float dotNH ) { 136 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 137} 138vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 139 vec3 halfDir = normalize( lightDir + viewDir ); 140 float dotNH = saturate( dot( normal, halfDir ) ); 141 float dotVH = saturate( dot( viewDir, halfDir ) ); 142 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 143 float G = G_BlinnPhong_Implicit( ); 144 float D = D_BlinnPhong( shininess, dotNH ); 145 return F * ( G * D ); 146} // validated`,e0=`#ifdef USE_IRIDESCENCE 147 const mat3 XYZ_TO_REC709 = mat3( 148 3.2404542, -0.9692660, 0.0556434, 149 -1.5371385, 1.8760108, -0.2040259, 150 -0.4985314, 0.0415560, 1.0572252 151 ); 152 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 153 vec3 sqrtF0 = sqrt( fresnel0 ); 154 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 155 } 156 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 157 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 158 } 159 float IorToFresnel0( float transmittedIor, float incidentIor ) { 160 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 161 } 162 vec3 evalSensitivity( float OPD, vec3 shift ) { 163 float phase = 2.0 * PI * OPD * 1.0e-9; 164 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 165 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 166 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 167 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 168 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 169 xyz /= 1.0685e-7; 170 vec3 rgb = XYZ_TO_REC709 * xyz; 171 return rgb; 172 } 173 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 174 vec3 I; 175 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 176 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 177 float cosTheta2Sq = 1.0 - sinTheta2Sq; 178 if ( cosTheta2Sq < 0.0 ) { 179 return vec3( 1.0 ); 180 } 181 float cosTheta2 = sqrt( cosTheta2Sq ); 182 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
183 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 184 float T121 = 1.0 - R12; 185 float phi12 = 0.0; 186 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 187 float phi21 = PI - phi12; 188 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 189 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 190 vec3 phi23 = vec3( 0.0 ); 191 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 192 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 193 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 194 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 195 vec3 phi = vec3( phi21 ) + phi23; 196 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 197 vec3 r123 = sqrt( R123 ); 198 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 199 vec3 C0 = R12 + Rs; 200 I = C0; 201 vec3 Cm = Rs - T121; 202 for ( int m = 1; m <= 2; ++ m ) { 203 Cm *= r123; 204 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 205 I += Cm * Sm; 206 } 207 return max( I, vec3( 0.0 ) ); 208 } 209#endif`,t0=`#ifdef USE_BUMPMAP 210 uniform sampler2D bumpMap; 211 uniform float bumpScale; 212 vec2 dHdxy_fwd() { 213 vec2 dSTdx = dFdx( vBumpMapUv ); 214 vec2 dSTdy = dFdy( vBumpMapUv ); 215 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 216 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 217 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 218 return vec2( dBx, dBy ); 219 } 220 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 221 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 222 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 223 vec3 vN = surf_norm; 224 vec3 R1 = cross( vSigmaY, vN ); 225 vec3 R2 = cross( vN, vSigmaX ); 226 float fDet = dot( vSigmaX, R1 ) * faceDirection; 227 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 228 return normalize( abs( fDet ) * surf_norm - vGrad ); 229 } 230#endif`,n0=`#if NUM_CLIPPING_PLANES > 0 231 vec4 plane; 232 #ifdef ALPHA_TO_COVERAGE 233 float distanceToPlane, distanceGradient; 234 float clipOpacity = 1.0; 235 #pragma unroll_loop_start 236 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 237 plane = clippingPlanes[ i ]; 238 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 239 distanceGradient = fwidth( distanceToPlane ) / 2.0; 240 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 241 if ( clipOpacity == 0.0 ) discard; 242 } 243 #pragma unroll_loop_end 244 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 245 float unionClipOpacity = 1.0; 246 #pragma unroll_loop_start 247 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 248 plane = clippingPlanes[ i ]; 249 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 250 distanceGradient = fwidth( distanceToPlane ) / 2.0; 251 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 252 } 253 #pragma unroll_loop_end 254 clipOpacity *= 1.0 - unionClipOpacity; 255 #endif 256 diffuseColor.a *= clipOpacity; 257 if ( diffuseColor.a == 0.0 ) discard; 258 #else 259 #pragma unroll_loop_start 260 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 261 plane = clippingPlanes[ i ]; 262 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 263 } 264 #pragma unroll_loop_end 265 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 266 bool clipped = true; 267 #pragma unroll_loop_start 268 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 269 plane = clippingPlanes[ i ]; 270 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 271 } 272 #pragma unroll_loop_end 273 if ( clipped ) discard; 274 #endif 275 #endif 276#endif`,i0=`#if NUM_CLIPPING_PLANES > 0 277 varying vec3 vClipPosition; 278 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 279#endif`,r0=`#if NUM_CLIPPING_PLANES > 0 280 varying vec3 vClipPosition; 281#endif`,s0=`#if NUM_CLIPPING_PLANES > 0 282 vClipPosition = - mvPosition.xyz; 283#endif`,a0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 284 diffuseColor *= vColor; 285#endif`,o0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 286 varying vec4 vColor; 287#endif`,l0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 288 varying vec4 vColor; 289#endif`,c0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 290 vColor = vec4( 1.0 ); 291#endif 292#ifdef USE_COLOR_ALPHA 293 vColor *= color; 294#elif defined( USE_COLOR ) 295 vColor.rgb *= color; 296#endif 297#ifdef USE_INSTANCING_COLOR 298 vColor.rgb *= instanceColor.rgb; 299#endif 300#ifdef USE_BATCHING_COLOR 301 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 302#endif`,h0=`#define PI 3.141592653589793 303#define PI2 6.283185307179586 304#define PI_HALF 1.5707963267948966 305#define RECIPROCAL_PI 0.3183098861837907 306#define RECIPROCAL_PI2 0.15915494309189535 307#define EPSILON 1e-6 308#ifndef saturate 309#define saturate( a ) clamp( a, 0.0, 1.0 ) 310#endif 311#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 312float pow2( const in float x ) { return x*x; } 313vec3 pow2( const in vec3 x ) { return x*x; } 314float pow3( const in float x ) { return x*x*x; } 315float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 316float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 317float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 318highp float rand( const in vec2 uv ) { 319 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 320 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 321 return fract( sin( sn ) * c ); 322} 323#ifdef HIGH_PRECISION 324 float precisionSafeLength( vec3 v ) { return length( v ); } 325#else 326 float precisionSafeLength( vec3 v ) { 327 float maxComponent = max3( abs( v ) ); 328 return length( v / maxComponent ) * maxComponent; 329 } 330#endif 331struct IncidentLight { 332 vec3 color; 333 vec3 direction; 334 bool visible; 335}; 336struct ReflectedLight { 337 vec3 directDiffuse; 338 vec3 directSpecular; 339 vec3 indirectDiffuse; 340 vec3 indirectSpecular; 341}; 342#ifdef USE_ALPHAHASH 343 varying vec3 vPosition; 344#endif 345vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 346 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 347} 348#define inverseTransformDirection transformDirectionByInverseViewMatrix 349vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) { 350 return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz ); 351} 352vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) { 353 return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz ); 354} 355bool isPerspectiveMatrix( mat4 m ) { 356 return m[ 2 ][ 3 ] == - 1.0; 357} 358vec2 equirectUv( in vec3 dir ) { 359 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 360 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 361 return vec2( u, v ); 362}
363vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 364 return RECIPROCAL_PI * diffuseColor; 365} 366vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 367 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 368 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 369} 370float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 371 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 372 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 373} // validated`,u0=`#ifdef ENVMAP_TYPE_CUBE_UV 374 #define cubeUV_minMipLevel 4.0 375 #define cubeUV_minTileSize 16.0 376 float getFace( vec3 direction ) { 377 vec3 absDirection = abs( direction ); 378 float face = - 1.0; 379 if ( absDirection.x > absDirection.z ) { 380 if ( absDirection.x > absDirection.y ) 381 face = direction.x > 0.0 ? 0.0 : 3.0; 382 else 383 face = direction.y > 0.0 ? 1.0 : 4.0; 384 } else { 385 if ( absDirection.z > absDirection.y ) 386 face = direction.z > 0.0 ? 2.0 : 5.0; 387 else 388 face = direction.y > 0.0 ? 1.0 : 4.0; 389 } 390 return face; 391 } 392 vec2 getUV( vec3 direction, float face ) { 393 vec2 uv; 394 if ( face == 0.0 ) { 395 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 396 } else if ( face == 1.0 ) { 397 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 398 } else if ( face == 2.0 ) { 399 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 400 } else if ( face == 3.0 ) { 401 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 402 } else if ( face == 4.0 ) { 403 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 404 } else { 405 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 406 } 407 return 0.5 * ( uv + 1.0 ); 408 } 409 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 410 float face = getFace( direction ); 411 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 412 mipInt = max( mipInt, cubeUV_minMipLevel ); 413 float faceSize = exp2( mipInt ); 414 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 415 if ( face > 2.0 ) { 416 uv.y += faceSize; 417 face -= 3.0; 418 } 419 uv.x += face * faceSize; 420 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 421 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 422 uv.x *= CUBEUV_TEXEL_WIDTH; 423 uv.y *= CUBEUV_TEXEL_HEIGHT; 424 #ifdef texture2DGradEXT 425 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 426 #else 427 return texture2D( envMap, uv ).rgb; 428 #endif 429 } 430 #define cubeUV_r0 1.0 431 #define cubeUV_m0 - 2.0 432 #define cubeUV_r1 0.8 433 #define cubeUV_m1 - 1.0 434 #define cubeUV_r4 0.4 435 #define cubeUV_m4 2.0 436 #define cubeUV_r5 0.305 437 #define cubeUV_m5 3.0 438 #define cubeUV_r6 0.21 439 #define cubeUV_m6 4.0 440 float roughnessToMip( float roughness ) { 441 float mip = 0.0; 442 if ( roughness >= cubeUV_r1 ) { 443 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 444 } else if ( roughness >= cubeUV_r4 ) { 445 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 446 } else if ( roughness >= cubeUV_r5 ) { 447 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 448 } else if ( roughness >= cubeUV_r6 ) { 449 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 450 } else { 451 mip = - 2.0 * log2( 1.16 * roughness ); } 452 return mip; 453 } 454 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 455 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 456 float mipF = fract( mip ); 457 float mipInt = floor( mip ); 458 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 459 if ( mipF == 0.0 ) { 460 return vec4( color0, 1.0 ); 461 } else { 462 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 463 return vec4( mix( color0, color1, mipF ), 1.0 ); 464 } 465 } 466#endif`,f0=`vec3 transformedNormal = objectNormal; 467#ifdef USE_TANGENT 468 vec3 transformedTangent = objectTangent; 469#endif 470#ifdef USE_BATCHING 471 mat3 bm = mat3( batchingMatrix ); 472 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 473 transformedNormal = bm * transformedNormal; 474 #ifdef USE_TANGENT 475 transformedTangent = bm * transformedTangent; 476 #endif 477#endif 478#ifdef USE_INSTANCING 479 mat3 im = mat3( instanceMatrix ); 480 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 481 transformedNormal = im * transformedNormal; 482 #ifdef USE_TANGENT 483 transformedTangent = im * transformedTangent; 484 #endif 485#endif 486transformedNormal = normalMatrix * transformedNormal; 487#ifdef FLIP_SIDED 488 transformedNormal = - transformedNormal; 489#endif 490#ifdef USE_TANGENT 491 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 492#endif`,d0=`#ifdef USE_DISPLACEMENTMAP 493 uniform sampler2D displacementMap; 494 uniform float displacementScale; 495 uniform float displacementBias; 496#endif`,p0=`#ifdef USE_DISPLACEMENTMAP 497 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
497placementBias ); 498#endif`,m0=`#ifdef USE_EMISSIVEMAP 499 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 500 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 501 emissiveColor = sRGBTransferEOTF( emissiveColor ); 502 #endif 503 totalEmissiveRadiance *= emissiveColor.rgb; 504#endif`,g0=`#ifdef USE_EMISSIVEMAP 505 uniform sampler2D emissiveMap; 506#endif`,x0="gl_FragColor = linearToOutputTexel( gl_FragColor );",_0=`vec4 LinearTransferOETF( in vec4 value ) { 507 return value; 508} 509vec4 sRGBTransferEOTF( in vec4 value ) { 510 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 511} 512vec4 sRGBTransferOETF( in vec4 value ) { 513 return 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 ); 514}`,v0=`#ifdef USE_ENVMAP 515 #ifdef ENV_WORLDPOS 516 vec3 cameraToFrag; 517 if ( isOrthographic ) { 518 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 519 } else { 520 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 521 } 522 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 523 #ifdef ENVMAP_MODE_REFLECTION 524 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 525 #else 526 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 527 #endif 528 #else 529 vec3 reflectVec = vReflect; 530 #endif 531 #ifdef ENVMAP_TYPE_CUBE 532 vec4 envColor = textureCube( envMap, envMapRotation * reflectVec ); 533 #ifdef ENVMAP_BLENDING_MULTIPLY 534 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 535 #elif defined( ENVMAP_BLENDING_MIX ) 536 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 537 #elif defined( ENVMAP_BLENDING_ADD ) 538 outgoingLight += envColor.xyz * specularStrength * reflectivity; 539 #endif 540 #endif 541#endif`,y0=`#ifdef USE_ENVMAP 542 uniform float envMapIntensity; 543 uniform mat3 envMapRotation; 544 #ifdef ENVMAP_TYPE_CUBE 545 uniform samplerCube envMap; 546 #else 547 uniform sampler2D envMap; 548 #endif 549#endif`,S0=`#ifdef USE_ENVMAP 550 uniform float reflectivity; 551 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 552 #define ENV_WORLDPOS 553 #endif 554 #ifdef ENV_WORLDPOS 555 varying vec3 vWorldPosition; 556 uniform float refractionRatio; 557 #else 558 varying vec3 vReflect; 559 #endif 560#endif`,M0=`#ifdef USE_ENVMAP 561 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 562 #define ENV_WORLDPOS 563 #endif 564 #ifdef ENV_WORLDPOS 565 566 varying vec3 vWorldPosition; 567 #else 568 varying vec3 vReflect; 569 uniform float refractionRatio; 570 #endif 571#endif`,b0=`#ifdef USE_ENVMAP 572 #ifdef ENV_WORLDPOS 573 vWorldPosition = worldPosition.xyz; 574 #else 575 vec3 cameraToVertex; 576 if ( isOrthographic ) { 577 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 578 } else {
579 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 580 } 581 vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 582 #ifdef ENVMAP_MODE_REFLECTION 583 vReflect = reflect( cameraToVertex, worldNormal ); 584 #else 585 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 586 #endif 587 #endif 588#endif`,E0=`#ifdef USE_FOG 589 vFogDepth = - mvPosition.z; 590#endif`,T0=`#ifdef USE_FOG 591 varying float vFogDepth; 592#endif`,w0=`#ifdef USE_FOG 593 #ifdef FOG_EXP2 594 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 595 #else 596 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 597 #endif 598 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 599#endif`,A0=`#ifdef USE_FOG 600 uniform vec3 fogColor; 601 varying float vFogDepth; 602 #ifdef FOG_EXP2 603 uniform float fogDensity; 604 #else 605 uniform float fogNear; 606 uniform float fogFar; 607 #endif 608#endif`,R0=`#ifdef USE_GRADIENTMAP 609 uniform sampler2D gradientMap; 610#endif 611vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 612 float dotNL = dot( normal, lightDirection ); 613 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 614 #ifdef USE_GRADIENTMAP 615 return vec3( texture2D( gradientMap, coord ).r ); 616 #else 617 vec2 fw = fwidth( coord ) * 0.5; 618 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 619 #endif 620}`,C0=`#ifdef USE_LIGHTMAP 621 uniform sampler2D lightMap; 622 uniform float lightMapIntensity; 623#endif`,P0=`LambertMaterial material; 624material.diffuseColor = diffuseColor.rgb; 625material.specularStrength = specularStrength;`,D0=`varying vec3 vViewPosition; 626struct LambertMaterial { 627 vec3 diffuseColor; 628 float specularStrength; 629}; 630void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 631 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 632 vec3 irradiance = dotNL * directLight.color; 633 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 634} 635void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 636 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 637} 638#define RE_Direct RE_Direct_Lambert 639#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,L0=`uniform bool receiveShadow; 640uniform vec3 ambientLightColor; 641#if defined( USE_LIGHT_PROBES ) 642 uniform vec3 lightProbe[ 9 ]; 643#endif 644vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 645 float x = normal.x, y = normal.y, z = normal.z; 646 vec3 result = shCoefficients[ 0 ] * 0.886227; 647 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 648 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 649 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 650 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 651 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 652 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 653 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 654 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 655 return result; 656} 657vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 658 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 659 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 660 return irradiance; 661} 662vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 663 vec3 irradiance = ambientLightColor; 664 return irradiance; 665} 666float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 667 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 668 if ( cutoffDistance > 0.0 ) { 669 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 670 } 671 return distanceFalloff; 672} 673float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 674 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 675} 676#if NUM_DIR_LIGHTS > 0 677 struct DirectionalLight { 678 vec3 direction; 679 vec3 color; 680 }; 681 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 682 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 683 light.color = directionalLight.color; 684 light.direction = directionalLight.direction; 685 light.visible = true; 686 } 687#endif 688#if NUM_POINT_LIGHTS > 0 689 struct PointLight { 690 vec3 position; 691 vec3 color; 692 float distance; 693 float decay; 694 }; 695 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 696 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 697 vec3 lVector = pointLight.position - geometryPosition; 698 light.direction = normalize( lVector ); 699 float lightDistance = length( lVector ); 700 light.color = pointLight.color; 701 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 702 light.visible = ( light.color != vec3( 0.0 ) ); 703 } 704#endif
705#if NUM_SPOT_LIGHTS > 0 706 struct SpotLight { 707 vec3 position; 708 vec3 direction; 709 vec3 color; 710 float distance; 711 float decay; 712 float coneCos; 713 float penumbraCos; 714 }; 715 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 716 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 717 vec3 lVector = spotLight.position - geometryPosition; 718 light.direction = normalize( lVector ); 719 float angleCos = dot( light.direction, spotLight.direction ); 720 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 721 if ( spotAttenuation > 0.0 ) { 722 float lightDistance = length( lVector ); 723 light.color = spotLight.color * spotAttenuation; 724 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 725 light.visible = ( light.color != vec3( 0.0 ) ); 726 } else { 727 light.color = vec3( 0.0 ); 728 light.visible = false; 729 } 730 } 731#endif 732#if NUM_RECT_AREA_LIGHTS > 0 733 struct RectAreaLight { 734 vec3 color; 735 vec3 position; 736 vec3 halfWidth; 737 vec3 halfHeight; 738 }; 739 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 740 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 741#endif 742#if NUM_HEMI_LIGHTS > 0 743 struct HemisphereLight { 744 vec3 direction; 745 vec3 skyColor; 746 vec3 groundColor; 747 }; 748 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 749 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 750 float dotNL = dot( normal, hemiLight.direction ); 751 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 752 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 753 return irradiance; 754 } 755#endif 756#include <lightprobes_pars_fragment>`,I0=`#ifdef USE_ENVMAP 757 vec3 getIBLIrradiance( const in vec3 normal ) { 758 #ifdef ENVMAP_TYPE_CUBE_UV 759 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 760 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 761 return PI * envMapColor.rgb * envMapIntensity; 762 #else 763 return vec3( 0.0 ); 764 #endif 765 } 766 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 767 #ifdef ENVMAP_TYPE_CUBE_UV 768 vec3 reflectVec = reflect( - viewDir, normal ); 769 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 770 reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix ); 771 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 772 return envMapColor.rgb * envMapIntensity; 773 #else 774 return vec3( 0.0 ); 775 #endif 776 } 777 #ifdef USE_ANISOTROPY 778 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 779 #ifdef ENVMAP_TYPE_CUBE_UV 780 vec3 bentNormal = cross( bitangent, viewDir ); 781 bentNormal = normalize( cross( bentNormal, bitangent ) ); 782 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 783 return getIBLRadiance( viewDir, bentNormal, roughness ); 784 #else 785 return vec3( 0.0 ); 786 #endif 787 } 788 #endif 789#endif`,N0=`ToonMaterial material; 790material.diffuseColor = diffuseColor.rgb;`,U0=`varying vec3 vViewPosition; 791struct ToonMaterial { 792 vec3 diffuseColor; 793}; 794void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 795 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 796 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 797} 798void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 799 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 800} 801#define RE_Direct RE_Direct_Toon 802#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,O0=`BlinnPhongMaterial material; 803material.diffuseColor = diffuseColor.rgb; 804material.specularColor = specular; 805material.specularShininess = shininess; 806material.specularStrength = specularStrength;`,F0=`varying vec3 vViewPosition; 807struct BlinnPhongMaterial { 808 vec3 diffuseColor; 809 vec3 specularColor; 810 float specularShininess; 811 float specularStrength; 812}; 813void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
814 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 815 vec3 irradiance = dotNL * directLight.color; 816 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 817 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 818} 819void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 820 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 821} 822#define RE_Direct RE_Direct_BlinnPhong 823#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,B0=`PhysicalMaterial material; 824material.diffuseColor = diffuseColor.rgb; 825material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 826material.metalness = metalnessFactor; 827vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 828float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 829material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 830material.roughness = min( material.roughness, 1.0 ); 831#ifdef IOR 832 material.ior = ior; 833 #ifdef USE_SPECULAR 834 float specularIntensityFactor = specularIntensity; 835 vec3 specularColorFactor = specularColor; 836 #ifdef USE_SPECULAR_COLORMAP 837 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 838 #endif 839 #ifdef USE_SPECULAR_INTENSITYMAP 840 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 841 #endif 842 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 843 #else 844 float specularIntensityFactor = 1.0; 845 vec3 specularColorFactor = vec3( 1.0 ); 846 material.specularF90 = 1.0; 847 #endif 848 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 849 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 850#else 851 material.specularColor = vec3( 0.04 ); 852 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 853 material.specularF90 = 1.0; 854#endif 855#ifdef USE_CLEARCOAT 856 material.clearcoat = clearcoat; 857 material.clearcoatRoughness = clearcoatRoughness; 858 material.clearcoatF0 = vec3( 0.04 ); 859 material.clearcoatF90 = 1.0; 860 #ifdef USE_CLEARCOATMAP 861 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 862 #endif 863 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 864 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 865 #endif 866 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 867 material.clearcoatRoughness += geometryRoughness; 868 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 869#endif 870#ifdef USE_DISPERSION 871 material.dispersion = dispersion; 872#endif 873#ifdef USE_IRIDESCENCE 874 material.iridescence = iridescence; 875 material.iridescenceIOR = iridescenceIOR; 876 #ifdef USE_IRIDESCENCEMAP 877 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 878 #endif 879 #ifdef USE_IRIDESCENCE_THICKNESSMAP 880 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 881 #else 882 material.iridescenceThickness = iridescenceThicknessMaximum; 883 #endif 884#endif 885#ifdef USE_SHEEN 886 material.sheenColor = sheenColor; 887 #ifdef USE_SHEEN_COLORMAP 888 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 889 #endif 890 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 891 #ifdef USE_SHEEN_ROUGHNESSMAP 892 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 893 #endif 894#endif 895#ifdef USE_ANISOTROPY 896 #ifdef USE_ANISOTROPYMAP 897 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 898 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 899 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 900 #else 901 vec2 anisotropyV = anisotropyVector; 902 #endif 903 material.anisotropy = length( anisotropyV ); 904 if( material.anisotropy == 0.0 ) { 905 anisotropyV = vec2( 1.0, 0.0 ); 906 } else { 907 anisotropyV /= material.anisotropy; 908 material.anisotropy = saturate( material.anisotropy ); 909 } 910 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
911 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 912 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 913#endif`,z0=`uniform sampler2D dfgLUT; 914struct PhysicalMaterial { 915 vec3 diffuseColor; 916 vec3 diffuseContribution; 917 vec3 specularColor; 918 vec3 specularColorBlended; 919 float roughness; 920 float metalness; 921 float specularF90; 922 float dispersion; 923 #ifdef USE_CLEARCOAT 924 float clearcoat; 925 float clearcoatRoughness; 926 vec3 clearcoatF0; 927 float clearcoatF90; 928 #endif 929 #ifdef USE_IRIDESCENCE 930 float iridescence; 931 float iridescenceIOR; 932 float iridescenceThickness; 933 vec3 iridescenceFresnel; 934 vec3 iridescenceF0; 935 vec3 iridescenceFresnelDielectric; 936 vec3 iridescenceFresnelMetallic; 937 #endif 938 #ifdef USE_SHEEN 939 vec3 sheenColor; 940 float sheenRoughness; 941 #endif 942 #ifdef IOR 943 float ior; 944 #endif 945 #ifdef USE_TRANSMISSION 946 float transmission; 947 float transmissionAlpha; 948 float thickness; 949 float attenuationDistance; 950 vec3 attenuationColor; 951 #endif 952 #ifdef USE_ANISOTROPY 953 float anisotropy; 954 float alphaT; 955 vec3 anisotropyT; 956 vec3 anisotropyB; 957 #endif 958}; 959vec3 clearcoatSpecularDirect = vec3( 0.0 ); 960vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 961vec3 sheenSpecularDirect = vec3( 0.0 ); 962vec3 sheenSpecularIndirect = vec3(0.0 ); 963vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 964 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 965 float x2 = x * x; 966 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 967 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 968} 969float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 970 float a2 = pow2( alpha ); 971 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 972 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 973 return 0.5 / max( gv + gl, EPSILON ); 974} 975float D_GGX( const in float alpha, const in float dotNH ) { 976 float a2 = pow2( alpha ); 977 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 978 return RECIPROCAL_PI * a2 / pow2( denom ); 979} 980#ifdef USE_ANISOTROPY 981 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 982 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 983 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 984 return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 984-1143
984; 985 } 986 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 987 float a2 = alphaT * alphaB; 988 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 989 highp float v2 = dot( v, v ); 990 float w2 = a2 / v2; 991 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 992 } 993#endif 994#ifdef USE_CLEARCOAT 995 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 996 vec3 f0 = material.clearcoatF0; 997 float f90 = material.clearcoatF90; 998 float roughness = material.clearcoatRoughness; 999 float alpha = pow2( roughness ); 1000 vec3 halfDir = normalize( lightDir + viewDir ); 1001 float dotNL = saturate( dot( normal, lightDir ) ); 1002 float dotNV = saturate( dot( normal, viewDir ) ); 1003 float dotNH = saturate( dot( normal, halfDir ) ); 1004 float dotVH = saturate( dot( viewDir, halfDir ) ); 1005 vec3 F = F_Schlick( f0, f90, dotVH ); 1006 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1007 float D = D_GGX( alpha, dotNH ); 1008 return F * ( V * D ); 1009 } 1010#endif 1011vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1012 vec3 f0 = material.specularColorBlended; 1013 float f90 = material.specularF90; 1014 float roughness = material.roughness; 1015 float alpha = pow2( roughness ); 1016 vec3 halfDir = normalize( lightDir + viewDir ); 1017 float dotNL = saturate( dot( normal, lightDir ) ); 1018 float dotNV = saturate( dot( normal, viewDir ) ); 1019 float dotNH = saturate( dot( normal, halfDir ) ); 1020 float dotVH = saturate( dot( viewDir, halfDir ) ); 1021 vec3 F = F_Schlick( f0, f90, dotVH ); 1022 #ifdef USE_IRIDESCENCE 1023 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1024 #endif 1025 #ifdef USE_ANISOTROPY 1026 float dotTL = dot( material.anisotropyT, lightDir ); 1027 float dotTV = dot( material.anisotropyT, viewDir ); 1028 float dotTH = dot( material.anisotropyT, halfDir ); 1029 float dotBL = dot( material.anisotropyB, lightDir ); 1030 float dotBV = dot( material.anisotropyB, viewDir ); 1031 float dotBH = dot( material.anisotropyB, halfDir ); 1032 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1033 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1034 #else 1035 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1036 float D = D_GGX( alpha, dotNH ); 1037 #endif 1038 return F * ( V * D ); 1039} 1040vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1041 const float LUT_SIZE = 64.0; 1042 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1043 const float LUT_BIAS = 0.5 / LUT_SIZE; 1044 float dotNV = saturate( dot( N, V ) ); 1045 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1046 uv = uv * LUT_SCALE + LUT_BIAS; 1047 return uv; 1048} 1049float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1050 float l = length( f ); 1051 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1052} 1053vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1054 float x = dot( v1, v2 ); 1055 float y = abs( x ); 1056 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1057 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1058 float v = a / b; 1059 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1060 return cross( v1, v2 ) * theta_sintheta; 1061} 1062vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1063 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1064 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1065 vec3 lightNormal = cross( v1, v2 ); 1066 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1067 vec3 T1, T2; 1068 T1 = normalize( V - N * dot( V, N ) ); 1069 T2 = - cross( N, T1 ); 1070 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1071 vec3 coords[ 4 ]; 1072 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1073 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1074 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1075 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1076 coords[ 0 ] = normalize( coords[ 0 ] ); 1077 coords[ 1 ] = normalize( coords[ 1 ] ); 1078 coords[ 2 ] = normalize( coords[ 2 ] ); 1079 coords[ 3 ] = normalize( coords[ 3 ] ); 1080 vec3 vectorFormFactor = vec3( 0.0 ); 1081 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1082 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1083 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1084 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1085 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1086 return vec3( result ); 1087} 1088#if defined( USE_SHEEN ) 1089float D_Charlie( float roughness, float dotNH ) { 1090 float alpha = pow2( roughness ); 1091 float invAlpha = 1.0 / alpha; 1092 float cos2h = dotNH * dotNH; 1093 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1094 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1095} 1096float V_Neubelt( float dotNV, float dotNL ) { 1097 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1098} 1099vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1100 vec3 halfDir = normalize( lightDir + viewDir ); 1101 float dotNL = saturate( dot( normal, lightDir ) ); 1102 float dotNV = saturate( dot( normal, viewDir ) ); 1103 float dotNH = saturate( dot( normal, halfDir ) ); 1104 float D = D_Charlie( sheenRoughness, dotNH ); 1105 float V = V_Neubelt( dotNV, dotNL ); 1106 return sheenColor * ( D * V ); 1107} 1108#endif 1109float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1110 float dotNV = saturate( dot( normal, viewDir ) ); 1111 float r2 = roughness * roughness; 1112 float rInv = 1.0 / ( roughness + 0.1 ); 1113 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1114 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1115 float DG = exp( a * dotNV + b ); 1116 return saturate( DG ); 1117} 1118vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1119 float dotNV = saturate( dot( normal, viewDir ) ); 1120 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1121 return specularColor * fab.x + specularF90 * fab.y; 1122} 1123#ifdef USE_IRIDESCENCE 1124void 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 ) { 1125#else 1126void 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 ) { 1127#endif 1128 float dotNV = saturate( dot( normal, viewDir ) ); 1129 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1130 #ifdef USE_IRIDESCENCE 1131 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1132 #else 1133 vec3 Fr = specularColor; 1134 #endif 1135 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1136 float Ess = fab.x + fab.y; 1137 float Ems = 1.0 - Ess; 1138 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1139 singleScatter += FssEss; 1140 multiScatter += Fms * Ems; 1141} 1142vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1143 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1144-1273
1144 float dotNL = saturate( dot( normal, lightDir ) ); 1145 float dotNV = saturate( dot( normal, viewDir ) ); 1146 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1147 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1148 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1149 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1150 float Ess_V = dfgV.x + dfgV.y; 1151 float Ess_L = dfgL.x + dfgL.y; 1152 float Ems_V = 1.0 - Ess_V; 1153 float Ems_L = 1.0 - Ess_L; 1154 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1155 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1156 float compensationFactor = Ems_V * Ems_L; 1157 vec3 multiScatter = Fms * compensationFactor; 1158 return singleScatter + multiScatter; 1159} 1160#if NUM_RECT_AREA_LIGHTS > 0 1161 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1162 vec3 normal = geometryNormal; 1163 vec3 viewDir = geometryViewDir; 1164 vec3 position = geometryPosition; 1165 vec3 lightPos = rectAreaLight.position; 1166 vec3 halfWidth = rectAreaLight.halfWidth; 1167 vec3 halfHeight = rectAreaLight.halfHeight; 1168 vec3 lightColor = rectAreaLight.color; 1169 float roughness = material.roughness; 1170 vec3 rectCoords[ 4 ]; 1171 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1172 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1173 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1174 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1175 vec4 t1 = texture2D( ltc_1, uv ); 1176 vec4 t2 = texture2D( ltc_2, uv ); 1177 mat3 mInv = mat3( 1178 vec3( t1.x, 0, t1.y ), 1179 vec3( 0, 1, 0 ), 1180 vec3( t1.z, 0, t1.w ) 1181 ); 1182 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 1183 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1184 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1185 #ifdef USE_CLEARCOAT 1186 vec3 Ncc = geometryClearcoatNormal; 1187 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 1188 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 1189 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 1190 mat3 mInvClearcoat = mat3( 1191 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 1192 vec3( 0, 1, 0 ), 1193 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 1194 ); 1195 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 1196 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 1197 #endif 1198 } 1199#endif 1200void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1201 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1202 vec3 irradiance = dotNL * directLight.color; 1203 #ifdef USE_CLEARCOAT 1204 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1205 vec3 ccIrradiance = dotNLcc * directLight.color; 1206 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1207 #endif 1208 #ifdef USE_SHEEN 1209 1210 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1211 1212 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1213 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1214 1215 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1216 1217 irradiance *= sheenEnergyComp; 1218 1219 #endif 1220 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1221 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1222} 1223void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1224 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1225 #ifdef USE_SHEEN 1226 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1227 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1228 diffuse *= sheenEnergyComp; 1229 #endif 1230 reflectedLight.indirectDiffuse += diffuse; 1231} 1232void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1233 #ifdef USE_CLEARCOAT 1234 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1235 #endif 1236 #ifdef USE_SHEEN 1237 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1238 #endif 1239 vec3 singleScatteringDielectric = vec3( 0.0 ); 1240 vec3 multiScatteringDielectric = vec3( 0.0 ); 1241 vec3 singleScatteringMetallic = vec3( 0.0 ); 1242 vec3 multiScatteringMetallic = vec3( 0.0 ); 1243 #ifdef USE_IRIDESCENCE 1244 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1245 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1246 #else 1247 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1248 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1249 #endif 1250 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1251 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1252 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1253 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1254 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1255 vec3 indirectSpecular = radiance * singleScattering; 1256 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1257 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1258 #ifdef USE_SHEEN 1259 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1260 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1261 indirectSpecular *= sheenEnergyComp; 1262 indirectDiffuse *= sheenEnergyComp; 1263 #endif 1264 reflectedLight.indirectSpecular += indirectSpecular; 1265 reflectedLight.indirectDiffuse += indirectDiffuse; 1266} 1267#define RE_Direct RE_Direct_Physical 1268#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1269#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1270#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1271float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1272 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1273}`,
1273k0=` 1274vec3 geometryPosition = - vViewPosition; 1275vec3 geometryNormal = normal; 1276vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1277vec3 geometryClearcoatNormal = vec3( 0.0 ); 1278#ifdef USE_CLEARCOAT 1279 geometryClearcoatNormal = clearcoatNormal; 1280#endif 1281#ifdef USE_IRIDESCENCE 1282 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1283 if ( material.iridescenceThickness == 0.0 ) { 1284 material.iridescence = 0.0; 1285 } else { 1286 material.iridescence = saturate( material.iridescence ); 1287 } 1288 if ( material.iridescence > 0.0 ) { 1289 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1290 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1291 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1292 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1293 } 1294#endif 1295IncidentLight directLight; 1296#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1297 PointLight pointLight; 1298 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1299 PointLightShadow pointLightShadow; 1300 #endif 1301 #pragma unroll_loop_start 1302 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1303 pointLight = pointLights[ i ]; 1304 getPointLightInfo( pointLight, geometryPosition, directLight ); 1305 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1306 pointLightShadow = pointLightShadows[ i ]; 1307 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1308 #endif 1309 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1310 } 1311 #pragma unroll_loop_end 1312#endif 1313#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1314 SpotLight spotLight; 1315 vec4 spotColor; 1316 vec3 spotLightCoord; 1317 bool inSpotLightMap; 1318 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1319 SpotLightShadow spotLightShadow; 1320 #endif 1321 #pragma unroll_loop_start 1322 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1323 spotLight = spotLights[ i ]; 1324 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1325 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1326 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1327 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1328 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1329 #else 1330 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1331 #endif 1332 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1333 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1334 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1335 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1336 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1337 #endif 1338 #undef SPOT_LIGHT_MAP_INDEX 1339 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1340 spotLightShadow = spotLightShadows[ i ]; 1341 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1342 #endif 1343 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1344 } 1345 #pragma unroll_loop_end 1346#endif 1347#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1348 DirectionalLight directionalLight; 1349 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1350 DirectionalLightShadow directionalLightShadow; 1351 #endif 1352 #pragma unroll_loop_start 1353 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1354 directionalLight = directionalLights[ i ]; 1355 getDirectionalLightInfo( directionalLight, directLight ); 1356 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1357 directionalLightShadow = directionalLightShadows[ i ]; 1358 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1359 #endif 1360 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1361 } 1362 #pragma unroll_loop_end 1363#endif 1364#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1365 RectAreaLight rectAreaLight; 1366 #pragma unroll_loop_start 1367 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1368 rectAreaLight = rectAreaLights[ i ]; 1369 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1370 } 1371 #pragma unroll_loop_end 1372#endif 1373#if defined( RE_IndirectDiffuse ) 1374 vec3 iblIrradiance = vec3( 0.0 ); 1375 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1376 #if defined( USE_LIGHT_PROBES ) 1377 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1378 #endif 1379 #if ( NUM_HEMI_LIGHTS > 0 ) 1380 #pragma unroll_loop_start 1381 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1382 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1383 } 1384 #pragma unroll_loop_end 1385 #endif 1386 #ifdef USE_LIGHT_PROBES_GRID 1387 vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; 1388 vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix ); 1389 irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); 1390 #endif 1391#endif 1392#if defined( RE_IndirectSpecular ) 1393 vec3 radiance = vec3( 0.0 ); 1394 vec3 clearcoatRadiance = vec3( 0.0 ); 1395#endif`,H0=`#if defined( RE_IndirectDiffuse ) 1396 #ifdef USE_LIGHTMAP 1397 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1398 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1399 irradiance += lightMapIrradiance; 1400 #endif 1401 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 1402 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 1403 iblIrradiance += getIBLIrradiance( geometryNormal ); 1404 #endif 1405 #endif 1406#endif 1407#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1408 #ifdef USE_ANISOTROPY 1409 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1410 #else 1411 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1412 #endif 1413 #ifdef USE_CLEARCOAT 1414 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1415 #endif 1416#endif`,V0=`#if defined( RE_IndirectDiffuse ) 1417 #if defined( LAMBERT ) || defined( PHONG ) 1418 irradiance += iblIrradiance; 1419 #endif 1420 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1421#endif 1422#if defined( RE_IndirectSpecular ) 1423 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1424#endif`,G0=`#ifdef USE_LIGHT_PROBES_GRID 1425uniform highp sampler3D probesSH; 1426uniform vec3 probesMin; 1427uniform vec3 probesMax; 1428uniform vec3 probesResolution; 1429vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { 1430 vec3 res = probesResolution; 1431 vec3 gridRange = probesMax - probesMin; 1432 vec3 resMinusOne = res - 1.0; 1433 vec3 probeSpacing = gridRange / resMinusOne; 1434 vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; 1435 vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); 1436 uvw = uvw * resMinusOne / res + 0.5 / res; 1437 float nz = res.z; 1438 float paddedSlices = nz + 2.0; 1439 float atlasDepth = 7.0 * paddedSlices; 1440 float uvZBase = uvw.z * nz + 1.0; 1441 vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); 1442 vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); 1443 vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); 1444 vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); 1445 vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); 1446 vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); 1447 vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); 1448 vec3 c0 = s0.xyz; 1449 vec3 c1 = vec3( s0.w, s1.xy ); 1450 vec3 c2 = vec3( s1.zw, s2.x ); 1451 vec3 c3 = s2.yzw; 1452 vec3 c4 = s3.xyz; 1453 vec3 c5 = vec3( s3.w, s4.xy ); 1454 vec3 c6 = vec3( s4.zw, s5.x ); 1455 vec3 c7 = s5.yzw; 1456 vec3 c8 = s6.xyz; 1457 float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; 1458 vec3 result = c0 * 0.886227; 1459 result += c1 * 2.0 * 0.511664 * y; 1460 result += c2 * 2.0 * 0.511664 * z; 1461 result += c3 * 2.0 * 0.511664 * x; 1462 result += c4 * 2.0 * 0.429043 * x * y; 1463 result += c5 * 2.0 * 0.429043 * y * z; 1464 result += c6 * ( 0.743125 * z * z - 0.247708 ); 1465 result += c7 * 2.0 * 0.429043 * x * z; 1466 result += c8 * 0.429043 * ( x * x - y * y ); 1467 return max( result, vec3( 0.0 ) ); 1468} 1469#endif`,W0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1470 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1471#endif`,X0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1472 uniform float logDepthBufFC; 1473 varying float vFragDepth; 1474 varying float vIsPerspective; 1475#endif`,q0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1476 varying float vFragDepth; 1477 varying float vIsPerspective; 1478#endif`,Y0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1479 vFragDepth = 1.0 + gl_Position.w; 1480 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1481#endif`,j0=`#ifdef USE_MAP 1482 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1483 #ifdef DECODE_VIDEO_TEXTURE 1484 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1485 #endif 1486 diffuseColor *= sampledDiffuseColor; 1487#endif`,$0=`#ifdef USE_MAP 1488 uniform sampler2D map; 1489#endif`,K0=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1490 #if defined( USE_POINTS_UV ) 1491 vec2 uv = vUv; 1492 #else 1493 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1494 #endif 1495#endif 1496#ifdef USE_MAP 1497 diffuseColor *= texture2D( map, uv ); 1498#endif 1499#ifdef USE_ALPHAMAP 1500 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1501#endif`,Z0=`#if defined( USE_POINTS_UV ) 1502 varying vec2 vUv; 1503#else 1504 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1505 uniform mat3 uvTransform; 1506 #endif 1507#endif 1508#ifdef USE_MAP 1509 uniform sampler2D map; 1510#endif 1511#ifdef USE_ALPHAMAP 1512 uniform sampler2D alphaMap; 1513#endif`,J0=`float metalnessFactor = metalness; 1514#ifdef USE_METALNESSMAP 1515 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1516 metalnessFactor *= texelMetalness.b; 1517#endif`,Q0=`#ifdef USE_METALNESSMAP 1518 uniform sampler2D metalnessMap; 1519#endif`,ex=`#ifdef USE_INSTANCING_MORPH 1520 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1521 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1522 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1523 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1524 } 1525#endif`,tx=`#if defined( USE_MORPHCOLORS ) 1526 vColor *= morphTargetBaseInfluence; 1527 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1528 #if defined( USE_COLOR_ALPHA ) 1529 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1530 #elif defined( USE_COLOR ) 1531 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1532 #endif 1533 } 1534#endif`,nx=`#ifdef USE_MORPHNORMALS 1535 objectNormal *= morphTargetBaseInfluence; 1536 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1537 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1538 } 1539#endif`,ix=`#ifdef USE_MORPHTARGETS 1540 #ifndef USE_INSTANCING_MORPH 1541 uniform float morphTargetBaseInfluence; 1542 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1543 #endif 1544 uniform sampler2DArray morphTargetsTexture; 1545 uniform ivec2 morphTargetsTextureSize; 1546 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1547 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1548 int y = texelIndex / morphTargetsTextureSize.x; 1549 int x = texelIndex - y * morphTargetsTextureSize.x; 1550 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1551 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1552 } 1553#endif`,rx=`#ifdef USE_MORPHTARGETS 1554 transformed *= morphTargetBaseInfluence; 1555 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1556 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1557 } 1558#endif`,sx=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1559#ifdef FLAT_SHADED 1560 vec3 fdx = dFdx( vViewPosition ); 1561 vec3 fdy = dFdy( vViewPosition ); 1562 vec3 normal = normalize( cross( fdx, fdy ) ); 1563#else 1564 vec3 normal = normalize( vNormal ); 1565 #ifdef DOUBLE_SIDED 1566 normal *= faceDirection; 1567 #endif 1568#endif 1569#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1570 #ifdef USE_TANGENT 1571 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1572 #else 1573 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1574 #if defined( USE_NORMALMAP ) 1575 vNormalMapUv 1576 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1577 vClearcoatNormalMapUv 1578 #else 1579 vUv 1580 #endif 1581 ); 1582 #endif 1583 #ifdef DOUBLE_SIDED 1584 tbn[0] *= faceDirection; 1585 tbn[1] *= faceDirection; 1586 #endif 1587#endif 1588#ifdef USE_CLEARCOAT_NORMALMAP 1589 #ifdef USE_TANGENT 1590 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1591 #else 1592 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1593 #endif 1594 #ifdef DOUBLE_SIDED 1595 tbn2[0] *= faceDirection; 1596 tbn2[1] *= faceDirection; 1597 #endif 1598#endif 1599vec3 nonPerturbedNormal = normal;`,ax=`#ifdef USE_NORMALMAP_OBJECTSPACE 1600 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1601 #ifdef FLIP_SIDED 1602 normal = - normal; 1603 #endif 1604 #ifdef DOUBLE_SIDED 1605 normal = normal * faceDirection; 1606 #endif 1607 normal = normalize( normalMatrix * normal ); 1608#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1609 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1610 #if defined( USE_PACKED_NORMALMAP ) 1611 mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); 1612 #endif 1613 mapN.xy *= normalScale; 1614 normal = normalize( tbn * mapN ); 1615#elif defined( USE_BUMPMAP )
1616 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1617#endif`,ox=`#ifndef FLAT_SHADED 1618 varying vec3 vNormal; 1619 #ifdef USE_TANGENT 1620 varying vec3 vTangent; 1621 varying vec3 vBitangent; 1622 #endif 1623#endif`,lx=`#ifndef FLAT_SHADED 1624 varying vec3 vNormal; 1625 #ifdef USE_TANGENT 1626 varying vec3 vTangent; 1627 varying vec3 vBitangent; 1628 #endif 1629#endif`,cx=`#ifndef FLAT_SHADED 1630 vNormal = normalize( transformedNormal ); 1631 #ifdef USE_TANGENT 1632 vTangent = normalize( transformedTangent ); 1633 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1634 #ifdef FLIP_SIDED 1635 vBitangent = - vBitangent; 1636 #endif 1637 #endif 1638#endif`,hx=`#ifdef USE_NORMALMAP 1639 uniform sampler2D normalMap; 1640 uniform vec2 normalScale; 1641#endif 1642#ifdef USE_NORMALMAP_OBJECTSPACE 1643 uniform mat3 normalMatrix; 1644#endif 1645#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1646 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1647 vec3 q0 = dFdx( eye_pos.xyz ); 1648 vec3 q1 = dFdy( eye_pos.xyz ); 1649 vec2 st0 = dFdx( uv.st ); 1650 vec2 st1 = dFdy( uv.st ); 1651 vec3 N = surf_norm; 1652 vec3 q1perp = cross( q1, N ); 1653 vec3 q0perp = cross( N, q0 ); 1654 vec3 T = q1perp * st0.x + q0perp * st1.x; 1655 vec3 B = q1perp * st0.y + q0perp * st1.y; 1656 float det = max( dot( T, T ), dot( B, B ) ); 1657 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1658 return mat3( T * scale, B * scale, N ); 1659 } 1660#endif`,ux=`#ifdef USE_CLEARCOAT 1661 vec3 clearcoatNormal = nonPerturbedNormal; 1662#endif`,fx=`#ifdef USE_CLEARCOAT_NORMALMAP 1663 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1664 clearcoatMapN.xy *= clearcoatNormalScale; 1665 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1666#endif`,dx=`#ifdef USE_CLEARCOATMAP 1667 uniform sampler2D clearcoatMap; 1668#endif 1669#ifdef USE_CLEARCOAT_NORMALMAP 1670 uniform sampler2D clearcoatNormalMap; 1671 uniform vec2 clearcoatNormalScale; 1672#endif 1673#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1674 uniform sampler2D clearcoatRoughnessMap; 1675#endif`,px=`#ifdef USE_IRIDESCENCEMAP 1676 uniform sampler2D iridescenceMap; 1677#endif 1678#ifdef USE_IRIDESCENCE_THICKNESSMAP 1679 uniform sampler2D iridescenceThicknessMap; 1680#endif`,mx=`#ifdef OPAQUE 1681diffuseColor.a = 1.0; 1682#endif 1683#ifdef USE_TRANSMISSION 1684diffuseColor.a *= material.transmissionAlpha; 1685#endif 1686gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,gx=`vec3 packNormalToRGB( const in vec3 normal ) { 1687 return normalize( normal ) * 0.5 + 0.5; 1688} 1689vec3 unpackRGBToNormal( const in vec3 rgb ) { 1690 return 2.0 * rgb.xyz - 1.0; 1691} 1692const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1693const float Inv255 = 1. / 255.; 1694const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1695const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1696const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1697const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1698vec4 packDepthToRGBA( const in float v ) { 1699 if( v <= 0.0 ) 1700 return vec4( 0., 0., 0., 0. ); 1701 if( v >= 1.0 ) 1702 return vec4( 1., 1., 1., 1. ); 1703 float vuf; 1704 float af = modf( v * PackFactors.a, vuf ); 1705 float bf = modf( vuf * ShiftRight8, vuf ); 1706 float gf = modf( vuf * ShiftRight8, vuf ); 1707 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1708} 1709vec3 packDepthToRGB( const in float v ) { 1710 if( v <= 0.0 ) 1711 return vec3( 0., 0., 0. ); 1712 if( v >= 1.0 ) 1713 return vec3( 1., 1., 1. ); 1714 float vuf; 1715 float bf = modf( v * PackFactors.b, vuf ); 1716 float gf = modf( vuf * ShiftRight8, vuf ); 1717 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1718} 1719vec2 packDepthToRG( const in float v ) { 1720 if( v <= 0.0 ) 1721 return vec2( 0., 0. ); 1722 if( v >= 1.0 ) 1723 return vec2( 1., 1. ); 1724 float vuf; 1725 float gf = modf( v * 256., vuf ); 1726 return vec2( vuf * Inv255, gf ); 1727} 1728float unpackRGBAToDepth( const in vec4 v ) { 1729 return dot( v, UnpackFactors4 ); 1730} 1731float unpackRGBToDepth( const in vec3 v ) { 1732 return dot( v, UnpackFactors3 ); 1733} 1734float unpackRGToDepth( const in vec2 v ) { 1735 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1736} 1737vec4 pack2HalfToRGBA( const in vec2 v ) {
1738 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1739 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1740} 1741vec2 unpackRGBATo2Half( const in vec4 v ) { 1742 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1743} 1744float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1745 return ( viewZ + near ) / ( near - far ); 1746} 1747float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1748 #ifdef USE_REVERSED_DEPTH_BUFFER 1749 1750 return depth * ( far - near ) - far; 1751 #else 1752 return depth * ( near - far ) - near; 1753 #endif 1754} 1755float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1756 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1757} 1758float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1759 1760 #ifdef USE_REVERSED_DEPTH_BUFFER 1761 return ( near * far ) / ( ( near - far ) * depth - near ); 1762 #else 1763 return ( near * far ) / ( ( far - near ) * depth - far ); 1764 #endif 1765}`,xx=`#ifdef PREMULTIPLIED_ALPHA 1766 gl_FragColor.rgb *= gl_FragColor.a; 1767#endif`,_x=`vec4 mvPosition = vec4( transformed, 1.0 ); 1768#ifdef USE_BATCHING 1769 mvPosition = batchingMatrix * mvPosition; 1770#endif 1771#ifdef USE_INSTANCING 1772 mvPosition = instanceMatrix * mvPosition; 1773#endif 1774mvPosition = modelViewMatrix * mvPosition; 1775gl_Position = projectionMatrix * mvPosition;`,vx=`#ifdef DITHERING 1776 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1777#endif`,yx=`#ifdef DITHERING 1778 vec3 dithering( vec3 color ) { 1779 float grid_position = rand( gl_FragCoord.xy ); 1780 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1781 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1782 return color + dither_shift_RGB; 1783 } 1784#endif`,Sx=`float roughnessFactor = roughness; 1785#ifdef USE_ROUGHNESSMAP 1786 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1787 roughnessFactor *= texelRoughness.g; 1788#endif`,Mx=`#ifdef USE_ROUGHNESSMAP 1789 uniform sampler2D roughnessMap; 1790#endif`,bx=`#if NUM_SPOT_LIGHT_COORDS > 0 1791 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1792#endif 1793#if NUM_SPOT_LIGHT_MAPS > 0 1794 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1795#endif 1796#ifdef USE_SHADOWMAP 1797 #if NUM_DIR_LIGHT_SHADOWS > 0 1798 #if defined( SHADOWMAP_TYPE_PCF ) 1799 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1800 #else 1801 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1802 #endif 1803 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1804 struct DirectionalLightShadow { 1805 float shadowIntensity; 1806 float shadowBias; 1807 float shadowNormalBias; 1808 float shadowRadius; 1809 vec2 shadowMapSize; 1810 }; 1811 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1812 #endif 1813 #if NUM_SPOT_LIGHT_SHADOWS > 0 1814 #if defined( SHADOWMAP_TYPE_PCF ) 1815 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1816 #else 1817 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1818 #endif 1819 struct SpotLightShadow { 1820 float shadowIntensity; 1821 float shadowBias; 1822 float shadowNormalBias; 1823 float shadowRadius; 1824 vec2 shadowMapSize; 1825 }; 1826 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1827 #endif 1828 #if NUM_POINT_LIGHT_SHADOWS > 0 1829 #if defined( SHADOWMAP_TYPE_PCF ) 1830 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1831 #elif defined( SHADOWMAP_TYPE_BASIC ) 1832 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1833 #endif 1834 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1835 struct PointLightShadow { 1836 float shadowIntensity; 1837 float shadowBias; 1838 float shadowNormalBias; 1839 float shadowRadius; 1840 vec2 shadowMapSize; 1841 float shadowCameraNear; 1842 float shadowCameraFar; 1843 }; 1844 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1845 #endif 1846 #if defined( SHADOWMAP_TYPE_PCF ) 1847 float interleavedGradientNoise( vec2 position ) { 1848 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1849 } 1850 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1851 const float goldenAngle = 2.399963229728653; 1852 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1853 float theta = float( sampleIndex ) * goldenAngle + phi; 1854 return vec2( cos( theta ), sin( theta ) ) * r; 1855 } 1856 #endif 1857 #if defined( SHADOWMAP_TYPE_PCF ) 1858 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1859 float shadow = 1.0; 1860 shadowCoord.xyz /= shadowCoord.w; 1861 shadowCoord.z += shadowBias; 1862 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1863 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1864 if ( frustumTest ) { 1865 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1866 float radius = shadowRadius * texelSize.x; 1867 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1868 shadow = ( 1869 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1870 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1871 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1872 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1873 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1874 ) * 0.2; 1875 } 1876 return mix( 1.0, shadow, shadowIntensity ); 1877 } 1878 #elif defined( SHADOWMAP_TYPE_VSM ) 1879 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1880 float shadow = 1.0; 1881 shadowCoord.xyz /= shadowCoord.w; 1882 #ifdef USE_REVERSED_DEPTH_BUFFER 1883 shadowCoord.z -= shadowBias; 1884 #else 1885 shadowCoord.z += shadowBias; 1886 #endif 1887 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1888 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1889 if ( frustumTest ) { 1890 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1891 float mean = distribution.x; 1892 float variance = distribution.y * distribution.y; 1893 #ifdef USE_REVERSED_DEPTH_BUFFER 1894 float hard_shadow = step( mean, shadowCoord.z ); 1895 #else 1896 float hard_shadow = step( shadowCoord.z, mean ); 1897 #endif 1898 1899 if ( hard_shadow == 1.0 ) { 1900 shadow = 1.0; 1901 } else { 1902 variance = max( variance, 0.0000001 ); 1903 float d = shadowCoord.z - mean; 1904 float p_max = variance / ( variance + d * d ); 1905 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1906 shadow = max( hard_shadow, p_max ); 1907 } 1908 } 1909 return mix( 1.0, shadow, shadowIntensity ); 1910 } 1911 #else 1912 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1913 float shadow = 1.0; 1914 shadowCoord.xyz /= shadowCoord.w; 1915 #ifdef USE_REVERSED_DEPTH_BUFFER 1916 shadowCoord.z -= shadowBias; 1917 #else 1918 shadowCoord.z += shadowBias; 1919 #endif 1920 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1921 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1922 if ( frustumTest ) { 1923 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1924 #ifdef USE_REVERSED_DEPTH_BUFFER 1925 shadow = step( depth, shadowCoord.z ); 1926 #else 1927 shadow = step( shadowCoord.z, depth ); 1928 #endif 1929 } 1930 return mix( 1.0, shadow, shadowIntensity ); 1931 } 1932 #endif 1933 #if NUM_POINT_LIGHT_SHADOWS > 0 1934 #if defined( SHADOWMAP_TYPE_PCF ) 1935 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1936 float shadow = 1.0; 1937 vec3 lightToPosition = shadowCoord.xyz; 1938 vec3 bd3D = normalize( lightToPosition ); 1939 vec3 absVec = abs( lightToPosition ); 1940 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1941 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1942 #ifdef USE_REVERSED_DEPTH_BUFFER 1943 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1944 dp -= shadowBias; 1945 #else 1946 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1947 dp += shadowBias; 1948 #endif 1949 float texelSize = shadowRadius / shadowMapSize.x; 1950 vec3 absDir = abs( bd3D ); 1951 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1952 tangent = normalize( cross( bd3D, tangent ) ); 1953 vec3 bitangent = cross( bd3D, tangent ); 1954 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1955 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 1956 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 1957 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 1958 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 1959 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 1960 shadow = ( 1961 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 1962 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 1963 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 1964 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 1965 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 1966 ) * 0.2; 1967 } 1968 return mix( 1.0, shadow, shadowIntensity ); 1969 } 1970 #elif defined( SHADOWMAP_TYPE_BASIC ) 1971 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1972 float shadow = 1.0; 1973 vec3 lightToPosition = shadowCoord.xyz; 1974 vec3 absVec = abs( lightToPosition ); 1975 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1976 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1977 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1978 dp += shadowBias; 1979 vec3 bd3D = normalize( lightToPosition ); 1980 float depth = textureCube( shadowMap, bd3D ).r; 1981 #ifdef USE_REVERSED_DEPTH_BUFFER 1982 depth = 1.0 - depth; 1983 #endif 1984 shadow = step( dp, depth ); 1985 } 1986 return mix( 1.0, shadow, shadowIntensity ); 1987 } 1988 #endif 1989 #endif 1990#endif`,Ex=`#if NUM_SPOT_LIGHT_COORDS > 0 1991 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1992 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1993#endif 1994#ifdef USE_SHADOWMAP 1995 #if NUM_DIR_LIGHT_SHADOWS > 0 1996 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1997 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1998 struct DirectionalLightShadow { 1999 float shadowIntensity; 2000 float shadowBias; 2001 float shadowNormalBias; 2002 float shadowRadius; 2003 vec2 shadowMapSize; 2004 }; 2005 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 2006 #endif 2007 #if NUM_SPOT_LIGHT_SHADOWS > 0 2008 struct SpotLightShadow { 2009 float shadowIntensity; 2010 float shadowBias; 2011 float shadowNormalBias; 2012 float shadowRadius; 2013 vec2 shadowMapSize; 2014 }; 2015 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 2016 #endif 2017 #if NUM_POINT_LIGHT_SHADOWS > 0 2018 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 2019 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 2020 struct PointLightShadow { 2021 float shadowIntensity; 2022 float shadowBias; 2023 float shadowNormalBias; 2024 float shadowRadius; 2025 vec2 shadowMapSize; 2026 float shadowCameraNear; 2027 float shadowCameraFar; 2028 }; 2029 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2030 #endif 2031#endif`,Tx=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2032 #ifdef HAS_NORMAL 2033 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 2034 #else 2035 vec3 shadowWorldNormal = vec3( 0.0 ); 2036 #endif 2037 vec4 shadowWorldPosition; 2038#endif 2039#if defined( USE_SHADOWMAP ) 2040 #if NUM_DIR_LIGHT_SHADOWS > 0 2041 #pragma unroll_loop_start 2042 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2043 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2044 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2045 } 2046 #pragma unroll_loop_end 2047 #endif 2048 #if NUM_POINT_LIGHT_SHADOWS > 0 2049 #pragma unroll_loop_start 2050 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2051 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2052 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2053 } 2054 #pragma unroll_loop_end 2055 #endif 2056#endif
2057#if NUM_SPOT_LIGHT_COORDS > 0 2058 #pragma unroll_loop_start 2059 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2060 shadowWorldPosition = worldPosition; 2061 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2062 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2063 #endif 2064 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2065 } 2066 #pragma unroll_loop_end 2067#endif`,wx=`float getShadowMask() { 2068 float shadow = 1.0; 2069 #ifdef USE_SHADOWMAP 2070 #if NUM_DIR_LIGHT_SHADOWS > 0 2071 DirectionalLightShadow directionalLight; 2072 #pragma unroll_loop_start 2073 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2074 directionalLight = directionalLightShadows[ i ]; 2075 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2076 } 2077 #pragma unroll_loop_end 2078 #endif 2079 #if NUM_SPOT_LIGHT_SHADOWS > 0 2080 SpotLightShadow spotLight; 2081 #pragma unroll_loop_start 2082 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2083 spotLight = spotLightShadows[ i ]; 2084 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2085 } 2086 #pragma unroll_loop_end 2087 #endif 2088 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2089 PointLightShadow pointLight; 2090 #pragma unroll_loop_start 2091 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2092 pointLight = pointLightShadows[ i ]; 2093 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2094 } 2095 #pragma unroll_loop_end 2096 #endif 2097 #endif 2098 return shadow; 2099}`,Ax=`#ifdef USE_SKINNING 2100 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2101 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2102 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2103 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2104#endif`,Rx=`#ifdef USE_SKINNING 2105 uniform mat4 bindMatrix; 2106 uniform mat4 bindMatrixInverse; 2107 uniform highp sampler2D boneTexture; 2108 mat4 getBoneMatrix( const in float i ) { 2109 int size = textureSize( boneTexture, 0 ).x; 2110 int j = int( i ) * 4; 2111 int x = j % size; 2112 int y = j / size; 2113 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2114 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2115 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2116 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2117 return mat4( v1, v2, v3, v4 ); 2118 } 2119#endif`,Cx=`#ifdef USE_SKINNING 2120 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2121 vec4 skinned = vec4( 0.0 ); 2122 skinned += boneMatX * skinVertex * skinWeight.x; 2123 skinned += boneMatY * skinVertex * skinWeight.y; 2124 skinned += boneMatZ * skinVertex * skinWeight.z; 2125 skinned += boneMatW * skinVertex * skinWeight.w; 2126 transformed = ( bindMatrixInverse * skinned ).xyz; 2127#endif`,Px=`#ifdef USE_SKINNING 2128 mat4 skinMatrix = mat4( 0.0 ); 2129 skinMatrix += skinWeight.x * boneMatX; 2130 skinMatrix += skinWeight.y * boneMatY; 2131 skinMatrix += skinWeight.z * boneMatZ; 2132 skinMatrix += skinWeight.w * boneMatW; 2133 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2134 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2135 #ifdef USE_TANGENT 2136 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2137 #endif 2138#endif`,Dx=`float specularStrength; 2139#ifdef USE_SPECULARMAP 2140 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2141 specularStrength = texelSpecular.r; 2142#else 2143 specularStrength = 1.0; 2144#endif`,Lx=`#ifdef USE_SPECULARMAP 2145 uniform sampler2D specularMap; 2146#endif`,Ix=`#if defined( TONE_MAPPING ) 2147 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2148#endif`,Nx=`#ifndef saturate 2149#define saturate( a ) clamp( a, 0.0, 1.0 ) 2150#endif 2151uniform float toneMappingExposure; 2152vec3 LinearToneMapping( vec3 color ) { 2153 return saturate( toneMappingExposure * color ); 2154} 2155vec3 ReinhardToneMapping( vec3 color ) { 2156 color *= toneMappingExposure; 2157 return saturate( color / ( vec3( 1.0 ) + color ) ); 2158} 2159vec3 CineonToneMapping( vec3 color ) { 2160 color *= toneMappingExposure; 2161 color = max( vec3( 0.0 ), color - 0.004 ); 2162 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2163} 2164vec3 RRTAndODTFit( vec3 v ) { 2165 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2166 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2167 return a / b; 2168} 2169vec3 ACESFilmicToneMapping( vec3 color ) { 2170 const mat3 ACESInputMat = mat3( 2171 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2172 vec3( 0.04823, 0.01566, 0.83777 ) 2173 ); 2174 const mat3 ACESOutputMat = mat3( 2175 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2176 vec3( -0.07367, -0.00605, 1.07602 ) 2177 ); 2178 color *= toneMappingExposure / 0.6; 2179 color = ACESInputMat * color; 2180 color = RRTAndODTFit( color ); 2181 color = ACESOutputMat * color; 2182 return saturate( color ); 2183} 2184const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2185 vec3( 1.6605, - 0.1246, - 0.0182 ), 2186 vec3( - 0.5876, 1.1329, - 0.1006 ), 2187 vec3( - 0.0728, - 0.0083, 1.1187 ) 2188); 2189const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2190 vec3( 0.6274, 0.0691, 0.0164 ), 2191 vec3( 0.3293, 0.9195, 0.0880 ), 2192 vec3( 0.0433, 0.0113, 0.8956 ) 2193); 2194vec3 agxDefaultContrastApprox( vec3 x ) { 2195 vec3 x2 = x * x; 2196 vec3 x4 = x2 * x2; 2197 return + 15.5 * x4 * x2 2198 - 40.14 * x4 * x 2199 + 31.96 * x4 2200 - 6.868 * x2 * x 2201 + 0.4298 * x2 2202 + 0.1191 * x 2203 - 0.00232; 2204} 2205vec3 AgXToneMapping( vec3 color ) { 2206 const mat3 AgXInsetMatrix = mat3( 2207 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2208 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2209 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2210 );
2211 const mat3 AgXOutsetMatrix = mat3( 2212 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2213 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2214 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2215 ); 2216 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2217 color *= toneMappingExposure; 2218 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2219 color = AgXInsetMatrix * color; 2220 color = max( color, 1e-10 ); color = log2( color ); 2221 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2222 color = clamp( color, 0.0, 1.0 ); 2223 color = agxDefaultContrastApprox( color ); 2224 color = AgXOutsetMatrix * color; 2225 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2226 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2227 color = clamp( color, 0.0, 1.0 ); 2228 return color; 2229} 2230vec3 NeutralToneMapping( vec3 color ) { 2231 const float StartCompression = 0.8 - 0.04; 2232 const float Desaturation = 0.15; 2233 color *= toneMappingExposure; 2234 float x = min( color.r, min( color.g, color.b ) ); 2235 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2236 color -= offset; 2237 float peak = max( color.r, max( color.g, color.b ) ); 2238 if ( peak < StartCompression ) return color; 2239 float d = 1. - StartCompression; 2240 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2241 color *= newPeak / peak; 2242 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2243 return mix( color, vec3( newPeak ), g ); 2244} 2245vec3 CustomToneMapping( vec3 color ) { return color; }`,Ux=`#ifdef USE_TRANSMISSION 2246 material.transmission = transmission; 2247 material.transmissionAlpha = 1.0; 2248 material.thickness = thickness; 2249 material.attenuationDistance = attenuationDistance; 2250 material.attenuationColor = attenuationColor; 2251 #ifdef USE_TRANSMISSIONMAP 2252 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2253 #endif 2254 #ifdef USE_THICKNESSMAP 2255 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2256 #endif 2257 vec3 pos = vWorldPosition; 2258 vec3 v = normalize( cameraPosition - pos ); 2259 vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix ); 2260 vec4 transmitted = getIBLVolumeRefraction( 2261 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2262 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2263 material.attenuationColor, material.attenuationDistance ); 2264 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2265 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2266#endif`,Ox=`#ifdef USE_TRANSMISSION 2267 uniform float transmission; 2268 uniform float thickness; 2269 uniform float attenuationDistance; 2270 uniform vec3 attenuationColor; 2271 #ifdef USE_TRANSMISSIONMAP 2272 uniform sampler2D transmissionMap; 2273 #endif 2274 #ifdef USE_THICKNESSMAP 2275 uniform sampler2D thicknessMap; 2276 #endif 2277 uniform vec2 transmissionSamplerSize; 2278 uniform sampler2D transmissionSamplerMap; 2279 uniform mat4 modelMatrix; 2280 uniform mat4 projectionMatrix; 2281 varying vec3 vWorldPosition; 2282 float w0( float a ) { 2283 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2284 } 2285 float w1( float a ) { 2286 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2287 } 2288 float w2( float a ){ 2289 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2290 } 2291 float w3( float a ) { 2292 return ( 1.0 / 6.0 ) * ( a * a * a ); 2293 } 2294 float g0( float a ) { 2295 return w0( a ) + w1( a ); 2296 } 2297 float g1( float a ) { 2298 return w2( a ) + w3( a ); 2299 } 2300 float h0( float a ) { 2301 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2302 } 2303 float h1( float a ) { 2304 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2305 } 2306 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2307 uv = uv * texelSize.zw + 0.5; 2308 vec2 iuv = floor( uv ); 2309 vec2 fuv = fract( uv ); 2310 float g0x = g0( fuv.x ); 2311 float g1x = g1( fuv.x ); 2312 float h0x = h0( fuv.x ); 2313 float h1x = h1( fuv.x ); 2314 float h0y = h0( fuv.y ); 2315 float h1y = h1( fuv.y ); 2316 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2317 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2318 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2319 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2320 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2321 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2322 } 2323 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2324 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2325 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2326 vec2 fLodSizeInv = 1.0 / fLodSize; 2327 vec2 cLodSizeInv = 1.0 / cLodSize; 2328 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2329 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2330 return mix( fSample, cSample, fract( lod ) ); 2331 } 2332 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2333 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2334 vec3 modelScale; 2335 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2336 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2337 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2338 return normalize( refractionVector ) * thickness * modelScale; 2339 } 2340 float applyIorToRoughness( const in float roughness, const in float ior ) { 2341 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2342 } 2343 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2344 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2345 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2346 } 2347 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2348 if ( isinf( attenuationDistance ) ) { 2349 return vec3( 1.0 ); 2350 } else { 2351 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2352 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2353 } 2354 } 2355 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2356 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2357 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2358 const in vec3 attenuationColor, const in float attenuationDistance ) { 2359 vec4 transmittedLight; 2360 vec3 transmittance; 2361 #ifdef USE_DISPERSION 2362 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2363 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2364 for ( int i = 0; i < 3; i ++ ) { 2365 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2366 vec3 refractedRayExit = position + transmissionRay; 2367 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2368 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2369 refractionCoords += 1.0; 2370 refractionCoords /= 2.0; 2371 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2372 transmittedLight[ i ] = transmissionSample[ i ]; 2373 transmittedLight.a += transmissionSample.a; 2374 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2375 } 2376 transmittedLight.a /= 3.0; 2377 #else 2378 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2379 vec3 refractedRayExit = position + transmissionRay; 2380 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2381 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2382 refractionCoords += 1.0; 2383 refractionCoords /= 2.0; 2384 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2385 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2386 #endif 2387 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2388 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2389 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2390 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2391 } 2392#endif`,Fx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2393 varying vec2 vUv; 2394#endif 2395#ifdef USE_MAP 2396 varying vec2 vMapUv; 2397#endif 2398#ifdef USE_ALPHAMAP
2399 varying vec2 vAlphaMapUv; 2400#endif 2401#ifdef USE_LIGHTMAP 2402 varying vec2 vLightMapUv; 2403#endif 2404#ifdef USE_AOMAP 2405 varying vec2 vAoMapUv; 2406#endif 2407#ifdef USE_BUMPMAP 2408 varying vec2 vBumpMapUv; 2409#endif 2410#ifdef USE_NORMALMAP 2411 varying vec2 vNormalMapUv; 2412#endif 2413#ifdef USE_EMISSIVEMAP 2414 varying vec2 vEmissiveMapUv; 2415#endif 2416#ifdef USE_METALNESSMAP 2417 varying vec2 vMetalnessMapUv; 2418#endif 2419#ifdef USE_ROUGHNESSMAP 2420 varying vec2 vRoughnessMapUv; 2421#endif 2422#ifdef USE_ANISOTROPYMAP 2423 varying vec2 vAnisotropyMapUv; 2424#endif 2425#ifdef USE_CLEARCOATMAP 2426 varying vec2 vClearcoatMapUv; 2427#endif 2428#ifdef USE_CLEARCOAT_NORMALMAP 2429 varying vec2 vClearcoatNormalMapUv; 2430#endif 2431#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2432 varying vec2 vClearcoatRoughnessMapUv; 2433#endif 2434#ifdef USE_IRIDESCENCEMAP 2435 varying vec2 vIridescenceMapUv; 2436#endif 2437#ifdef USE_IRIDESCENCE_THICKNESSMAP 2438 varying vec2 vIridescenceThicknessMapUv; 2439#endif 2440#ifdef USE_SHEEN_COLORMAP 2441 varying vec2 vSheenColorMapUv; 2442#endif 2443#ifdef USE_SHEEN_ROUGHNESSMAP 2444 varying vec2 vSheenRoughnessMapUv; 2445#endif 2446#ifdef USE_SPECULARMAP 2447 varying vec2 vSpecularMapUv; 2448#endif 2449#ifdef USE_SPECULAR_COLORMAP 2450 varying vec2 vSpecularColorMapUv; 2451#endif 2452#ifdef USE_SPECULAR_INTENSITYMAP 2453 varying vec2 vSpecularIntensityMapUv; 2454#endif 2455#ifdef USE_TRANSMISSIONMAP 2456 uniform mat3 transmissionMapTransform; 2457 varying vec2 vTransmissionMapUv; 2458#endif 2459#ifdef USE_THICKNESSMAP 2460 uniform mat3 thicknessMapTransform; 2461 varying vec2 vThicknessMapUv; 2462#endif`,Bx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2463 varying vec2 vUv; 2464#endif 2465#ifdef USE_MAP 2466 uniform mat3 mapTransform; 2467 varying vec2 vMapUv; 2468#endif 2469#ifdef USE_ALPHAMAP 2470 uniform mat3 alphaMapTransform; 2471 varying vec2 vAlphaMapUv; 2472#endif 2473#ifdef USE_LIGHTMAP 2474 uniform mat3 lightMapTransform; 2475 varying vec2 vLightMapUv; 2476#endif 2477#ifdef USE_AOMAP 2478 uniform mat3 aoMapTransform; 2479 varying vec2 vAoMapUv; 2480#endif 2481#ifdef USE_BUMPMAP 2482 uniform mat3 bumpMapTransform; 2483 varying vec2 vBumpMapUv; 2484#endif 2485#ifdef USE_NORMALMAP 2486 uniform mat3 normalMapTransform; 2487 varying vec2 vNormalMapUv; 2488#endif 2489#ifdef USE_DISPLACEMENTMAP 2490 uniform mat3 displacementMapTransform; 2491 varying vec2 vDisplacementMapUv; 2492#endif 2493#ifdef USE_EMISSIVEMAP 2494 uniform mat3 emissiveMapTransform; 2495 varying vec2 vEmissiveMapUv; 2496#endif 2497#ifdef USE_METALNESSMAP 2498 uniform mat3 metalnessMapTransform; 2499 varying vec2 vMetalnessMapUv; 2500#endif 2501#ifdef USE_ROUGHNESSMAP 2502 uniform mat3 roughnessMapTransform; 2503 varying vec2 vRoughnessMapUv; 2504#endif 2505#ifdef USE_ANISOTROPYMAP 2506 uniform mat3 anisotropyMapTransform; 2507 varying vec2 vAnisotropyMapUv; 2508#endif 2509#ifdef USE_CLEARCOATMAP 2510 uniform mat3 clearcoatMapTransform; 2511 varying vec2 vClearcoatMapUv; 2512#endif 2513#ifdef USE_CLEARCOAT_NORMALMAP 2514 uniform mat3 clearcoatNormalMapTransform; 2515 varying vec2 vClearcoatNormalMapUv; 2516#endif 2517#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2518 uniform mat3 clearcoatRoughnessMapTransform; 2519 varying vec2 vClearcoatRoughnessMapUv; 2520#endif 2521#ifdef USE_SHEEN_COLORMAP 2522 uniform mat3 sheenColorMapTransform; 2523 varying vec2 vSheenColorMapUv; 2524#endif 2525#ifdef USE_SHEEN_ROUGHNESSMAP 2526 uniform mat3 sheenRoughnessMapTransform; 2527 varying vec2 vSheenRoughnessMapUv; 2528#endif 2529#ifdef USE_IRIDESCENCEMAP 2530 uniform mat3 iridescenceMapTransform; 2531 varying vec2 vIridescenceMapUv; 2532#endif 2533#ifdef USE_IRIDESCENCE_THICKNESSMAP 2534 uniform mat3 iridescenceThicknessMapTransform; 2535 varying vec2 vIridescenceThicknessMapUv; 2536#endif 2537#ifdef USE_SPECULARMAP 2538 uniform mat3 specularMapTransform; 2539 varying vec2 vSpecularMapUv; 2540#endif 2541#ifdef USE_SPECULAR_COLORMAP 2542 uniform mat3 specularColorMapTransform; 2543 varying vec2 vSpecularColorMapUv; 2544#endif 2545#ifdef USE_SPECULAR_INTENSITYMAP 2546 uniform mat3 specularIntensityMapTransform; 2547 varying vec2 vSpecularIntensityMapUv; 2548#endif 2549#ifdef USE_TRANSMISSIONMAP 2550 uniform mat3 transmissionMapTransform; 2551 varying vec2 vTransmissionMapUv; 2552#endif 2553#ifdef USE_THICKNESSMAP 2554 uniform mat3 thicknessMapTransform; 2555 varying vec2 vThicknessMapUv; 2556#endif`,zx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2557 vUv = vec3( uv, 1 ).xy; 2558#endif 2559#ifdef USE_MAP 2560 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2561#endif 2562#ifdef USE_ALPHAMAP 2563 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2564#endif 2565#ifdef USE_LIGHTMAP 2566 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2567#endif 2568#ifdef USE_AOMAP 2569 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2570#endif 2571#ifdef USE_BUMPMAP 2572 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2573#endif 2574#ifdef USE_NORMALMAP 2575 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2576#endif 2577#ifdef USE_DISPLACEMENTMAP 2578 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2579#endif 2580#ifdef USE_EMISSIVEMAP 2581 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2582#endif 2583#ifdef USE_METALNESSMAP 2584 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2585#endif 2586#ifdef USE_ROUGHNESSMAP 2587 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2588#endif 2589#ifdef USE_ANISOTROPYMAP 2590 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2591#endif 2592#ifdef USE_CLEARCOATMAP 2593 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2594#endif 2595#ifdef USE_CLEARCOAT_NORMALMAP 2596 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2597#endif 2598#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2599 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2600#endif
2601#ifdef USE_IRIDESCENCEMAP 2602 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2603#endif 2604#ifdef USE_IRIDESCENCE_THICKNESSMAP 2605 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2606#endif 2607#ifdef USE_SHEEN_COLORMAP 2608 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2609#endif 2610#ifdef USE_SHEEN_ROUGHNESSMAP 2611 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2612#endif 2613#ifdef USE_SPECULARMAP 2614 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2615#endif 2616#ifdef USE_SPECULAR_COLORMAP 2617 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2618#endif 2619#ifdef USE_SPECULAR_INTENSITYMAP 2620 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2621#endif 2622#ifdef USE_TRANSMISSIONMAP 2623 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2624#endif 2625#ifdef USE_THICKNESSMAP 2626 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2627#endif`,kx=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2628 vec4 worldPosition = vec4( transformed, 1.0 ); 2629 #ifdef USE_BATCHING 2630 worldPosition = batchingMatrix * worldPosition; 2631 #endif 2632 #ifdef USE_INSTANCING 2633 worldPosition = instanceMatrix * worldPosition; 2634 #endif 2635 worldPosition = modelMatrix * worldPosition; 2636#endif`;const Hx=`varying vec2 vUv; 2637uniform mat3 uvTransform; 2638void main() { 2639 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2640 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2641}`,Vx=`uniform sampler2D t2D; 2642uniform float backgroundIntensity; 2643varying vec2 vUv; 2644void main() { 2645 vec4 texColor = texture2D( t2D, vUv ); 2646 #ifdef DECODE_VIDEO_TEXTURE 2647 texColor = 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 ); 2648 #endif 2649 texColor.rgb *= backgroundIntensity; 2650 gl_FragColor = texColor; 2651 #include <tonemapping_fragment> 2652 #include <colorspace_fragment> 2653}`,Gx=`varying vec3 vWorldDirection; 2654#include <common> 2655void main() { 2656 vWorldDirection = transformDirection( position, modelMatrix ); 2657 #include <begin_vertex> 2658 #include <project_vertex> 2659 gl_Position.z = gl_Position.w; 2660}`,Wx=`#ifdef ENVMAP_TYPE_CUBE 2661 uniform samplerCube envMap; 2662#elif defined( ENVMAP_TYPE_CUBE_UV ) 2663 uniform sampler2D envMap; 2664#endif 2665uniform float backgroundBlurriness; 2666uniform float backgroundIntensity; 2667uniform mat3 backgroundRotation; 2668varying vec3 vWorldDirection; 2669#include <cube_uv_reflection_fragment> 2670void main() { 2671 #ifdef ENVMAP_TYPE_CUBE 2672 vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); 2673 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2674 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2675 #else 2676 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2677 #endif 2678 texColor.rgb *= backgroundIntensity; 2679 gl_FragColor = texColor; 2680 #include <tonemapping_fragment> 2681 #include <colorspace_fragment> 2682}`,Xx=`varying vec3 vWorldDirection; 2683#include <common> 2684void main() { 2685 vWorldDirection = transformDirection( position, modelMatrix ); 2686 #include <begin_vertex> 2687 #include <project_vertex> 2688 gl_Position.z = gl_Position.w; 2689}`,qx=`uniform samplerCube tCube; 2690uniform float tFlip; 2691uniform float opacity; 2692varying vec3 vWorldDirection; 2693void main() { 2694 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2695 gl_FragColor = texColor; 2696 gl_FragColor.a *= opacity; 2697 #include <tonemapping_fragment> 2698 #include <colorspace_fragment> 2699}`,Yx=`#include <common> 2700#include <batching_pars_vertex> 2701#include <uv_pars_vertex> 2702#include <displacementmap_pars_vertex> 2703#include <morphtarget_pars_vertex> 2704#include <skinning_pars_vertex> 2705#include <logdepthbuf_pars_vertex> 2706#include <clipping_planes_pars_vertex> 2707varying vec2 vHighPrecisionZW; 2708void main() { 2709 #include <uv_vertex> 2710 #include <batching_vertex> 2711 #include <skinbase_vertex> 2712 #include <morphinstance_vertex> 2713 #ifdef USE_DISPLACEMENTMAP 2714 #include <beginnormal_vertex> 2715 #include <morphnormal_vertex> 2716 #include <skinnormal_vertex> 2717 #endif 2718 #include <begin_vertex> 2719 #include <morphtarget_vertex> 2720 #include <skinning_vertex> 2721 #include <displacementmap_vertex> 2722 #include <project_vertex> 2723 #include <logdepthbuf_vertex> 2724 #include <clipping_planes_vertex> 2725 vHighPrecisionZW = gl_Position.zw; 2726}`,jx=`#if DEPTH_PACKING == 3200 2727 uniform float opacity; 2728#endif 2729#include <common> 2730#include <packing> 2731#include <uv_pars_fragment> 2732#include <map_pars_fragment> 2733#include <alphamap_pars_fragment> 2734#include <alphatest_pars_fragment> 2735#include <alphahash_pars_fragment> 2736#include <logdepthbuf_pars_fragment> 2737#include <clipping_planes_pars_fragment> 2738varying vec2 vHighPrecisionZW; 2739void main() { 2740 vec4 diffuseColor = vec4( 1.0 ); 2741 #include <clipping_planes_fragment> 2742 #if DEPTH_PACKING == 3200 2743 diffuseColor.a = opacity; 2744 #endif 2745 #include <map_fragment> 2746 #include <alphamap_fragment> 2747 #include <alphatest_fragment> 2748 #include <alphahash_fragment> 2749 #include <logdepthbuf_fragment> 2750 #ifdef USE_REVERSED_DEPTH_BUFFER 2751 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2752 #else 2753 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2754 #endif 2755 #if DEPTH_PACKING == 3200 2756 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2757 #elif DEPTH_PACKING == 3201 2758 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2759 #elif DEPTH_PACKING == 3202 2760 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2761 #elif DEPTH_PACKING == 3203 2762 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2763 #endif 2764}`,$x=`#define DISTANCE 2765varying vec3 vWorldPosition; 2766#include <common> 2767#include <batching_pars_vertex> 2768#include <uv_pars_vertex> 2769#include <displacementmap_pars_vertex> 2770#include <morphtarget_pars_vertex> 2771#include <skinning_pars_vertex> 2772#include <clipping_planes_pars_vertex> 2773void main() { 2774 #include <uv_vertex> 2775 #include <batching_vertex> 2776 #include <skinbase_vertex> 2777 #include <morphinstance_vertex> 2778 #ifdef USE_DISPLACEMENTMAP 2779 #include <beginnormal_vertex> 2780 #include <morphnormal_vertex> 2781 #include <skinnormal_vertex> 2782 #endif 2783 #include <begin_vertex> 2784 #include <morphtarget_vertex> 2785 #include <skinning_vertex> 2786 #include <displacementmap_vertex> 2787 #include <project_vertex> 2788 #include <worldpos_vertex> 2789 #include <clipping_planes_vertex> 2790 vWorldPosition = worldPosition.xyz; 2791}`,Kx=`#define DISTANCE 2792uniform vec3 referencePosition; 2793uniform float nearDistance; 2794uniform float farDistance; 2795varying vec3 vWorldPosition; 2796#include <common> 2797#include <uv_pars_fragment> 2798#include <map_pars_fragment> 2799#include <alphamap_pars_fragment> 2800#include <alphatest_pars_fragment> 2801#include <alphahash_pars_fragment> 2802#include <clipping_planes_pars_fragment> 2803void main() { 2804 vec4 diffuseColor = vec4( 1.0 ); 2805 #include <clipping_planes_fragment> 2806 #include <map_fragment> 2807 #include <alphamap_fragment> 2808 #include <alphatest_fragment> 2809 #include <alphahash_fragment> 2810 float dist = length( vWorldPosition - referencePosition ); 2811 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2812 dist = saturate( dist ); 2813 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2814}`,Zx=`varying vec3 vWorldDirection; 2815#include <common> 2816void main() { 2817 vWorldDirection = transformDirection( position, modelMatrix ); 2818 #include <begin_vertex> 2819 #include <project_vertex> 2820}`,Jx=`uniform sampler2D tEquirect; 2821varying vec3 vWorldDirection; 2822#include <common> 2823void main() { 2824 vec3 direction = normalize( vWorldDirection ); 2825 vec2 sampleUV = equirectUv( direction ); 2826 gl_FragColor = texture2D( tEquirect, sampleUV ); 2827 #include <tonemapping_fragment> 2828 #include <colorspace_fragment> 2829}`,Qx=`uniform float scale; 2830attribute float lineDistance; 2831varying float vLineDistance; 2832#include <common> 2833#include <uv_pars_vertex> 2834#include <color_pars_vertex> 2835#include <fog_pars_vertex> 2836#include <morphtarget_pars_vertex> 2837#include <logdepthbuf_pars_vertex> 2838#include <clipping_planes_pars_vertex> 2839void main() { 2840 vLineDistance = scale * lineDistance; 2841 #include <uv_vertex> 2842 #include <color_vertex> 2843 #include <morphinstance_vertex> 2844 #include <morphcolor_vertex> 2845 #include <begin_vertex> 2846 #include <morphtarget_vertex> 2847 #include <project_vertex> 2848 #include <logdepthbuf_vertex> 2849 #include <clipping_planes_vertex> 2850 #include <fog_vertex> 2851}`,e_=`uniform vec3 diffuse; 2852uniform float opacity; 2853uniform float dashSize; 2854uniform float totalSize; 2855varying float vLineDistance; 2856#include <common> 2857#include <color_pars_fragment> 2858#include <uv_pars_fragment> 2859#include <map_pars_fragment> 2860#include <fog_pars_fragment> 2861#include <logdepthbuf_pars_fragment> 2862#include <clipping_planes_pars_fragment> 2863void main() { 2864 vec4 diffuseColor = vec4( diffuse, opacity ); 2865 #include <clipping_planes_fragment> 2866 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2867 discard; 2868 } 2869 vec3 outgoingLight = vec3( 0.0 ); 2870 #include <logdepthbuf_fragment> 2871 #include <map_fragment> 2872 #include <color_fragment> 2873 outgoingLight = diffuseColor.rgb; 2874 #include <opaque_fragment> 2875 #include <tonemapping_fragment> 2876 #include <colorspace_fragment> 2877 #include <fog_fragment> 2878 #include <premultiplied_alpha_fragment> 2879}`,t_=`#include <common> 2880#include <batching_pars_vertex> 2881#include <uv_pars_vertex> 2882#include <envmap_pars_vertex> 2883#include <color_pars_vertex> 2884#include <fog_pars_vertex> 2885#include <morphtarget_pars_vertex> 2886#include <skinning_pars_vertex> 2887#include <logdepthbuf_pars_vertex> 2888#include <clipping_planes_pars_vertex> 2889void main() { 2890 #include <uv_vertex> 2891 #include <color_vertex> 2892 #include <morphinstance_vertex> 2893 #include <morphcolor_vertex> 2894 #include <batching_vertex> 2895 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2896 #include <beginnormal_vertex> 2897 #include <morphnormal_vertex> 2898 #include <skinbase_vertex> 2899 #include <skinnormal_vertex> 2900 #include <defaultnormal_vertex> 2901 #endif 2902 #include <begin_vertex> 2903 #include <morphtarget_vertex> 2904 #include <skinning_vertex> 2905 #include <project_vertex> 2906 #include <logdepthbuf_vertex> 2907 #include <clipping_planes_vertex> 2908 #include <worldpos_vertex> 2909 #include <envmap_vertex> 2910 #include <fog_vertex> 2911}`,n_=`uniform vec3 diffuse; 2912uniform float opacity; 2913#ifndef FLAT_SHADED 2914 varying vec3 vNormal; 2915#endif 2916#include <common> 2917#include <dithering_pars_fragment> 2918#include <color_pars_fragment> 2919#include <uv_pars_fragment> 2920#include <map_pars_fragment> 2921#include <alphamap_pars_fragment> 2922#include <alphatest_pars_fragment> 2923#include <alphahash_pars_fragment> 2924#include <aomap_pars_fragment> 2925#include <lightmap_pars_fragment> 2926#include <envmap_common_pars_fragment> 2927#include <envmap_pars_fragment> 2928#include <fog_pars_fragment> 2929#include <specularmap_pars_fragment> 2930#include <logdepthbuf_pars_fragment> 2931#include <clipping_planes_pars_fragment> 2932void main() { 2933 vec4 diffuseColor = vec4( diffuse, opacity ); 2934 #include <clipping_planes_fragment> 2935 #include <logdepthbuf_fragment> 2936 #include <map_fragment> 2937 #include <color_fragment> 2938 #include <alphamap_fragment> 2939 #include <alphatest_fragment> 2940 #include <alphahash_fragment> 2941 #include <specularmap_fragment> 2942 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2943 #ifdef USE_LIGHTMAP 2944 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2945 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2946 #else 2947 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2948 #endif 2949 #include <aomap_fragment> 2950 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2951 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2952 #include <envmap_fragment> 2953 #include <opaque_fragment> 2954 #include <tonemapping_fragment> 2955 #include <colorspace_fragment> 2956 #include <fog_fragment> 2957 #include <premultiplied_alpha_fragment> 2958 #include <dithering_fragment> 2959}`,i_=`#define LAMBERT 2960varying vec3 vViewPosition; 2961#include <common> 2962#include <batching_pars_vertex> 2963#include <uv_pars_vertex> 2964#include <displacementmap_pars_vertex> 2965#include <envmap_pars_vertex> 2966#include <color_pars_vertex> 2967#include <fog_pars_vertex> 2968#include <normal_pars_vertex> 2969#include <morphtarget_pars_vertex> 2970#include <skinning_pars_vertex> 2971#include <shadowmap_pars_vertex> 2972#include <logdepthbuf_pars_vertex> 2973#include <clipping_planes_pars_vertex> 2974void main() { 2975 #include <uv_vertex> 2976 #include <color_vertex> 2977 #include <morphinstance_vertex> 2978 #include <morphcolor_vertex> 2979 #include <batching_vertex> 2980 #include <beginnormal_vertex> 2981 #include <morphnormal_vertex> 2982 #include <skinbase_vertex> 2983 #include <skinnormal_vertex> 2984 #include <defaultnormal_vertex> 2985 #include <normal_vertex> 2986 #include <begin_vertex> 2987 #include <morphtarget_vertex> 2988 #include <skinning_vertex> 2989 #include <displacementmap_vertex> 2990 #include <project_vertex> 2991 #include <logdepthbuf_vertex> 2992 #include <clipping_planes_vertex> 2993 vViewPosition = - mvPosition.xyz; 2994 #include <worldpos_vertex> 2995 #include <envmap_vertex> 2996 #include <shadowmap_vertex> 2997 #include <fog_vertex> 2998}`,r_=`#define LAMBERT 2999uniform vec3 diffuse; 3000uniform vec3 emissive; 3001uniform float opacity; 3002#include <common> 3003#include <dithering_pars_fragment> 3004#include <color_pars_fragment> 3005#include <uv_pars_fragment> 3006#include <map_pars_fragment> 3007#include <alphamap_pars_fragment> 3008#include <alphatest_pars_fragment> 3009#include <alphahash_pars_fragment> 3010#include <aomap_pars_fragment> 3011#include <lightmap_pars_fragment> 3012#include <emissivemap_pars_fragment> 3013#include <cube_uv_reflection_fragment> 3014#include <envmap_common_pars_fragment> 3015#include <envmap_pars_fragment> 3016#include <envmap_physical_pars_fragment> 3017#include <fog_pars_fragment> 3018#include <bsdfs> 3019#include <lights_pars_begin> 3020#include <normal_pars_fragment> 3021#include <lights_lambert_pars_fragment> 3022#include <shadowmap_pars_fragment> 3023#include <bumpmap_pars_fragment> 3024#include <normalmap_pars_fragment> 3025#include <specularmap_pars_fragment> 3026#include <logdepthbuf_pars_fragment> 3027#include <clipping_planes_pars_fragment> 3028void main() { 3029 vec4 diffuseColor = vec4( diffuse, opacity ); 3030 #include <clipping_planes_fragment> 3031 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3032 vec3 totalEmissiveRadiance = emissive; 3033 #include <logdepthbuf_fragment> 3034 #include <map_fragment> 3035 #include <color_fragment> 3036 #include <alphamap_fragment> 3037 #include <alphatest_fragment> 3038 #include <alphahash_fragment> 3039 #include <specularmap_fragment> 3040 #include <normal_fragment_begin> 3041 #include <normal_fragment_maps> 3042 #include <emissivemap_fragment> 3043 #include <lights_lambert_fragment> 3044 #include <lights_fragment_begin> 3045 #include <lights_fragment_maps> 3046 #include <lights_fragment_end> 3047 #include <aomap_fragment> 3048 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3049 #include <envmap_fragment> 3050 #include <opaque_fragment> 3051 #include <tonemapping_fragment> 3052 #include <colorspace_fragment> 3053 #include <fog_fragment> 3054 #include <premultiplied_alpha_fragment> 3055 #include <dithering_fragment> 3056}`,s_=`#define MATCAP 3057varying vec3 vViewPosition; 3058#include <common> 3059#include <batching_pars_vertex> 3060#include <uv_pars_vertex> 3061#include <color_pars_vertex> 3062#include <displacementmap_pars_vertex> 3063#include <fog_pars_vertex> 3064#include <normal_pars_vertex> 3065#include <morphtarget_pars_vertex> 3066#include <skinning_pars_vertex> 3067#include <logdepthbuf_pars_vertex> 3068#include <clipping_planes_pars_vertex> 3069void main() { 3070 #include <uv_vertex> 3071 #include <color_vertex> 3072 #include <morphinstance_vertex> 3073 #include <morphcolor_vertex> 3074 #include <batching_vertex> 3075 #include <beginnormal_vertex> 3076 #include <morphnormal_vertex> 3077 #include <skinbase_vertex> 3078 #include <skinnormal_vertex> 3079 #include <defaultnormal_vertex> 3080 #include <normal_vertex> 3081 #include <begin_vertex> 3082 #include <morphtarget_vertex> 3083 #include <skinning_vertex> 3084 #include <displacementmap_vertex> 3085 #include <project_vertex> 3086 #include <logdepthbuf_vertex> 3087 #include <clipping_planes_vertex> 3088 #include <fog_vertex> 3089 vViewPosition = - mvPosition.xyz; 3090}`,a_=`#define MATCAP 3091uniform vec3 diffuse; 3092uniform float opacity; 3093uniform sampler2D matcap; 3094varying vec3 vViewPosition; 3095#include <common> 3096#include <dithering_pars_fragment> 3097#include <color_pars_fragment> 3098#include <uv_pars_fragment> 3099#include <map_pars_fragment> 3100#include <alphamap_pars_fragment> 3101#include <alphatest_pars_fragment> 3102#include <alphahash_pars_fragment> 3103#include <fog_pars_fragment> 3104#include <normal_pars_fragment> 3105#include <bumpmap_pars_fragment> 3106#include <normalmap_pars_fragmen
3106t> 3107#include <logdepthbuf_pars_fragment> 3108#include <clipping_planes_pars_fragment> 3109void main() { 3110 vec4 diffuseColor = vec4( diffuse, opacity ); 3111 #include <clipping_planes_fragment> 3112 #include <logdepthbuf_fragment> 3113 #include <map_fragment> 3114 #include <color_fragment> 3115 #include <alphamap_fragment> 3116 #include <alphatest_fragment> 3117 #include <alphahash_fragment> 3118 #include <normal_fragment_begin> 3119 #include <normal_fragment_maps> 3120 vec3 viewDir = normalize( vViewPosition ); 3121 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3122 vec3 y = cross( viewDir, x ); 3123 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3124 #ifdef USE_MATCAP 3125 vec4 matcapColor = texture2D( matcap, uv ); 3126 #else 3127 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3128 #endif 3129 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3130 #include <opaque_fragment> 3131 #include <tonemapping_fragment> 3132 #include <colorspace_fragment> 3133 #include <fog_fragment> 3134 #include <premultiplied_alpha_fragment> 3135 #include <dithering_fragment> 3136}`,o_=`#define NORMAL 3137#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3138 varying vec3 vViewPosition; 3139#endif 3140#include <common> 3141#include <batching_pars_vertex> 3142#include <uv_pars_vertex> 3143#include <displacementmap_pars_vertex> 3144#include <normal_pars_vertex> 3145#include <morphtarget_pars_vertex> 3146#include <skinning_pars_vertex> 3147#include <logdepthbuf_pars_vertex> 3148#include <clipping_planes_pars_vertex> 3149void main() { 3150 #include <uv_vertex> 3151 #include <batching_vertex> 3152 #include <beginnormal_vertex> 3153 #include <morphinstance_vertex> 3154 #include <morphnormal_vertex> 3155 #include <skinbase_vertex> 3156 #include <skinnormal_vertex> 3157 #include <defaultnormal_vertex> 3158 #include <normal_vertex> 3159 #include <begin_vertex> 3160 #include <morphtarget_vertex> 3161 #include <skinning_vertex> 3162 #include <displacementmap_vertex> 3163 #include <project_vertex> 3164 #include <logdepthbuf_vertex> 3165 #include <clipping_planes_vertex> 3166#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3167 vViewPosition = - mvPosition.xyz; 3168#endif 3169}`,l_=`#define NORMAL 3170uniform float opacity; 3171#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3172 varying vec3 vViewPosition; 3173#endif 3174#include <uv_pars_fragment> 3175#include <normal_pars_fragment> 3176#include <bumpmap_pars_fragment> 3177#include <normalmap_pars_fragment> 3178#include <logdepthbuf_pars_fragment> 3179#include <clipping_planes_pars_fragment> 3180void main() { 3181 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3182 #include <clipping_planes_fragment> 3183 #include <logdepthbuf_fragment> 3184 #include <normal_fragment_begin> 3185 #include <normal_fragment_maps> 3186 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3187 #ifdef OPAQUE 3188 gl_FragColor.a = 1.0; 3189 #endif 3190}`,c_=`#define PHONG 3191varying vec3 vViewPosition; 3192#include <common> 3193#include <batching_pars_vertex> 3194#include <uv_pars_vertex> 3195#include <displacementmap_pars_vertex> 3196#include <envmap_pars_vertex> 3197#include <color_pars_vertex> 3198#include <fog_pars_vertex> 3199#include <normal_pars_vertex> 3200#include <morphtarget_pars_vertex> 3201#include <skinning_pars_vertex> 3202#include <shadowmap_pars_vertex> 3203#include <logdepthbuf_pars_vertex> 3204#include <clipping_planes_pars_vertex> 3205void main() { 3206 #include <uv_vertex> 3207 #include <color_vertex> 3208 #include <morphcolor_vertex> 3209 #include <batching_vertex> 3210 #include <beginnormal_vertex> 3211 #include <morphinstance_vertex> 3212 #include <morphnormal_vertex> 3213 #include <skinbase_vertex> 3214 #include <skinnormal_vertex> 3215 #include <defaultnormal_vertex> 3216 #include <normal_vertex> 3217 #include <begin_vertex> 3218 #include <morphtarget_vertex> 3219 #include <skinning_vertex> 3220 #include <displacementmap_vertex> 3221 #include <project_vertex> 3222 #include <logdepthbuf_vertex> 3223 #include <clipping_planes_vertex> 3224 vViewPosition = - mvPosition.xyz; 3225 #include <worldpos_vertex> 3226 #include <envmap_vertex> 3227 #include <shadowmap_vertex> 3228 #include <fog_vertex> 3229}`,h_=`#define PHONG 3230uniform vec3 diffuse; 3231uniform vec3 emissive; 3232uniform vec3 specular; 3233uniform float shininess; 3234uniform float opacity; 3235#include <common> 3236#include <dithering_pars_fragment> 3237#include <color_pars_fragment> 3238#include <uv_pars_fragment> 3239#include <map_pars_fragment> 3240#include <alphamap_pars_fragment> 3241#include <alphatest_pars_fragment> 3242#include <alphahash_pars_fragment> 3243#include <aomap_pars_fragment> 3244#include <lightmap_pars_fragment> 3245#include <emissivemap_pars_fragment> 3246#include <cube_uv_reflection_fragment> 3247#include <envmap_common_pars_fragment> 3248#include <envmap_pars_fragment> 3249#include <envmap_physical_pars_fragment> 3250#include <fog_pars_fragment> 3251#include <bsdfs> 3252#include <lights_pars_begin> 3253#include <normal_pars_fragment> 3254#include <lights_phong_pars_fragment> 3255#include <shadowmap_pars_fragment> 3256#include <bumpmap_pars_fragment> 3257#include <normalmap_pars_fragment> 3258#include <specularmap_pars_fragment> 3259#include <logdepthbuf_pars_fragment> 3260#include <clipping_planes_pars_fragment> 3261void main() { 3262 vec4 diffuseColor = vec4( diffuse, opacity ); 3263 #include <clipping_planes_fragment> 3264 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3265 vec3 totalEmissiveRadiance = emissive; 3266 #include <logdepthbuf_fragment> 3267 #include <map_fragment> 3268 #include <color_fragment> 3269 #include <alphamap_fragment> 3270 #include <alphatest_fragment> 3271 #include <alphahash_fragment> 3272 #include <specularmap_fragment> 3273 #include <normal_fragment_begin> 3274 #include <normal_fragment_maps> 3275 #include <emissivemap_fragment> 3276 #include <lights_phong_fragment> 3277 #include <lights_fragment_begin> 3278 #include <lights_fragment_maps> 3279 #include <lights_fragment_end> 3280 #include <aomap_fragment> 3281 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3282 #include <envmap_fragment> 3283 #include <opaque_fragment> 3284 #include <tonemapping_fragment> 3285 #include <colorspace_fragment> 3286 #include <fog_fragment> 3287 #include <premultiplied_alpha_fragment> 3288 #include <dithering_fragment> 3289}`,u_=`#define STANDARD 3290varying vec3 vViewPosition; 3291#ifdef USE_TRANSMISSION 3292 varying vec3 vWorldPosition; 3293#endif 3294#include <common> 3295#include <batching_pars_vertex> 3296#include <uv_pars_vertex> 3297#include <displacementmap_pars_vertex> 3298#include <color_pars_vertex> 3299#include <fog_pars_vertex> 3300#include <normal_pars_vertex> 3301#include <morphtarget_pars_vertex> 3302#include <skinning_pars_vertex> 3303#include <shadowmap_pars_vertex> 3304#include <logdepthbuf_pars_vertex> 3305#include <clipping_planes_pars_vertex> 3306void main() { 3307 #include <uv_vertex> 3308 #include <color_vertex> 3309 #include <morphinstance_vertex> 3310 #include <morphcolor_vertex> 3311 #include <batching_vertex> 3312 #include <beginnormal_vertex> 3313 #include <morphnormal_vertex> 3314 #include <skinbase_vertex> 3315 #include <skinnormal_vertex> 3316 #include <defaultnormal_vertex> 3317 #include <normal_vertex> 3318 #include <begin_vertex> 3319 #include <morphtarget_vertex> 3320 #include <skinning_vertex> 3321 #include <displacementmap_vertex> 3322 #include <project_vertex> 3323 #include <logdepthbuf_vertex> 3324 #include <clipping_planes_vertex> 3325 vViewPosition = - mvPosition.xyz; 3326 #include <worldpos_vertex> 3327 #include <shadowmap_vertex> 3328 #include <fog_vertex> 3329#ifdef USE_TRANSMISSION 3330 vWorldPosition = worldPosition.xyz; 3331#endif 3332}`,f_=`#define STANDARD 3333#ifdef PHYSICAL 3334 #define IOR 3335 #define USE_SPECULAR 3336#endif 3337uniform vec3 diffuse; 3338uniform vec3 emissive; 3339uniform float roughness; 3340uniform float metalness; 3341uniform float opacity; 3342#ifdef IOR 3343 uniform float ior; 3344#endif 3345#ifdef USE_SPECULAR 3346 uniform float specularIntensity; 3347 uniform vec3 specularColor; 3348 #ifdef USE_SPECULAR_COLORMAP 3349 uniform sampler2D specularColorMap; 3350 #endif 3351 #ifdef USE_SPECULAR_INTENSITYMAP 3352 uniform sampler2D specularIntensityMap; 3353 #endif 3354#endif 3355#ifdef USE_CLEARCOAT 3356 uniform float clearcoat; 3357 uniform float clearcoatRoughness; 3358#endif 3359#ifdef USE_DISPERSION 3360 uniform float dispersion; 3361#endif
3362#ifdef USE_IRIDESCENCE 3363 uniform float iridescence; 3364 uniform float iridescenceIOR; 3365 uniform float iridescenceThicknessMinimum; 3366 uniform float iridescenceThicknessMaximum; 3367#endif 3368#ifdef USE_SHEEN 3369 uniform vec3 sheenColor; 3370 uniform float sheenRoughness; 3371 #ifdef USE_SHEEN_COLORMAP 3372 uniform sampler2D sheenColorMap; 3373 #endif 3374 #ifdef USE_SHEEN_ROUGHNESSMAP 3375 uniform sampler2D sheenRoughnessMap; 3376 #endif 3377#endif 3378#ifdef USE_ANISOTROPY 3379 uniform vec2 anisotropyVector; 3380 #ifdef USE_ANISOTROPYMAP 3381 uniform sampler2D anisotropyMap; 3382 #endif 3383#endif 3384varying vec3 vViewPosition; 3385#include <common> 3386#include <dithering_pars_fragment> 3387#include <color_pars_fragment> 3388#include <uv_pars_fragment> 3389#include <map_pars_fragment> 3390#include <alphamap_pars_fragment> 3391#include <alphatest_pars_fragment> 3392#include <alphahash_pars_fragment> 3393#include <aomap_pars_fragment> 3394#include <lightmap_pars_fragment> 3395#include <emissivemap_pars_fragment> 3396#include <iridescence_fragment> 3397#include <cube_uv_reflection_fragment> 3398#include <envmap_common_pars_fragment> 3399#include <envmap_physical_pars_fragment> 3400#include <fog_pars_fragment> 3401#include <lights_pars_begin> 3402#include <normal_pars_fragment> 3403#include <lights_physical_pars_fragment> 3404#include <transmission_pars_fragment> 3405#include <shadowmap_pars_fragment> 3406#include <bumpmap_pars_fragment> 3407#include <normalmap_pars_fragment> 3408#include <clearcoat_pars_fragment> 3409#include <iridescence_pars_fragment> 3410#include <roughnessmap_pars_fragment> 3411#include <metalnessmap_pars_fragment> 3412#include <logdepthbuf_pars_fragment> 3413#include <clipping_planes_pars_fragment> 3414void main() { 3415 vec4 diffuseColor = vec4( diffuse, opacity ); 3416 #include <clipping_planes_fragment> 3417 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3418 vec3 totalEmissiveRadiance = emissive; 3419 #include <logdepthbuf_fragment> 3420 #include <map_fragment> 3421 #include <color_fragment> 3422 #include <alphamap_fragment> 3423 #include <alphatest_fragment> 3424 #include <alphahash_fragment> 3425 #include <roughnessmap_fragment> 3426 #include <metalnessmap_fragment> 3427 #include <normal_fragment_begin> 3428 #include <normal_fragment_maps> 3429 #include <clearcoat_normal_fragment_begin> 3430 #include <clearcoat_normal_fragment_maps> 3431 #include <emissivemap_fragment> 3432 #include <lights_physical_fragment> 3433 #include <lights_fragment_begin> 3434 #include <lights_fragment_maps> 3435 #include <lights_fragment_end> 3436 #include <aomap_fragment> 3437 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3438 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3439 #include <transmission_fragment> 3440 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3441 #ifdef USE_SHEEN 3442 3443 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3444 3445 #endif 3446 #ifdef USE_CLEARCOAT 3447 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3448 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3449 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3450 #endif 3451 #include <opaque_fragment> 3452 #include <tonemapping_fragment> 3453 #include <colorspace_fragment> 3454 #include <fog_fragment> 3455 #include <premultiplied_alpha_fragment> 3456 #include <dithering_fragment> 3457}`,d_=`#define TOON 3458varying vec3 vViewPosition; 3459#include <common> 3460#include <batching_pars_vertex> 3461#include <uv_pars_vertex> 3462#include <displacementmap_pars_vertex> 3463#include <color_pars_vertex> 3464#include <fog_pars_vertex> 3465#include <normal_pars_vertex> 3466#include <morphtarget_pars_vertex> 3467#include <skinning_pars_vertex> 3468#include <shadowmap_pars_vertex> 3469#include <logdepthbuf_pars_vertex> 3470#include <clipping_planes_pars_vertex> 3471void main() { 3472 #include <uv_vertex> 3473 #include <color_vertex> 3474 #include <morphinstance_vertex> 3475 #include <morphcolor_vertex> 3476 #include <batching_vertex> 3477 #include <beginnormal_vertex> 3478 #include <morphnormal_vertex> 3479 #include <skinbase_vertex> 3480 #include <skinnormal_vertex> 3481 #include <defaultnormal_vertex> 3482 #include <normal_vertex> 3483 #include <begin_vertex> 3484 #include <morphtarget_vertex> 3485 #include <skinning_vertex> 3486 #include <displacementmap_vertex> 3487 #include <project_vertex> 3488 #include <logdepthbuf_vertex> 3489 #include <clipping_planes_vertex> 3490 vViewPosition = - mvPosition.xyz; 3491 #include <worldpos_vertex> 3492 #include <shadowmap_vertex> 3493 #include <fog_vertex> 3494}`,p_=`#define TOON 3495uniform vec3 diffuse; 3496uniform vec3 emissive; 3497uniform float opacity; 3498#include <common> 3499#include <dithering_pars_fragment> 3500#include <color_pars_fragment> 3501#include <uv_pars_fragment> 3502#include <map_pars_fragment> 3503#include <alphamap_pars_fragment> 3504#include <alphatest_pars_fragment> 3505#include <alphahash_pars_fragment> 3506#include <aomap_pars_fragment> 3507#include <lightmap_pars_fragment> 3508#include <emissivemap_pars_fragment> 3509#include <gradientmap_pars_fragment> 3510#include <fog_pars_fragment> 3511#include <bsdfs> 3512#include <lights_pars_begin> 3513#include <normal_pars_fragment> 3514#include <lights_toon_pars_fragment> 3515#include <shadowmap_pars_fragment> 3516#include <bumpmap_pars_fragment> 3517#include <normalmap_pars_fragment> 3518#include <logdepthbuf_pars_fragment> 3519#include <clipping_planes_pars_fragment> 3520void main() { 3521 vec4 diffuseColor = vec4( diffuse, opacity ); 3522 #include <clipping_planes_fragment> 3523 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3524 vec3 totalEmissiveRadiance = emissive; 3525 #include <logdepthbuf_fragment> 3526 #include <map_fragment> 3527 #include <color_fragment> 3528 #include <alphamap_fragment> 3529 #include <alphatest_fragment> 3530 #include <alphahash_fragment> 3531 #include <normal_fragment_begin> 3532 #include <normal_fragment_maps> 3533 #include <emissivemap_fragment> 3534 #include <lights_toon_fragment> 3535 #include <lights_fragment_begin> 3536 #include <lights_fragment_maps> 3537 #include <lights_fragment_end> 3538 #include <aomap_fragment> 3539 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3540 #include <opaque_fragment> 3541 #include <tonemapping_fragment> 3542 #include <colorspace_fragment> 3543 #include <fog_fragment> 3544 #include <premultiplied_alpha_fragment> 3545 #include <dithering_fragment> 3546}`,m_=`uniform float size; 3547uniform float scale; 3548#include <common> 3549#include <color_pars_vertex> 3550#include <fog_pars_vertex> 3551#include <morphtarget_pars_vertex> 3552#include <logdepthbuf_pars_vertex> 3553#include <clipping_planes_pars_vertex> 3554#ifdef USE_POINTS_UV 3555 varying vec2 vUv; 3556 uniform mat3 uvTransform; 3557#endif 3558void main() { 3559 #ifdef USE_POINTS_UV 3560 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3561 #endif 3562 #include <color_vertex> 3563 #include <morphinstance_vertex> 3564 #include <morphcolor_vertex> 3565 #include <begin_vertex> 3566 #include <morphtarget_vertex> 3567 #include <project_vertex> 3568 gl_PointSize = size; 3569 #ifdef USE_SIZEATTENUATION 3570 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3571 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3572 #endif 3573 #include <logdepthbuf_vertex> 3574 #include <clipping_planes_vertex> 3575 #include <worldpos_vertex> 3576 #include <fog_vertex> 3577}`,g_=`uniform vec3 diffuse; 3578uniform float opacity; 3579#include <common> 3580#include <color_pars_fragment> 3581#include <map_particle_pars_fragment> 3582#include <alphatest_pars_fragment> 3583#include <alphahash_pars_fragment> 3584#include <fog_pars_fragment> 3585#include <logdepthbuf_pars_fragment> 3586#include <clipping_planes_pars_fragment> 3587void main() { 3588 vec4 diffuseColor = vec4( diffuse, opacity ); 3589 #include <clipping_planes_fragment> 3590 vec3 outgoingLight = vec3( 0.0 ); 3591 #include <logdepthbuf_fragment> 3592 #include <map_particle_fragment> 3593 #include <color_fragment> 3594 #include <alphatest_fragment> 3595 #include <alphahash_fragment> 3596 outgoingLight = diffuseColor.rgb; 3597 #include <opaque_fragment> 3598 #include <tonemapping_fragment> 3599 #include <colorspace_fragment> 3600 #include <fog_fragment> 3601 #include <premultiplied_alpha_fragment> 3602}`,x_=`#include <common> 3603#include <batching_pars_vertex> 3604#include <fog_pars_vertex> 3605#include <morphtarget_pars_vertex> 3606#include <skinning_pars_vertex> 3607#include <logdepthbuf_pars_vertex> 3608#include <shadowmap_pars_vertex> 3609void main() { 3610 #include <batching_vertex> 3611 #include <beginnormal_vertex> 3612 #include <morphinstance_vertex> 3613 #include <morphnormal_vertex> 3614 #include <skinbase_vertex> 3615 #include <skinnormal_vertex> 3616 #include <defaultnormal_vertex> 3617 #include <begin_vertex> 3618 #include <morphtarget_vertex> 3619 #include <skinning_vertex> 3620 #include <project_vertex> 3621 #include <logdepthbuf_vertex> 3622 #include <worldpos_vertex> 3623 #include <shadowmap_vertex> 3624 #include <fog_vertex> 3625}`,__=`uniform vec3 color; 3626uniform float opacity; 3627#include <common> 3628#include <fog_pars_fragment> 3629#include <bsdfs> 3630#include <lights_pars_begin> 3631#include <logdepthbuf_pars_fragment> 3632#include <shadowmap_pars_fragment> 3633#include <shadowmask_pars_fragment> 3634void main() { 3635 #include <logdepthbuf_fragment> 3636 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3637 #include <tonemapping_fragment> 3638 #include <colorspace_fragment> 3639 #include <fog_fragment> 3640 #include <premultiplied_alpha_fragment> 3641}`,v_=`uniform float rotation; 3642uniform vec2 center; 3643#include <common> 3644#include <uv_pars_vertex> 3645#include <fog_pars_vertex> 3646#include <logdepthbuf_pars_vertex> 3647#include <clipping_planes_pars_vertex> 3648void main() { 3649 #include <uv_vertex> 3650 vec4 mvPosition = modelViewMatrix[ 3 ]; 3651 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3652 #ifndef USE_SIZEATTENUATION 3653 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3654 if ( isPerspective ) scale *= - mvPosition.z; 3655 #endif 3656 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3657 vec2 rotatedPosition; 3658 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3659 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3660 mvPosition.xy += rotatedPosition; 3661 gl_Position = projectionMatrix * mvPosition; 3662 #include <logdepthbuf_vertex> 3663 #include <clipping_planes_vertex> 3664 #include <fog_vertex> 3665}
3665`,y_=`uniform vec3 diffuse; 3666uniform float opacity; 3667#include <common> 3668#include <uv_pars_fragment> 3669#include <map_pars_fragment> 3670#include <alphamap_pars_fragment> 3671#include <alphatest_pars_fragment> 3672#include <alphahash_pars_fragment> 3673#include <fog_pars_fragment> 3674#include <logdepthbuf_pars_fragment> 3675#include <clipping_planes_pars_fragment> 3676void main() { 3677 vec4 diffuseColor = vec4( diffuse, opacity ); 3678 #include <clipping_planes_fragment> 3679 vec3 outgoingLight = vec3( 0.0 ); 3680 #include <logdepthbuf_fragment> 3681 #include <map_fragment> 3682 #include <alphamap_fragment> 3683 #include <alphatest_fragment> 3684 #include <alphahash_fragment> 3685 outgoingLight = diffuseColor.rgb; 3686 #include <opaque_fragment> 3687 #include <tonemapping_fragment> 3688 #include <colorspace_fragment> 3689 #include <fog_fragment> 3690}`,it={alphahash_fragment:Hg,alphahash_pars_fragment:Vg,alphamap_fragment:Gg,alphamap_pars_fragment:Wg,alphatest_fragment:Xg,alphatest_pars_fragment:qg,aomap_fragment:Yg,aomap_pars_fragment:jg,batching_pars_vertex:$g,batching_vertex:Kg,begin_vertex:Zg,beginnormal_vertex:Jg,bsdfs:Qg,iridescence_fragment:e0,bumpmap_pars_fragment:t0,clipping_planes_fragment:n0,clipping_planes_pars_fragment:i0,clipping_planes_pars_vertex:r0,clipping_planes_vertex:s0,color_fragment:a0,color_pars_fragment:o0,color_pars_vertex:l0,color_vertex:c0,common:h0,cube_uv_reflection_fragment:u0,defaultnormal_vertex:f0,displacementmap_pars_vertex:d0,displacementmap_vertex:p0,emissivemap_fragment:m0,emissivemap_pars_fragment:g0,colorspace_fragment:x0,colorspace_pars_fragment:_0,envmap_fragment:v0,envmap_common_pars_fragment:y0,envmap_pars_fragment:S0,envmap_pars_vertex:M0,envmap_physical_pars_fragment:I0,envmap_vertex:b0,fog_vertex:E0,fog_pars_vertex:T0,fog_fragment:w0,fog_pars_fragment:A0,gradientmap_pars_fragment:R0,lightmap_pars_fragment:C0,lights_lambert_fragment:P0,lights_lambert_pars_fragment:D0,lights_pars_begin:L0,lights_toon_fragment:N0,lights_toon_pars_fragment:U0,lights_phong_fragment:O0,lights_phong_pars_fragment:F0,lights_physical_fragment:B0,lights_physical_pars_fragment:z0,lights_fragment_begin:k0,lights_fragment_maps:H0,lights_fragment_end:V0,lightprobes_pars_fragment:G0,logdepthbuf_fragment:W0,logdepthbuf_pars_fragment:X0,logdepthbuf_pars_vertex:q0,logdepthbuf_vertex:Y0,map_fragment:j0,map_pars_fragment:$0,map_particle_fragment:K0,map_particle_pars_fragment:Z0,metalnessmap_fragment:J0,metalnessmap_pars_fragment:Q0,morphinstance_vertex:ex,morphcolor_vertex:tx,morphnormal_vertex:nx,morphtarget_pars_vertex:ix,morphtarget_vertex:rx,normal_fragment_begin:sx,normal_fragment_maps:ax,normal_pars_fragment:ox,normal_pars_vertex:lx,normal_vertex:cx,normalmap_pars_fragment:hx,clearcoat_normal_fragment_begin:ux,clearcoat_normal_fragment_maps:fx,clearcoat_pars_fragment:dx,iridescence_pars_fragment:px,opaque_fragment:mx,packing:gx,premultiplied_alpha_fragment:xx,project_vertex:_x,dithering_fragment:vx,dithering_pars_fragment:yx,roughnessmap_fragment:Sx,roughnessmap_pars_fragment:Mx,shadowmap_pars_fragment:bx,shadowmap_pars_vertex:Ex,shadowmap_vertex:Tx,shadowmask_pars_fragment:wx,skinbase_vertex:Ax,skinning_pars_vertex:Rx,skinning_vertex:Cx,skinnormal_vertex:Px,specularmap_fragment:Dx,specularmap_pars_fragment:Lx,tonemapping_fragment:Ix,tonemapping_pars_fragment:Nx,transmission_fragment:Ux,transmission_pars_fragment:Ox,uv_pars_fragment:Fx,uv_pars_vertex:Bx,uv_vertex:zx,worldpos_vertex:kx,background_vert:Hx,background_frag:Vx,backgroundCube_vert:Gx,backgroundCube_frag:Wx,cube_vert:Xx,cube_frag:qx,depth_vert:Yx,depth_frag:jx,distance_vert:$x,distance_frag:Kx,equirect_vert:Zx,equirect_frag:Jx,linedashed_vert:Qx,linedashed_frag:e_,meshbasic_vert:t_,meshbasic_frag:n_,meshlambert_vert:i_,meshlambert_frag:r_,meshmatcap_vert:s_,meshmatcap_frag:a_,meshnormal_vert:o_,meshnormal_frag:l_,meshphong_vert:c_,meshphong_frag:h_,meshphysical_vert:u_,meshphysical_frag:f_,meshtoon_vert:d_,meshtoon_frag:p_,points_vert:m_,points_frag:g_,shadow_vert:x_,shadow_frag:__,sprite_vert:v_,sprite_frag:y_},Le={common:{diffuse:{value:new at(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new je}},envmap:{envMap:{value:null},envMapRotation:{value:new je},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new je}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new je}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new je},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new je},normalScale:{value:new de(1,1)}}
vendor: 6,842 bytes, line 3690
3690,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new je},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new je}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new je}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new je}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new at(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new V},probesMax:{value:new V},probesResolution:{value:new V}},points:{diffuse:{value:new at(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0},uvTransform:{value:new je}},sprite:{diffuse:{value:new at(16777215)},opacity:{value:1},center:{value:new de(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}}},Ln={basic:{uniforms:Zt([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.fog]),vertexShader:it.meshbasic_vert,fragmentShader:it.meshbasic_frag},lambert:{uniforms:Zt([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new at(0)},envMapIntensity:{value:1}}]),vertexShader:it.meshlambert_vert,fragmentShader:it.meshlambert_frag},phong:{uniforms:Zt([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new at(0)},specular:{value:new at(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:it.meshphong_vert,fragmentShader:it.meshphong_frag},standard:{uniforms:Zt([Le.common,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.roughnessmap,Le.metalnessmap,Le.fog,Le.lights,{emissive:{value:new at(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag},toon:{uniforms:Zt([Le.common,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.gradientmap,Le.fog,Le.lights,{emissive:{value:new at(0)}}]),vertexShader:it.meshtoon_vert,fragmentShader:it.meshtoon_frag},matcap:{uniforms:Zt([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,{matcap:{value:null}}]),vertexShader:it.meshmatcap_vert,fragmentShader:it.meshmatcap_frag},points:{uniforms:Zt([Le.points,Le.fog]),vertexShader:it.points_vert,fragmentShader:it.points_frag},dashed:{uniforms:Zt([Le.common,Le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:it.linedashed_vert,fragmentShader:it.linedashed_frag},depth:{uniforms:Zt([Le.common,Le.displacementmap]),vertexShader:it.depth_vert,fragmentShader:it.depth_frag},normal:{uniforms:Zt([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,{opacity:{value:1}}]),vertexShader:it.meshnormal_vert,fragmentShader:it.meshnormal_frag},sprite:{uniforms:Zt([Le.sprite,Le.fog]),vertexShader:it.sprite_vert,fragmentShader:it.sprite_frag},background:{uniforms:{uvTransform:{value:new je},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:it.background_vert,fragmentShader:it.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new je}},vertexShader:it.backgroundCube_vert,fragmentShader:it.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:it.cube_vert,fragmentShader:it.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:it.equirect_vert,fragmentShader:it.equirect_frag},distance:{uniforms:Zt([Le.common,Le.displacementmap,{referencePosition:{value:new V},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:it.distance_vert,fragmentShader:it.distance_frag},shadow:{uniforms:Zt([Le.lights,Le.fog,{color:{value:new at(0)},opacity:{value:1}}]),vertexShader:it.shadow_vert,fragmentShader:it.shadow_frag}};Ln.physical={uniforms:Zt([Ln.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new je},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new je},clearcoatNormalScale:{value:new de(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new je},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new je},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new je},sheen:{value:0},sheenColor:{value:new at(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new je},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new je},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new je},transmissionSamplerSize:{value:new de},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new je},attenuationDistance:{value:0},attenuationColor:{value:new at(0)},specularColor:{value:new at(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new je},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new je},anisotropyVector:{value:new de},anisotropyMap:{value:null},anisotropyMapTransform:{value:new je}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag};const Bs={r:0,b:0,g:0},S_=new pt,Ku=new je;Ku.set(-1,0,0,0,1,0,0,0,1);
vendor: 21,563 bytes, lines 3690-3763
3690function M_(i,e,t,n,r,s){const a=new at(0);let o=r===!0?0:1,l,c,u=null,f=0,h=null;function d(w){let E=w.isScene===!0?w.background:null;if(E&&E.isTexture){const S=w.backgroundBlurriness>0;E=e.get(E,S)}return E}function g(w){let E=!1;const S=d(w);S===null?m(a,o):S&&S.isColor&&(m(S,1),E=!0);const b=i.xr.getEnvironmentBlendMode();b==="additive"?t.buffers.color.setClear(0,0,0,1,s):b==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||E)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function v(w,E){const S=d(E);S&&(S.isCubeTexture||S.mapping===Aa)?(c===void 0&&(c=new Ot(new Tt(1,1,1),new zn({name:"BackgroundCubeMaterial",uniforms:Cr(Ln.backgroundCube.uniforms),vertexShader:Ln.backgroundCube.vertexShader,fragmentShader:Ln.backgroundCube.fragmentShader,side:en,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(b,T,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=S,c.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(S_.makeRotationFromEuler(E.backgroundRotation)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Ku),c.material.toneMapped=lt.getTransfer(S.colorSpace)!==dt,(u!==S||f!==S.version||h!==i.toneMapping)&&(c.material.needsUpdate=!0,u=S,f=S.version,h=i.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null)):S&&S.isTexture&&(l===void 0&&(l=new Ot(new Rr(2,2),new zn({name:"BackgroundMaterial",uniforms:Cr(Ln.background.uniforms),vertexShader:Ln.background.vertexShader,fragmentShader:Ln.background.fragmentShader,side:Si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=S,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.toneMapped=lt.getTransfer(S.colorSpace)!==dt,S.matrixAutoUpdate===!0&&S.updateMatrix(),l.material.uniforms.uvTransform.value.copy(S.matrix),(u!==S||f!==S.version||h!==i.toneMapping)&&(l.material.needsUpdate=!0,u=S,f=S.version,h=i.toneMapping),l.layers.enableAll(),w.unshift(l,l.geometry,l.material,0,0,null))}function m(w,E){w.getRGB(Bs,Xu(i)),t.buffers.color.setClear(Bs.r,Bs.g,Bs.b,E,s)}function p(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(w,E=1){a.set(w),o=E,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(w){o=w,m(a,o)},render:g,addToRenderList:v,dispose:p}}function b_(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=h(null);let s=r,a=!1;function o(B,U,te,ee,$){let ne=!1;const K=f(B,ee,te,U);s!==K&&(s=K,c(s.object)),ne=d(B,ee,te,$),ne&&g(B,ee,te,$),$!==null&&e.update($,i.ELEMENT_ARRAY_BUFFER),(ne||a)&&(a=!1,S(B,U,te,ee),$!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get($).buffer))}function l(){return i.createVertexArray()}function c(B){return i.bindVertexArray(B)}function u(B){return i.deleteVertexArray(B)}function f(B,U,te,ee){const $=ee.wireframe===!0;let ne=n[U.id];ne===void 0&&(ne={},n[U.id]=ne);const K=B.isInstancedMesh===!0?B.id:0;let X=ne[K];X===void 0&&(X={},ne[K]=X);let ge=X[te.id];ge===void 0&&(ge={},X[te.id]=ge);let _e=ge[$];return _e===void 0&&(_e=h(l()),ge[$]=_e),_e}function h(B){const U=[],te=[],ee=[];for(let $=0;$<t;$++)U[$]=0,te[$]=0,ee[$]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:te,attributeDivisors:ee,object:B,attributes:{},index:null}}function d(B,U,te,ee){const $=s.attributes,ne=U.attributes;let K=0;const X=te.getAttributes();for(const ge in X)if(X[ge].location>=0){const ve=$[ge];let Ee=ne[ge];if(Ee===void 0&&(ge==="instanceMatrix"&&B.instanceMatrix&&(Ee=B.instanceMatrix),ge==="instanceColor"&&B.instanceColor&&(Ee=B.instanceColor)),ve===void 0||ve.attribute!==Ee||Ee&&ve.data!==Ee.data)return!0;K++}return s.attributesNum!==K||s.index!==ee}function g(B,U,te,ee){const $={},ne=U.attributes;let K=0;const X=te.getAttributes();for(const ge in X)if(X[ge].location>=0){let ve=ne[ge];ve===void 0&&(ge==="instanceMatrix"&&B.instanceMatrix&&(ve=B.instanceMatrix),ge==="instanceColor"&&B.instanceColor&&(ve=B.instanceColor));const Ee={};Ee.attribute=ve,ve&&ve.data&&(Ee.data=ve.data),$[ge]=Ee,K++}s.attributes=$,s.attributesNum=K,s.index=ee}function v(){const B=s.newAttributes;for(let U=0,te=B.length;U<te;U++)B[U]=0}function m(B){p(B,0)}function p(B,U){const te=s.newAttributes,ee=s.enabledAttributes,$=s.attributeDivisors;te[B]=1,ee[B]===0&&(i.enableVertexAttribArray(B),ee[B]=1),$[B]!==U&&(i.vertexAttribDivisor(B,U),$[B]=U)}function w(){const B=s.newAttributes,U=s.enabledAttributes;for(let te=0,ee=U.length;te<ee;te++)U[te]!==B[te]&&(i.disableVertexAttribArray(te),U[te]=0)}function E(B,U,te,ee,$,ne,K){K===!0?i.vertexAttribIPointer(B,U,te,$,ne):i.vertexAttribPointer(B,U,te,ee,$,ne)}function S(B,U,te,ee){v();const $=ee.attributes,ne=te.getAttributes(),K=U.defaultAttributeValues;for(const X in ne){const ge=ne[X];if(ge.location>=0){let _e=$[X];if(_e===void 0&&(X==="instanceMatrix"&&B.instanceMatrix&&(_e=B.instanceMatrix),X==="instanceColor"&&B.instanceColor&&(_e=B.instanceColor)),_e!==void 0){const ve=_e.normalized,Ee=_e.itemSize,We=e.get(_e);if(We===void 0)continue;const Je=We.buffer,Ue=We.type,ie=We.bytesPerElement,q=Ue===i.INT||Ue===i.UNSIGNED_INT||_e.gpuType===El;if(_e.isInterleavedBufferAttribute){const F=_e.data,O=F.stride,P=_e.offset;if(F.isInstancedInterleavedBuffer){for(let W=0;W<ge.locationSize;W++)p(ge.location+W,F.meshPerAttribute);B.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=F.meshPerAttribute*F.count)}else for(let W=0;W<ge.locationSize;W++)m(ge.location+W);i.bindBuffer(i.ARRAY_BUFFER,Je);for(let W=0;W<ge.locationSize;W++)E(ge.location+W,Ee/ge.locationSize,Ue,ve,O*ie,(P+Ee/ge.locationSize*W)*ie,q)}else{if(_e.isInstancedBufferAttribute){for(let F=0;F<ge.locationSize;F++)p(ge.location+F,_e.meshPerAttribute);B.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=_e.meshPerAttribute*_e.count)}else for(let F=0;F<ge.locationSize;F++)m(ge.location+F);i.bindBuffer(i.ARRAY_BUFFER,Je);for(let F=0;F<ge.locationSize;F++)E(ge.location+F,Ee/ge.locationSize,Ue,ve,Ee*ie,Ee/ge.locationSize*F*ie,q)}}else if(K!==void 0){const ve=K[X];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ge.location,ve);break;case 3:i.vertexAttrib3fv(ge.location,ve);break;case 4:i.vertexAttrib4fv(ge.location,ve);break;default:i.vertexAttrib1fv(ge.location,ve)}}}}w()}function b(){A();for(const B in n){const U=n[B];for(const te in U){const ee=U[te];for(const $ in ee){const ne=ee[$];for(const K in ne)u(ne[K].object),delete ne[K];delete ee[$]}}delete n[B]}}function T(B){if(n[B.id]===void 0)return;const U=n[B.id];for(const te in U){const ee=U[te];for(const $ in ee){const ne=ee[$];for(const K in ne)u(ne[K].object),delete ne[K];delete ee[$]}}delete n[B.id]}function L(B){for(const U in n){const te=n[U];for(const ee in te){const $=te[ee];if($[B.id]===void 0)continue;const ne=$[B.id];for(const K in ne)u(ne[K].object),delete ne[K];delete $[B.id]}}}function x(B){for(const U in n){const te=n[U],ee=B.isInstancedMesh===!0?B.id:0,$=te[ee];if($!==void 0){for(const ne in $){const K=$[ne];for(const X in K)u(K[X].object),delete K[X];delete $[ne]}delete te[ee],Object.keys(te).length===0&&delete n[U]}}}function A(){k(),a=!0,s!==r&&(s=r,c(s.object))}function k(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:A,resetDefaultState:k,dispose:b,releaseStatesOfGeometry:T,releaseStatesOfObject:x,releaseStatesOfProgram:L,initAttributes:v,enableAttribute:m,disableUnusedAttributes:w}}function E_(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function o(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let h=0;for(let d=0;d<u;d++)h+=c[d];t.update(h,n,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function T_(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(L){return!(L!==wn&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(L){const x=L===Qn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==fn&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Tn&&!x)}function l(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(Ze("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&Ze("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),w=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),S=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),b=i.getParameter(i.MAX_SAMPLES),T=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:h,maxTextures:d,maxVertexTextures:g,maxTextureSize:v,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:w,maxVaryings:E,maxFragmentUniforms:S,maxSamples:b,samples:T}}function w_(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new gi,o=new je,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const d=f.length!==0||h||n!==0||r;return r=h,n=f.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,d){const g=f.clippingPlanes,v=f.clipIntersection,m=f.clipShadows,p=i.get(f);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const w=s?0:n,E=w*4;let S=p.clippingState||null;l.value=S,S=u(g,h,E,d);for(let b=0;b!==E;++b)S[b]=t[b];p.clippingState=S,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=w}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,h,d,g){const v=f!==null?f.length:0;let m=null;if(v!==0){if(m=l.value,g!==!0||m===null){const p=d+v*4,w=h.matrixWorldInverse;o.getNormalMatrix(w),(m===null||m.length<p)&&(m=new Float32Array(p));for(let E=0,S=d;E!==v;++E,S+=4)a.copy(f[E]).applyMatrix4(w,o),a.normal.toArray(m,S),m[S+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}const yi=4,sh=[.125,.215,.35,.446,.526,.582],Ii=20,A_=256,Gr=new jl,ah=new at;let lo=null,co=0,ho=0,uo=!1;const R_=new V;class oh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=R_}=s;lo=this._renderer.getRenderTarget(),co=this._renderer.getActiveCubeFace(),ho=this._renderer.getActiveMipmapLevel(),uo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=hh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ch(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(lo,co,ho),this._renderer.xr.enabled=uo,e.scissorTest=!1,hr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Fi||e.mapping===Er?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),lo=this._renderer.getRenderTarget(),co=this._renderer.getActiveCubeFace(),ho=this._renderer.getActiveMipmapLevel(),uo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:qt,minFilter:qt,generateMipmaps:!1,type:Qn,format:wn,colorSpace:la,depthBuffer:!1},r=lh(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=lh(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=C_(s)),this._blurMaterial=D_(s,e,t),this._ggxMaterial=P_(s,e,t)}return r}_compileMaterial(e){const t=new Ot(new jt,e);this._renderer.compile(t,Gr)}_sceneToCubeUV(e,t,n,r,s){const l=new xn(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,h=f.autoClear,d=f.toneMapping;f.getClearColor(ah),f.toneMapping=On,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Ot(new Tt,new zi({name:"PMREM.Background",side:en,depthWrite:!1,depthTest:!1})));const v=this._backgroundBox,m=v.material;let p=!1;const w=e.background;w?w.isColor&&(m.color.copy(w),e.background=null,p=!0):(m.color.copy(ah),p=!0);for(let E=0;E<6;E++){const S=E%3;S===0?(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[E],s.y,s.z)):S===1?(l.up.set(0,0,c[E]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[E],s.z)):(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[E]));const b=this._cubeSize;hr(r,S*b,E>2?b:0,b,b),f.setRenderTarget(r),p&&f.render(v,l),f.render(e,l)}f.toneMapping=d,f.autoClear=h,e.background=w}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Fi||e.mapping===Er;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=hh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ch());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;hr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Gr)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const l=a.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),h=0+c*1.25,d=f*h,{_lodMax:g}=this,v=this._sizeLods[n],m=3*v*(n>g-yi?n-g+yi:0),p=4*(this._cubeSize-v);l.envMap.value=e.texture,l.roughness.value=d,l.mipInt.value=g-t,hr(s,m,p,3*v,2*v),r.setRenderTarget(s),r.render(o,Gr),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=g-n,hr(e,m,p,3*v,2*v),r.setRenderTarget(e),r.render(o,Gr)}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&ot("blur direction must be either latitudinal or longitudinal!");const u=3,f=this._lodMeshes[r];f.material=c;const h=c.uniforms,d=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Ii-1),v=s/g,m=isFinite(s)?1+Math.floor(u*v):Ii;m>Ii&&Ze(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ii}`);const p=[];let w=0;for(let L=0;L<Ii;++L){const x=L/v,A=Math.exp(-x*x/2);p.push(A),L===0?w+=A:L<m&&(w+=2*A)}for(let L=0;L<p.length;L++)p[L]=p[L]/w;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=p,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:E}=this;h.dTheta.value=g,h.mipInt.value=E-n;const S=this._sizeLods[r],b=3*S*(r>E-yi?r-E+yi:0),T=4*(this._cubeSize-S);hr(t,b,T,3*S,2*S),l.setRenderTarget(t),l.render(f,Gr)}}function C_(i){const e=[],t=[],n=[];let r=i;const s=i-yi+1+sh.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>i-yi?l=sh[a-i+yi-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],d=6,g=6,v=3,m=2,p=1,w=new Float32Array(v*g*d),E=new Float32Array(m*g*d),S=new Float32Array(p*g*d);for(let T=0;T<d;T++){const L=T%3*2/3-1,x=T>2?0:-1,A=[L,x,0,L+2/3,x,0,L+2/3,x+1,0,L,x,0,L+2/3,x+1,0,L,x+1,0];w.set(A,v*g*T),E.set(h,m*g*T);const k=[T,T,T,T,T,T];S.set(k,p*g*T)}const b=new jt;b.setAttribute("position",new vn(w,v)),b.setAttribute("uv",new vn(E,m)),b.setAttribute("faceIndex",new vn(S,p)),n.push(new Ot(b,null)),r>yi&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function lh(i,e,t){const n=new Fn(i,e,t);return n.texture.mapping=Aa,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function hr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function P_(i,e,t){return new zn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:A_,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Ra(),fragmentShader:` 3691 3692 precision highp float; 3693 precision highp int; 3694 3695 varying vec3 vOutputDirection; 3696 3697 uniform sampler2D envMap; 3698 uniform float roughness; 3699 uniform float mipInt; 3700 3701 #define ENVMAP_TYPE_CUBE_UV 3702 #include <cube_uv_reflection_fragment> 3703 3704 #define PI 3.14159265359 3705 3706 // Van der Corput radical inverse 3707 float radicalInverse_VdC(uint bits) { 3708 bits = (bits << 16u) | (bits >> 16u); 3709 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3710 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3711 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3712 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3713 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3714 } 3715 3716 // Hammersley sequence 3717 vec2 hammersley(uint i, uint N) { 3718 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3719 } 3720 3721 // GGX VNDF importance sampling (Eric Heitz 2018) 3722 // "Sampling the GGX Distribution of Visible Normals" 3723 // https://jcgt.org/published/0007/04/01/ 3724 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3725 float alpha = roughness * roughness; 3726 3727 // Section 4.1: Orthonormal basis 3728 vec3 T1 = vec3(1.0, 0.0, 0.0); 3729 vec3 T2 = cross(V, T1); 3730 3731 // Section 4.2: Parameterization of projected area 3732 float r = sqrt(Xi.x); 3733 float phi = 2.0 * PI * Xi.y; 3734 float t1 = r * cos(phi); 3735 float t2 = r * sin(phi); 3736 float s = 0.5 * (1.0 + V.z); 3737 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3738 3739 // Section 4.3: Reprojection onto hemisphere 3740 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 3741 3742 // Section 3.4: Transform back to ellipsoid configuration 3743 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3744 } 3745 3746 void main() { 3747 vec3 N = normalize(vOutputDirection); 3748 vec3 V = N; // Assume view direction equals normal for pre-filtering 3749 3750 vec3 prefilteredColor = vec3(0.0); 3751 float totalWeight = 0.0; 3752 3753 // For very low roughness, just sample the environment directly 3754 if (roughness < 0.001) { 3755 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3756 return; 3757 } 3758 3759 // Tangent space basis for VNDF sampling 3760 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3761 vec3 tangent = normalize(cross(up, N)); 3762 vec3 bitangent = cross(N, tangent); 3763
3764 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3765 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3766 3767 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3768 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3769 3770 // Transform H back to world space 3771 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3772 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3773 3774 float NdotL = max(dot(N, L), 0.0); 3775 3776 if(NdotL > 0.0) { 3777 // Sample environment at fixed mip level 3778 // VNDF importance sampling handles the distribution filtering 3779 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3780 3781 // Weight by NdotL for the split-sum approximation 3782 // VNDF PDF naturally accounts for the visible microfacet distribution 3783 prefilteredColor += sampleColor * NdotL; 3784 totalWeight += NdotL; 3785 } 3786 } 3787 3788 if (totalWeight > 0.0) { 3789 prefilteredColor = prefilteredColor / totalWeight; 3790 } 3791 3792 gl_FragColor = vec4(prefilteredColor, 1.0); 3793 } 3794 `,blending:Kn,depthTest:!1,depthWrite:!1})}function D_(i,e,t){const n=new Float32Array(Ii),r=new V(0,1,0);return new zn({name:"SphericalGaussianBlur",defines:{n:Ii,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ra(),fragmentShader:` 3795 3796 precision mediump float; 3797 precision mediump int; 3798 3799 varying vec3 vOutputDirection; 3800 3801 uniform sampler2D envMap; 3802 uniform int samples; 3803 uniform float weights[ n ]; 3804 uniform bool latitudinal; 3805 uniform float dTheta; 3806 uniform float mipInt; 3807 uniform vec3 poleAxis; 3808 3809 #define ENVMAP_TYPE_CUBE_UV 3810 #include <cube_uv_reflection_fragment> 3811 3812 vec3 getSample( float theta, vec3 axis ) { 3813 3814 float cosTheta = cos( theta ); 3815 // Rodrigues' axis-angle rotation 3816 vec3 sampleDirection = vOutputDirection * cosTheta 3817 + cross( axis, vOutputDirection ) * sin( theta ) 3818 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3819 3820 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3821 3822 } 3823 3824 void main() { 3825 3826 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3827 3828 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3829 3830 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3831 3832 } 3833 3834 axis = normalize( axis ); 3835 3836 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3837 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3838 3839 for ( int i = 1; i < n; i++ ) { 3840 3841 if ( i >= samples ) { 3842 3843 break; 3844 3845 } 3846 3847 float theta = dTheta * float( i ); 3848 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3849 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3850 3851 } 3852 3853 } 3854 `,blending:Kn,depthTest:!1,depthWrite:!1})}function ch(){return new zn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ra(),fragmentShader:` 3855 3856 precision mediump float; 3857 precision mediump int; 3858 3859 varying vec3 vOutputDirection; 3860 3861 uniform sampler2D envMap; 3862 3863 #include <common> 3864 3865 void main() { 3866 3867 vec3 outputDirection = normalize( vOutputDirection ); 3868 vec2 uv = equirectUv( outputDirection ); 3869 3870 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3871 3872 } 3873 `,blending:Kn,depthTest:!1,depthWrite:!1})}function hh(){return new zn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ra(),fragmentShader:` 3874 3875 precision mediump float; 3876 precision mediump int; 3877 3878 uniform float flipEnvMap; 3879 3880 varying vec3 vOutputDirection; 3881 3882 uniform samplerCube envMap; 3883 3884 void main() { 3885 3886 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3887 3888 } 3889 `,blending:Kn,depthTest:!1,depthWrite:!1})}function Ra(){return` 3890 3891 precision mediump float; 3892 precision mediump int; 3893 3894 attribute float faceIndex; 3895 3896 varying vec3 vOutputDirection; 3897 3898 // RH coordinate system; PMREM face-indexing convention 3899 vec3 getDirection( vec2 uv, float face ) { 3900 3901 uv = 2.0 * uv - 1.0; 3902 3903 vec3 direction = vec3( uv, 1.0 ); 3904 3905 if ( face == 0.0 ) { 3906 3907 direction = direction.zyx; // ( 1, v, u ) pos x 3908 3909 } else if ( face == 1.0 ) { 3910 3911 direction = direction.xzy; 3912 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3913 3914 } else if ( face == 2.0 ) { 3915 3916 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3917 3918 } else if ( face == 3.0 ) { 3919 3920 direction = direction.zyx; 3921 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3922 3923 } else if ( face == 4.0 ) { 3924 3925 direction = direction.xzy; 3926 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3927 3928 } else if ( face == 5.0 ) { 3929 3930 direction.z *= -1.0; // ( u, v, -1 ) neg z 3931 3932 } 3933 3934 return direction; 3935 3936 } 3937 3938 void main() { 3939 3940 vOutputDirection = getDirection( uv, faceIndex ); 3941 gl_Position = vec4( position, 1.0 ); 3942 3943 } 3944 `}class Zu extends Fn{constructor(e=1,t={}
vendor: 25,819 bytes, lines 3944-4060
3944){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Uu(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 3945 3946 varying vec3 vWorldDirection; 3947 3948 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 3949 3950 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 3951 3952 } 3953 3954 void main() { 3955 3956 vWorldDirection = transformDirection( position, modelMatrix ); 3957 3958 #include <begin_vertex> 3959 #include <project_vertex> 3960 3961 } 3962 `,fragmentShader:` 3963 3964 uniform sampler2D tEquirect; 3965 3966 varying vec3 vWorldDirection; 3967 3968 #include <common> 3969 3970 void main() { 3971 3972 vec3 direction = normalize( vWorldDirection ); 3973 3974 vec2 sampleUV = equirectUv( direction ); 3975 3976 gl_FragColor = texture2D( tEquirect, sampleUV ); 3977 3978 } 3979 `},r=new Tt(5,5,5),s=new zn({name:"CubemapFromEquirect",uniforms:Cr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:en,blending:Kn});s.uniforms.tEquirect.value=t;const a=new Ot(r,s),o=t.minFilter;return t.minFilter===Ui&&(t.minFilter=qt),new Ng(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}function L_(i){let e=new WeakMap,t=new WeakMap,n=null;function r(h,d=!1){return h==null?null:d?a(h):s(h)}function s(h){if(h&&h.isTexture){const d=h.mapping;if(d===Da||d===La)if(e.has(h)){const g=e.get(h).texture;return o(g,h.mapping)}else{const g=h.image;if(g&&g.height>0){const v=new Zu(g.height);return v.fromEquirectangularTexture(i,h),e.set(h,v),h.addEventListener("dispose",c),o(v.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const d=h.mapping,g=d===Da||d===La,v=d===Fi||d===Er;if(g||v){let m=t.get(h);const p=m!==void 0?m.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==p)return n===null&&(n=new oh(i)),m=g?n.fromEquirectangular(h,m):n.fromCubemap(h,m),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),m.texture;if(m!==void 0)return m.texture;{const w=h.image;return g&&w&&w.height>0||v&&w&&l(w)?(n===null&&(n=new oh(i)),m=g?n.fromEquirectangular(h):n.fromCubemap(h),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),h.addEventListener("dispose",u),m.texture):null}}}return h}function o(h,d){return d===Da?h.mapping=Fi:d===La&&(h.mapping=Er),h}function l(h){let d=0;const g=6;for(let v=0;v<g;v++)h[v]!==void 0&&d++;return d===g}function c(h){const d=h.target;d.removeEventListener("dispose",c);const g=e.get(d);g!==void 0&&(e.delete(d),g.dispose())}function u(h){const d=h.target;d.removeEventListener("dispose",u);const g=t.get(d);g!==void 0&&(t.delete(d),g.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function I_(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&xr("WebGLRenderer: "+n+" extension not supported."),r}}}function N_(i,e,t,n){const r={},s=new WeakMap;function a(f){const h=f.target;h.index!==null&&e.remove(h.index);for(const g in h.attributes)e.remove(h.attributes[g]);h.removeEventListener("dispose",a),delete r[h.id];const d=s.get(h);d&&(e.remove(d),s.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(f,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(f){const h=f.attributes;for(const d in h)e.update(h[d],i.ARRAY_BUFFER)}function c(f){const h=[],d=f.index,g=f.attributes.position;let v=0;if(g===void 0)return;if(d!==null){const w=d.array;v=d.version;for(let E=0,S=w.length;E<S;E+=3){const b=w[E+0],T=w[E+1],L=w[E+2];h.push(b,T,T,L,L,b)}}else{const w=g.array;v=g.version;for(let E=0,S=w.length/3-1;E<S;E+=3){const b=E+0,T=E+1,L=E+2;h.push(b,T,T,L,L,b)}}const m=new(g.count>=65535?Du:Pu)(h,1);m.version=v;const p=s.get(f);p&&e.remove(p),s.set(f,m)}function u(f){const h=s.get(f);if(h){const d=f.index;d!==null&&h.version<d.version&&c(f)}else c(f);return s.get(f)}return{get:o,update:l,getWireframeAttribute:u}}function U_(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,h){i.drawElements(n,h,s,f*a),t.update(h,n,1)}function c(f,h,d){d!==0&&(i.drawElementsInstanced(n,h,s,f*a,d),t.update(h,n,d))}function u(f,h,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,h,0,s,f,0,d);let v=0;for(let m=0;m<d;m++)v+=h[m];t.update(v,n,1)}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function O_(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:ot("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function F_(i,e,t){const n=new WeakMap,r=new At;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=u!==void 0?u.length:0;let h=n.get(o);if(h===void 0||h.count!==f){let A=function(){L.dispose(),n.delete(o),o.removeEventListener("dispose",A)};h!==void 0&&h.texture.dispose();const d=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],w=o.morphAttributes.color||[];let E=0;d===!0&&(E=1),g===!0&&(E=2),v===!0&&(E=3);let S=o.attributes.position.count*E,b=1;S>e.maxTextureSize&&(b=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const T=new Float32Array(S*b*4*f),L=new Ru(T,S,b,f);L.type=Tn,L.needsUpdate=!0;const x=E*4;for(let k=0;k<f;k++){const B=m[k],U=p[k],te=w[k],ee=S*b*4*k;for(let $=0;$<B.count;$++){const ne=$*x;d===!0&&(r.fromBufferAttribute(B,$),T[ee+ne+0]=r.x,T[ee+ne+1]=r.y,T[ee+ne+2]=r.z,T[ee+ne+3]=0),g===!0&&(r.fromBufferAttribute(U,$),T[ee+ne+4]=r.x,T[ee+ne+5]=r.y,T[ee+ne+6]=r.z,T[ee+ne+7]=0),v===!0&&(r.fromBufferAttribute(te,$),T[ee+ne+8]=r.x,T[ee+ne+9]=r.y,T[ee+ne+10]=r.z,T[ee+ne+11]=te.itemSize===4?r.w:1)}}h={count:f,texture:L,size:new de(S,b)},n.set(o,h),o.addEventListener("dispose",A)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let d=0;for(let v=0;v<c.length;v++)d+=c[v];const g=o.morphTargetsRelative?1:1-d;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",h.size)}return{update:s}}function B_(i,e,t,n,r){let s=new WeakMap;function a(c){const u=r.render.frame,f=c.geometry,h=e.get(c,f);if(s.get(h)!==u&&(e.update(h),s.set(h,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){const d=c.skeleton;s.get(d)!==u&&(d.update(),s.set(d,u))}return h}function o(){s=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}const z_={[du]:"LINEAR_TONE_MAPPING",[pu]:"REINHARD_TONE_MAPPING",[mu]:"CINEON_TONE_MAPPING",[gu]:"ACES_FILMIC_TONE_MAPPING",[_u]:"AGX_TONE_MAPPING",[vu]:"NEUTRAL_TONE_MAPPING",[xu]:"CUSTOM_TONE_MAPPING"};function k_(i,e,t,n,r,s){const a=new Fn(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Tr(e,t):void 0}),o=new Fn(e,t,{type:Qn,depthBuffer:!1,stencilBuffer:!1}),l=new jt;l.setAttribute("position",new bt([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new bt([0,2,0,0,2,0],2));const c=new bg({uniforms:{tDiffuse:{value:null}},vertexShader:` 3980 precision highp float; 3981 3982 uniform mat4 modelViewMatrix; 3983 uniform mat4 projectionMatrix; 3984 3985 attribute vec3 position; 3986 attribute vec2 uv; 3987 3988 varying vec2 vUv; 3989 3990 void main() { 3991 vUv = uv; 3992 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3993 }`,fragmentShader:` 3994 precision highp float; 3995 3996 uniform sampler2D tDiffuse; 3997 3998 varying vec2 vUv; 3999 4000 #include <tonemapping_pars_fragment> 4001 #include <colorspace_pars_fragment> 4002 4003 void main() { 4004 gl_FragColor = texture2D( tDiffuse, vUv ); 4005 4006 #ifdef LINEAR_TONE_MAPPING 4007 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 4008 #elif defined( REINHARD_TONE_MAPPING ) 4009 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 4010 #elif defined( CINEON_TONE_MAPPING ) 4011 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 4012 #elif defined( ACES_FILMIC_TONE_MAPPING ) 4013 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 4014 #elif defined( AGX_TONE_MAPPING ) 4015 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 4016 #elif defined( NEUTRAL_TONE_MAPPING ) 4017 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 4018 #elif defined( CUSTOM_TONE_MAPPING ) 4019 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 4020 #endif 4021 4022 #ifdef SRGB_TRANSFER 4023 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 4024 #endif 4025 }`,depthTest:!1,depthWrite:!1}),u=new Ot(l,c),f=new jl(-1,1,1,-1,0,1);let h=null,d=null,g=!1,v,m=null,p=[],w=!1;this.setSize=function(E,S){a.setSize(E,S),o.setSize(E,S);for(let b=0;b<p.length;b++){const T=p[b];T.setSize&&T.setSize(E,S)}},this.setEffects=function(E){p=E,w=p.length>0&&p[0].isRenderPass===!0;const S=a.width,b=a.height;for(let T=0;T<p.length;T++){const L=p[T];L.setSize&&L.setSize(S,b)}},this.begin=function(E,S){if(g||E.toneMapping===On&&p.length===0)return!1;if(m=S,S!==null){const b=S.width,T=S.height;(a.width!==b||a.height!==T)&&this.setSize(b,T)}return w===!1&&E.setRenderTarget(a),v=E.toneMapping,E.toneMapping=On,!0},this.hasRenderPass=function(){return w},this.end=function(E,S){E.toneMapping=v,g=!0;let b=a,T=o;for(let L=0;L<p.length;L++){const x=p[L];if(x.enabled!==!1&&(x.render(E,T,b,S),x.needsSwap!==!1)){const A=b;b=T,T=A}}if(h!==E.outputColorSpace||d!==E.toneMapping){h=E.outputColorSpace,d=E.toneMapping,c.defines={},lt.getTransfer(h)===dt&&(c.defines.SRGB_TRANSFER="");const L=z_[d];L&&(c.defines[L]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=b.texture,E.setRenderTarget(m),E.render(u,f),m=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),l.dispose(),c.dispose()}}const Ju=new Yt,xl=new Tr(1,1),Qu=new Ru,ef=new _m,tf=new Uu,uh=[],fh=[],dh=new Float32Array(16),ph=new Float32Array(9),mh=new Float32Array(4);function Lr(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=uh[r];if(s===void 0&&(s=new Float32Array(r),uh[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function Ft(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Bt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Ca(i,e){let t=fh[e];t===void 0&&(t=new Int32Array(e),fh[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function H_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function V_(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ft(t,e))return;i.uniform2fv(this.addr,e),Bt(t,e)}}function G_(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Ft(t,e))return;i.uniform3fv(this.addr,e),Bt(t,e)}}function W_(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ft(t,e))return;i.uniform4fv(this.addr,e),Bt(t,e)}}function X_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ft(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Bt(t,e)}else{if(Ft(t,n))return;mh.set(n),i.uniformMatrix2fv(this.addr,!1,mh),Bt(t,n)}}function q_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ft(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Bt(t,e)}else{if(Ft(t,n))return;ph.set(n),i.uniformMatrix3fv(this.addr,!1,ph),Bt(t,n)}}function Y_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ft(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Bt(t,e)}else{if(Ft(t,n))return;dh.set(n),i.uniformMatrix4fv(this.addr,!1,dh),Bt(t,n)}}function j_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function $_(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ft(t,e))return;i.uniform2iv(this.addr,e),Bt(t,e)}}function K_(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ft(t,e))return;i.uniform3iv(this.addr,e),Bt(t,e)}}function Z_(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ft(t,e))return;i.uniform4iv(this.addr,e),Bt(t,e)}}function J_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Q_(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ft(t,e))return;i.uniform2uiv(this.addr,e),Bt(t,e)}}function ev(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ft(t,e))return;i.uniform3uiv(this.addr,e),Bt(t,e)}}function tv(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ft(t,e))return;i.uniform4uiv(this.addr,e),Bt(t,e)}}function nv(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(xl.compareFunction=t.isReversedDepthBuffer()?Ll:Dl,s=xl):s=Ju,t.setTexture2D(e||s,r)}function iv(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||ef,r)}function rv(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||tf,r)}function sv(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Qu,r)}function av(i){switch(i){case 5126:return H_;case 35664:return V_;case 35665:return G_;case 35666:return W_;case 35674:return X_;case 35675:return q_;case 35676:return Y_;case 5124:case 35670:return j_;case 35667:case 35671:return $_;case 35668:case 35672:return K_;case 35669:case 35673:return Z_;case 5125:return J_;case 36294:return Q_;case 36295:return ev;case 36296:return tv;case 35678:case 36198:case 36298:case 36306:case 35682:return nv;case 35679:case 36299:case 36307:return iv;case 35680:case 36300:case 36308:case 36293:return rv;case 36289:case 36303:case 36311:case 36292:return sv}}function ov(i,e){i.uniform1fv(this.addr,e)}function lv(i,e){const t=Lr(e,this.size,2);i.uniform2fv(this.addr,t)}function cv(i,e){const t=Lr(e,this.size,3);i.uniform3fv(this.addr,t)}function hv(i,e){const t=Lr(e,this.size,4);i.uniform4fv(this.addr,t)}function uv(i,e){const t=Lr(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function fv(i,e){const t=Lr(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function dv(i,e){const t=Lr(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function pv(i,e){i.uniform1iv(this.addr,e)}function mv(i,e){i.uniform2iv(this.addr,e)}function gv(i,e){i.uniform3iv(this.addr,e)}function xv(i,e){i.uniform4iv(this.addr,e)}function _v(i,e){i.uniform1uiv(this.addr,e)}function vv(i,e){i.uniform2uiv(this.addr,e)}function yv(i,e){i.uniform3uiv(this.addr,e)}function Sv(i,e){i.uniform4uiv(this.addr,e)}function Mv(i,e,t){const n=this.cache,r=e.length,s=Ca(t,r);Ft(n,s)||(i.uniform1iv(this.addr,s),Bt(n,s));let a;this.type===i.SAMPLER_2D_SHADOW?a=xl:a=Ju;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function bv(i,e,t){const n=this.cache,r=e.length,s=Ca(t,r);Ft(n,s)||(i.uniform1iv(this.addr,s),Bt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||ef,s[a])}function Ev(i,e,t){const n=this.cache,r=e.length,s=Ca(t,r);Ft(n,s)||(i.uniform1iv(this.addr,s),Bt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||tf,s[a])}function Tv(i,e,t){const n=this.cache,r=e.length,s=Ca(t,r);Ft(n,s)||(i.uniform1iv(this.addr,s),Bt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Qu,s[a])}function wv(i){switch(i){case 5126:return ov;case 35664:return lv;case 35665:return cv;case 35666:return hv;case 35674:return uv;case 35675:return fv;case 35676:return dv;case 5124:case 35670:return pv;case 35667:case 35671:return mv;case 35668:case 35672:return gv;case 35669:case 35673:return xv;case 5125:return _v;case 36294:return vv;case 36295:return yv;case 36296:return Sv;case 35678:case 36198:case 36298:case 36306:case 35682:return Mv;case 35679:case 36299:case 36307:return bv;case 35680:case 36300:case 36308:case 36293:return Ev;case 36289:case 36303:case 36311:case 36292:return Tv}}class Av{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=av(t.type)}}class Rv{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=wv(t.type)}}class Cv{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const fo=/(\w+)(\])?(\[|\.)?/g;function gh(i,e){i.seq.push(e),i.map[e.id]=e}function Pv(i,e,t){const n=i.name,r=n.length;for(fo.lastIndex=0;;){const s=fo.exec(n),a=fo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){gh(t,c===void 0?new Av(o,i,e):new Rv(o,i,e));break}else{let f=t.map[o];f===void 0&&(f=new Cv(o),gh(t,f)),t=f}}}class Ks{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);Pv(o,l,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function xh(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Dv=37297;let Lv=0;function Iv(i,e){const t=i.split(` 4026`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 4027`)}const _h=new je;function Nv(i){lt._getMatrix(_h,lt.workingColorSpace,i);const e=`mat3( ${_h.elements.map(t=>t.toFixed(4))} )`;switch(lt.getTransfer(i)){case ca:return[e,"LinearTransferOETF"];case dt:return[e,"sRGBTransferOETF"];default:return Ze("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function vh(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+` 4028 4029`+s+` 4030 4031`+Iv(i.getShaderSource(e),o)}else return s}function Uv(i,e){const t=Nv(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 4032`)}const Ov={[du]:"Linear",[pu]:"Reinhard",[mu]:"Cineon",[gu]:"ACESFilmic",[_u]:"AgX",[vu]:"Neutral",[xu]:"Custom"};function Fv(i,e){const t=Ov[e];return t===void 0?(Ze("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const zs=new V;function Bv(){lt.getLuminanceCoefficients(zs);const i=zs.x.toFixed(4),e=zs.y.toFixed(4),t=zs.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 4033`)}function zv(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(jr).join(` 4034`)}function kv(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 4035`)}function Hv(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function jr(i){return i!==""}function yh(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.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,t).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 Sh(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Vv=/^[ \t]*#include +<([\w\d./]+)>/gm;function _l(i){return i.replace(Vv,Wv)}const Gv=new Map;function Wv(i,e){let t=it[e];if(t===void 0){const n=Gv.get(e);if(n!==void 0)t=it[n],Ze('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return _l(t)}const Xv=/#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 Mh(i){return i.replace(Xv,qv)}function qv(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function bh(i){let e=`precision ${i.precision} float; 4036 precision ${i.precision} int; 4037 precision ${i.precision} sampler2D; 4038 precision ${i.precision} samplerCube; 4039 precision ${i.precision} sampler3D; 4040 precision ${i.precision} sampler2DArray; 4041 precision ${i.precision} sampler2DShadow; 4042 precision ${i.precision} samplerCubeShadow; 4043 precision ${i.precision} sampler2DArrayShadow; 4044 precision ${i.precision} isampler2D; 4045 precision ${i.precision} isampler3D; 4046 precision ${i.precision} isamplerCube; 4047 precision ${i.precision} isampler2DArray; 4048 precision ${i.precision} usampler2D; 4049 precision ${i.precision} usampler3D; 4050 precision ${i.precision} usamplerCube; 4051 precision ${i.precision} usampler2DArray; 4052 `;return i.precision==="highp"?e+=` 4053#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 4054#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 4055#define LOW_PRECISION`),e}const Yv={[Ws]:"SHADOWMAP_TYPE_PCF",[qr]:"SHADOWMAP_TYPE_VSM"};function jv(i){return Yv[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const $v={[Fi]:"ENVMAP_TYPE_CUBE",[Er]:"ENVMAP_TYPE_CUBE",[Aa]:"ENVMAP_TYPE_CUBE_UV"};function Kv(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":$v[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const Zv={[Er]:"ENVMAP_MODE_REFRACTION"};function Jv(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Zv[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Qv={[fu]:"ENVMAP_BLENDING_MULTIPLY",[Kp]:"ENVMAP_BLENDING_MIX",[Zp]:"ENVMAP_BLENDING_ADD"};function ey(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":Qv[i.combine]||"ENVMAP_BLENDING_NONE"}function ty(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function ny(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=jv(t),c=Kv(t),u=Jv(t),f=ey(t),h=ty(t),d=zv(t),g=kv(s),v=r.createProgram();let m,p,w=t.glslVersion?"#version "+t.glslVersion+` 4056`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(jr).join(` 4057`),m.length>0&&(m+=` 4058`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(jr).join(` 4059`),p.length>0&&(p+=` 4060`)):(m=[bh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionCl
vendor: 6,566 bytes, lines 4060-4062
4060ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 4061`].filter(jr).join(` 4062`),p=[bh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
4062IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==On?"#define TONE_MAPPING":"",t.toneMapping!==On?it.tonemapping_pars_fragment:"",t.toneMapping!==On?Fv("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",it.colorspace_pars_fragment,Uv("linearToOutputTexel",t.outputColorSpace),Bv(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 4063`].filter(jr).join(` 4064`)),a=_l(a),a=yh(a,t),a=Sh(a,t),o=_l(o),o=yh(o,t),o=Sh(o,t),a=Mh(a),o=Mh(o),t.isRawShaderMaterial!==!0&&(w=`#version 300 es 4065`,m=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(` 4066`)+` 4067`+m,p=["#define varying in",t.glslVersion===vc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===vc?"":"#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(` 4068`)+` 4069`+p);const E=w+m+a,S=w+p+o,b=xh(r,r.VERTEX_SHADER,E),T=xh(r,r.FRAGMENT_SHADER,S);r.attachShader(v,b),r.attachShader(v,T),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function L(B){if(i.debug.checkShaderErrors){const U=r.getProgramInfoLog(v)||"",te=r.getShaderInfoLog(b)||"",ee=r.getShaderInfoLog(T)||"",$=U.trim(),ne=te.trim(),K=ee.trim();let X=!0,ge=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(X=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,v,b,T);else{const _e=vh(r,b,"vertex"),ve=vh(r,T,"fragment");ot("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+` 4070 4071Material Name: `+B.name+` 4072Material Type: `+B.type+` 4073 4074Program Info Log: `+$+` 4075`+_e+` 4076`+ve)}else $!==""?Ze("WebGLProgram: Program Info Log:",$):(ne===""||K==="")&&(ge=!1);ge&&(B.diagnostics={runnable:X,programLog:$,vertexShader:{log:ne,prefix:m},fragmentShader:{log:K,prefix:p}})}r.deleteShader(b),r.deleteShader(T),x=new Ks(r,v),A=Hv(r,v)}let x;this.getUniforms=function(){return x===void 0&&L(this),x};let A;this.getAttributes=function(){return A===void 0&&L(this),A};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=r.getProgramParameter(v,Dv)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Lv++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=b,this.fragmentShader=T,this}let iy=0;class ry{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new sy(e),t.set(e,n)),n}}class sy{constructor(e){this.id=iy++,this.code=e,this.usedTimes=0}}function ay(i){return i===Bi||i===aa||i===oa}
4076function oy(i,e,t,n,r,s){const a=new Nl,o=new ry,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer;let h=n.precision;const d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(x){return l.add(x),x===0?"uv":`uv${x}`}function v(x,A,k,B,U,te){const ee=B.fog,$=U.geometry,ne=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?B.environment:null,K=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,X=e.get(x.envMap||ne,K),ge=X&&X.mapping===Aa?X.image.height:null,_e=d[x.type];x.precision!==null&&(h=n.getMaxPrecision(x.precision),h!==x.precision&&Ze("WebGLProgram.getParameters:",x.precision,"not supported, using",h,"instead."));const ve=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,Ee=ve!==void 0?ve.length:0;let We=0;$.morphAttributes.position!==void 0&&(We=1),$.morphAttributes.normal!==void 0&&(We=2),$.morphAttributes.color!==void 0&&(We=3);let Je,Ue,ie,q;if(_e){const ze=Ln[_e];Je=ze.vertexShader,Ue=ze.fragmentShader}else{Je=x.vertexShader,Ue=x.fragmentShader;const ze=o.getVertexShaderStage(x),Et=o.getFragmentShaderStage(x);o.update(x,ze,Et),ie=ze.id,q=Et.id}const F=i.getRenderTarget(),O=i.state.buffers.depth.getReversed(),P=U.isInstancedMesh===!0,W=U.isBatchedMesh===!0,he=!!x.map,pe=!!x.matcap,R=!!X,G=!!x.aoMap,I=!!x.lightMap,J=!!x.bumpMap&&x.wireframe===!1,D=!!x.normalMap,j=!!x.displacementMap,ae=!!x.emissiveMap,re=!!x.metalnessMap,H=!!x.roughnessMap,y=x.anisotropy>0,Se=x.clearcoat>0,Fe=x.dispersion>0,C=x.iridescence>0,_=x.sheen>0,z=x.transmission>0,Z=y&&!!x.anisotropyMap,oe=Se&&!!x.clearcoatMap,Me=Se&&!!x.clearcoatNormalMap,be=Se&&!!x.clearcoatRoughnessMap,fe=C&&!!x.iridescenceMap,me=C&&!!x.iridescenceThicknessMap,we=_&&!!x.sheenColorMap,He=_&&!!x.sheenRoughnessMap,Re=!!x.specularMap,Ce=!!x.specularColorMap,Xe=!!x.specularIntensityMap,$e=z&&!!x.transmissionMap,et=z&&!!x.thicknessMap,Y=!!x.gradientMap,Te=!!x.alphaMap,xe=x.alphaTest>0,Pe=!!x.alphaHash,De=!!x.extensions;let ye=On;x.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(ye=i.toneMapping);const Ve={shaderID:_e,shaderType:x.type,shaderName:x.name,vertexShader:Je,fragmentShader:Ue,defines:x.defines,customVertexShaderID:ie,customFragmentShaderID:q,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:h,batching:W,batchingColor:W&&U._colorsTexture!==null,instancing:P,instancingColor:P&&U.instanceColor!==null,instancingMorph:P&&U.morphTexture!==null,outputColorSpace:F===null?i.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:lt.workingColorSpace,alphaToCoverage:!!x.alphaToCoverage,map:he,matcap:pe,envMap:R,envMapMode:R&&X.mapping,envMapCubeUVHeight:ge,aoMap:G,lightMap:I,bumpMap:J,normalMap:D,displacementMap:j,emissiveMap:ae,normalMapObjectSpace:D&&x.normalMapType===em,normalMapTangentSpace:D&&x.normalMapType===hl,packedNormalMap:D&&x.normalMapType===hl&&ay(x.normalMap.format),metalnessMap:re,roughnessMap:H,anisotropy:y,anisotropyMap:Z,clearcoat:Se,clearcoatMap:oe,clearcoatNormalMap:Me,clearcoatRoughnessMap:be,dispersion:Fe,iridescence:C,iridescenceMap:fe,iridescenceThicknessMap:me,sheen:_,sheenColorMap:we,sheenRoughnessMap:He,specularMap:Re,specularColorMap:Ce,specularIntensityMap:Xe,transmission:z,transmissionMap:$e,thicknessMap:et,gradientMap:Y,opaque:x.transparent===!1&&x.blending===gr&&x.alphaToCoverage===!1,alphaMap:Te,alphaTest:xe,alphaHash:Pe,combine:x.combine,mapUv:he&&g(x.map.channel),aoMapUv:G&&g(x.aoMap.channel),lightMapUv:I&&g(x.lightMap.channel),bumpMapUv:J&&g(x.bumpMap.channel),normalMapUv:D&&g(x.normalMap.channel),displacementMapUv:j&&g(x.displacementMap.channel),emissiveMapUv:ae&&g(x.emissiveMap.channel),metalnessMapUv:re&&g(x.metalnessMap.channel),roughnessMapUv:H&&g(x.roughnessMap.channel),anisotropyMapUv:Z&&g(x.anisotropyMap.channel),clearcoatMapUv:oe&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:Me&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:be&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:fe&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:me&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:we&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:He&&g(x.sheenRoughnessMap.channel),specularMapUv:Re&&g(x.specularMap.channel),specularColorMapUv:Ce&&g(x.specularColorMap.channel),specularIntensityMapUv:Xe&&g(x.specularIntensityMap.channel),transmissionMapUv:$e&&g(x.transmissionMap.channel),thicknessMapUv:et&&g(x.thicknessMap.channel),alphaMapUv:Te&&g(x.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(D||y),vertexNormals:!!$.attributes.normal,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!$.attributes.uv&&(he||Te),fog:!!ee,useFog:x.fog===!0,fogExp2:!!ee&&ee.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||$.attributes.normal===void 0&&D===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:O,skinning:U.isSkinnedMesh===!0,hasPositionAttribute:$.attributes.position!==void 0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:Ee,morphTextureStride:We,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,numLightProbes:A.numLightProbes,numLightProbeGrids:te.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:x.dithering,shadowMapEnabled:i.shadowMap.enabled&&k.length>0,shadowMapType:i.shadowMap.type,toneMapping:ye,decodeVideoTexture:he&&x.map.isVideoTexture===!0&<.getTransfer(x.map.colorSpace)===dt,decodeVideoTextureEmissive:ae&&x.emissiveMap.isVideoTexture===!0&<.getTransfer(x.emissiveMap.colorSpace)===dt,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===un,flipSided:x.side===en,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionCl
vendor: 14,452 bytes, lines 4076-4103
4076ipCullDistance:De&&x.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(De&&x.extensions.multiDraw===!0||W)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return Ve.vertexUv1s=l.has(1),Ve.vertexUv2s=l.has(2),Ve.vertexUv3s=l.has(3),l.clear(),Ve}function m(x){const A=[];if(x.shaderID?A.push(x.shaderID):(A.push(x.customVertexShaderID),A.push(x.customFragmentShaderID)),x.defines!==void 0)for(const k in x.defines)A.push(k),A.push(x.defines[k]);return x.isRawShaderMaterial===!1&&(p(A,x),w(A,x),A.push(i.outputColorSpace)),A.push(x.customProgramCacheKey),A.join()}function p(x,A){x.push(A.precision),x.push(A.outputColorSpace),x.push(A.envMapMode),x.push(A.envMapCubeUVHeight),x.push(A.mapUv),x.push(A.alphaMapUv),x.push(A.lightMapUv),x.push(A.aoMapUv),x.push(A.bumpMapUv),x.push(A.normalMapUv),x.push(A.displacementMapUv),x.push(A.emissiveMapUv),x.push(A.metalnessMapUv),x.push(A.roughnessMapUv),x.push(A.anisotropyMapUv),x.push(A.clearcoatMapUv),x.push(A.clearcoatNormalMapUv),x.push(A.clearcoatRoughnessMapUv),x.push(A.iridescenceMapUv),x.push(A.iridescenceThicknessMapUv),x.push(A.sheenColorMapUv),x.push(A.sheenRoughnessMapUv),x.push(A.specularMapUv),x.push(A.specularColorMapUv),x.push(A.specularIntensityMapUv),x.push(A.transmissionMapUv),x.push(A.thicknessMapUv),x.push(A.combine),x.push(A.fogExp2),x.push(A.sizeAttenuation),x.push(A.morphTargetsCount),x.push(A.morphAttributeCount),x.push(A.numDirLights),x.push(A.numPointLights),x.push(A.numSpotLights),x.push(A.numSpotLightMaps),x.push(A.numHemiLights),x.push(A.numRectAreaLights),x.push(A.numDirLightShadows),x.push(A.numPointLightShadows),x.push(A.numSpotLightShadows),x.push(A.numSpotLightShadowsWithMaps),x.push(A.numLightProbes),x.push(A.shadowMapType),x.push(A.toneMapping),x.push(A.numClippingPlanes),x.push(A.numClipIntersection),x.push(A.depthPacking)}function w(x,A){a.disableAll(),A.instancing&&a.enable(0),A.instancingColor&&a.enable(1),A.instancingMorph&&a.enable(2),A.matcap&&a.enable(3),A.envMap&&a.enable(4),A.normalMapObjectSpace&&a.enable(5),A.normalMapTangentSpace&&a.enable(6),A.clearcoat&&a.enable(7),A.iridescence&&a.enable(8),A.alphaTest&&a.enable(9),A.vertexColors&&a.enable(10),A.vertexAlphas&&a.enable(11),A.vertexUv1s&&a.enable(12),A.vertexUv2s&&a.enable(13),A.vertexUv3s&&a.enable(14),A.vertexTangents&&a.enable(15),A.anisotropy&&a.enable(16),A.alphaHash&&a.enable(17),A.batching&&a.enable(18),A.dispersion&&a.enable(19),A.batchingColor&&a.enable(20),A.gradientMap&&a.enable(21),A.packedNormalMap&&a.enable(22),A.vertexNormals&&a.enable(23),x.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.reversedDepthBuffer&&a.enable(4),A.skinning&&a.enable(5),A.morphTargets&&a.enable(6),A.morphNormals&&a.enable(7),A.morphColors&&a.enable(8),A.premultipliedAlpha&&a.enable(9),A.shadowMapEnabled&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),A.decodeVideoTextureEmissive&&a.enable(20),A.alphaToCoverage&&a.enable(21),A.numLightProbeGrids>0&&a.enable(22),A.hasPositionAttribute&&a.enable(23),x.push(a.mask)}function E(x){const A=d[x.type];let k;if(A){const B=Ln[A];k=yg.clone(B.uniforms)}else k=x.uniforms;return k}function S(x,A){let k=u.get(A);return k!==void 0?++k.usedTimes:(k=new ny(i,A,x,r),c.push(k),u.set(A,k)),k}function b(x){if(--x.usedTimes===0){const A=c.indexOf(x);c[A]=c[c.length-1],c.pop(),u.delete(x.cacheKey),x.destroy()}}function T(x){o.remove(x)}function L(){o.dispose()}return{getParameters:v,getProgramCacheKey:m,getUniforms:E,acquireProgram:S,releaseProgram:b,releaseShaderCache:T,programs:c,dispose:L}}function ly(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function cy(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function Eh(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Th(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(h){let d=0;return h.isInstancedMesh&&(d+=2),h.isSkinnedMesh&&(d+=1),d}function o(h,d,g,v,m,p){let w=i[e];return w===void 0?(w={id:h.id,object:h,geometry:d,material:g,materialVariant:a(h),groupOrder:v,renderOrder:h.renderOrder,z:m,group:p},i[e]=w):(w.id=h.id,w.object=h,w.geometry=d,w.material=g,w.materialVariant=a(h),w.groupOrder=v,w.renderOrder=h.renderOrder,w.z=m,w.group=p),e++,w}function l(h,d,g,v,m,p){const w=o(h,d,g,v,m,p);g.transmission>0?n.push(w):g.transparent===!0?r.push(w):t.push(w)}function c(h,d,g,v,m,p){const w=o(h,d,g,v,m,p);g.transmission>0?n.unshift(w):g.transparent===!0?r.unshift(w):t.unshift(w)}function u(h,d,g){t.length>1&&t.sort(h||cy),n.length>1&&n.sort(d||Eh),r.length>1&&r.sort(d||Eh),g&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let h=e,d=i.length;h<d;h++){const g=i[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function hy(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Th,i.set(n,[a])):r>=s.length?(a=new Th,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function uy(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new V,color:new at};break;case"SpotLight":t={position:new V,direction:new V,color:new at,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new V,color:new at,distance:0,decay:0};break;case"HemisphereLight":t={direction:new V,skyColor:new at,groundColor:new at};break;case"RectAreaLight":t={color:new at,position:new V,halfWidth:new V,halfHeight:new V};break}return i[e.id]=t,t}}}function fy(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let dy=0;function py(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function my(i){const e=new uy,t=fy(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new V);const r=new V,s=new pt,a=new pt;function o(c){let u=0,f=0,h=0;for(let A=0;A<9;A++)n.probe[A].set(0,0,0);let d=0,g=0,v=0,m=0,p=0,w=0,E=0,S=0,b=0,T=0,L=0;c.sort(py);for(let A=0,k=c.length;A<k;A++){const B=c[A],U=B.color,te=B.intensity,ee=B.distance;let $=null;if(B.shadow&&B.shadow.map&&(B.shadow.map.texture.format===Bi?$=B.shadow.map.texture:$=B.shadow.map.depthTexture||B.shadow.map.texture),B.isAmbientLight)u+=U.r*te,f+=U.g*te,h+=U.b*te;else if(B.isLightProbe){for(let ne=0;ne<9;ne++)n.probe[ne].addScaledVector(B.sh.coefficients[ne],te);L++}else if(B.isDirectionalLight){const ne=e.get(B);if(ne.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const K=B.shadow,X=t.get(B);X.shadowIntensity=K.intensity,X.shadowBias=K.bias,X.shadowNormalBias=K.normalBias,X.shadowRadius=K.radius,X.shadowMapSize=K.mapSize,n.directionalShadow[d]=X,n.directionalShadowMap[d]=$,n.directionalShadowMatrix[d]=B.shadow.matrix,w++}n.directional[d]=ne,d++}else if(B.isSpotLight){const ne=e.get(B);ne.position.setFromMatrixPosition(B.matrixWorld),ne.color.copy(U).multiplyScalar(te),ne.distance=ee,ne.coneCos=Math.cos(B.angle),ne.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),ne.decay=B.decay,n.spot[v]=ne;const K=B.shadow;if(B.map&&(n.spotLightMap[b]=B.map,b++,K.updateMatrices(B),B.castShadow&&T++),n.spotLightMatrix[v]=K.matrix,B.castShadow){const X=t.get(B);X.shadowIntensity=K.intensity,X.shadowBias=K.bias,X.shadowNormalBias=K.normalBias,X.shadowRadius=K.radius,X.shadowMapSize=K.mapSize,n.spotShadow[v]=X,n.spotShadowMap[v]=$,S++}v++}else if(B.isRectAreaLight){const ne=e.get(B);ne.color.copy(U).multiplyScalar(te),ne.halfWidth.set(B.width*.5,0,0),ne.halfHeight.set(0,B.height*.5,0),n.rectArea[m]=ne,m++}else if(B.isPointLight){const ne=e.get(B);if(ne.color.copy(B.color).multiplyScalar(B.intensity),ne.distance=B.distance,ne.decay=B.decay,B.castShadow){const K=B.shadow,X=t.get(B);X.shadowIntensity=K.intensity,X.shadowBias=K.bias,X.shadowNormalBias=K.normalBias,X.shadowRadius=K.radius,X.shadowMapSize=K.mapSize,X.shadowCameraNear=K.camera.near,X.shadowCameraFar=K.camera.far,n.pointShadow[g]=X,n.pointShadowMap[g]=$,n.pointShadowMatrix[g]=B.shadow.matrix,E++}n.point[g]=ne,g++}else if(B.isHemisphereLight){const ne=e.get(B);ne.skyColor.copy(B.color).multiplyScalar(te),ne.groundColor.copy(B.groundColor).multiplyScalar(te),n.hemi[p]=ne,p++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Le.LTC_FLOAT_1,n.rectAreaLTC2=Le.LTC_FLOAT_2):(n.rectAreaLTC1=Le.LTC_HALF_1,n.rectAreaLTC2=Le.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=h;const x=n.hash;(x.directionalLength!==d||x.pointLength!==g||x.spotLength!==v||x.rectAreaLength!==m||x.hemiLength!==p||x.numDirectionalShadows!==w||x.numPointShadows!==E||x.numSpotShadows!==S||x.numSpotMaps!==b||x.numLightProbes!==L)&&(n.directional.length=d,n.spot.length=v,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=w,n.directionalShadowMap.length=w,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=w,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=S+b-T,n.spotLightMap.length=b,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=L,x.directionalLength=d,x.pointLength=g,x.spotLength=v,x.rectAreaLength=m,x.hemiLength=p,x.numDirectionalShadows=w,x.numPointShadows=E,x.numSpotShadows=S,x.numSpotMaps=b,x.numLightProbes=L,n.version=dy++)}function l(c,u){let f=0,h=0,d=0,g=0,v=0;const m=u.matrixWorldInverse;for(let p=0,w=c.length;p<w;p++){const E=c[p];if(E.isDirectionalLight){const S=n.directional[f];S.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(m),f++}else if(E.isSpotLight){const S=n.spot[d];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),S.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(m),d++}else if(E.isRectAreaLight){const S=n.rectArea[g];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),a.identity(),s.copy(E.matrixWorld),s.premultiply(m),a.extractRotation(s),S.halfWidth.set(E.width*.5,0,0),S.halfHeight.set(0,E.height*.5,0),S.halfWidth.applyMatrix4(a),S.halfHeight.applyMatrix4(a),g++}else if(E.isPointLight){const S=n.point[h];S.position.setFromMatrixPosition(E.matrixWorld),S.position.applyMatrix4(m),h++}else if(E.isHemisphereLight){const S=n.hemi[v];S.direction.setFromMatrixPosition(E.matrixWorld),S.direction.transformDirection(m),v++}}}return{setup:o,setupView:l,state:n}}function wh(i){const e=new my(i),t=[],n=[],r=[];function s(h){f.camera=h,t.length=0,n.length=0,r.length=0}function a(h){t.push(h)}function o(h){n.push(h)}function l(h){r.push(h)}function c(){e.setup(t)}function u(h){e.setupView(t,h)}const f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function gy(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new wh(i),e.set(r,[o])):s>=a.length?(o=new wh(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const xy=`void main() { 4077 gl_Position = vec4( position, 1.0 ); 4078}`,_y=`uniform sampler2D shadow_pass; 4079uniform vec2 resolution; 4080uniform float radius; 4081void main() { 4082 const float samples = float( VSM_SAMPLES ); 4083 float mean = 0.0; 4084 float squared_mean = 0.0; 4085 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 4086 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 4087 for ( float i = 0.0; i < samples; i ++ ) { 4088 float uvOffset = uvStart + i * uvStride; 4089 #ifdef HORIZONTAL_PASS 4090 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 4091 mean += distribution.x; 4092 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 4093 #else 4094 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 4095 mean += depth; 4096 squared_mean += depth * depth; 4097 #endif 4098 } 4099 mean = mean / samples; 4100 squared_mean = squared_mean / samples; 4101 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 4102 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 4103}`,vy=[new V(1,0,0),new V(-1,0,0),new V(0,1,0),new V(0,-1,0),new V(0,0,1),new V(0,0,-1)],yy=[new V(0,-1,0),new V(0,-1,0),new V(0,0,1),new V(0,0,-1),new V(0,-1,0),new V(0,-1,0)],Ah=new pt,Wr=new V,po=new V;function Sy(i,e,t){let n=new Fl;const r=new de,s=new de,a=new At,o=new Eg,l=new Tg,c={},u=t.maxTextureSize,f={[Si]:en,[en]:Si,[un]:un}
vendor: 4,116 bytes, line 4103
4103,h=new zn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new de},radius:{value:4}},vertexShader:xy,fragmentShader:_y}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const g=new jt;g.setAttribute("position",new vn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Ot(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ws;let p=this.type;this.render=function(T,L,x){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;this.type===Dp&&(Ze("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Ws);const A=i.getRenderTarget(),k=i.getActiveCubeFace(),B=i.getActiveMipmapLevel(),U=i.state;U.setBlending(Kn),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const te=p!==this.type;te&&L.traverse(function(ee){ee.material&&(Array.isArray(ee.material)?ee.material.forEach($=>$.needsUpdate=!0):ee.material.needsUpdate=!0)});for(let ee=0,$=T.length;ee<$;ee++){const ne=T[ee],K=ne.shadow;if(K===void 0){Ze("WebGLShadowMap:",ne,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;r.copy(K.mapSize);const X=K.getFrameExtents();r.multiply(X),s.copy(K.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/X.x),r.x=s.x*X.x,K.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/X.y),r.y=s.y*X.y,K.mapSize.y=s.y));const ge=i.state.buffers.depth.getReversed();if(K.camera._reversedDepth=ge,K.map===null||te===!0){if(K.map!==null&&(K.map.depthTexture!==null&&(K.map.depthTexture.dispose(),K.map.depthTexture=null),K.map.dispose()),this.type===qr){if(ne.isPointLight){Ze("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}K.map=new Fn(r.x,r.y,{format:Bi,type:Qn,minFilter:qt,magFilter:qt,generateMipmaps:!1}),K.map.texture.name=ne.name+".shadowMap",K.map.depthTexture=new Tr(r.x,r.y,Tn),K.map.depthTexture.name=ne.name+".shadowMapDepth",K.map.depthTexture.format=ei,K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Ht,K.map.depthTexture.magFilter=Ht}else ne.isPointLight?(K.map=new Zu(r.x),K.map.depthTexture=new Bm(r.x,Bn)):(K.map=new Fn(r.x,r.y),K.map.depthTexture=new Tr(r.x,r.y,Bn)),K.map.depthTexture.name=ne.name+".shadowMap",K.map.depthTexture.format=ei,this.type===Ws?(K.map.depthTexture.compareFunction=ge?Ll:Dl,K.map.depthTexture.minFilter=qt,K.map.depthTexture.magFilter=qt):(K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Ht,K.map.depthTexture.magFilter=Ht);K.camera.updateProjectionMatrix()}const _e=K.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<_e;ve++){if(K.map.isWebGLCubeRenderTarget)i.setRenderTarget(K.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(K.map),i.clear());const Ee=K.getViewport(ve);a.set(s.x*Ee.x,s.y*Ee.y,s.x*Ee.z,s.y*Ee.w),U.viewport(a)}if(ne.isPointLight){const Ee=K.camera,We=K.matrix,Je=ne.distance||Ee.far;Je!==Ee.far&&(Ee.far=Je,Ee.updateProjectionMatrix()),Wr.setFromMatrixPosition(ne.matrixWorld),Ee.position.copy(Wr),po.copy(Ee.position),po.add(vy[ve]),Ee.up.copy(yy[ve]),Ee.lookAt(po),Ee.updateMatrixWorld(),We.makeTranslation(-Wr.x,-Wr.y,-Wr.z),Ah.multiplyMatrices(Ee.projectionMatrix,Ee.matrixWorldInverse),K._frustum.setFromProjectionMatrix(Ah,Ee.coordinateSystem,Ee.reversedDepth)}else K.updateMatrices(ne);n=K.getFrustum(),S(L,x,K.camera,ne,this.type)}K.isPointLightShadow!==!0&&this.type===qr&&w(K,x),K.needsUpdate=!1}p=this.type,m.needsUpdate=!1,i.setRenderTarget(A,k,B)};function w(T,L){const x=e.update(v);h.defines.VSM_SAMPLES!==T.blurSamples&&(h.defines.VSM_SAMPLES=T.blurSamples,d.defines.VSM_SAMPLES=T.blurSamples,h.needsUpdate=!0,d.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Fn(r.x,r.y,{format:Bi,type:Qn})),h.uniforms.shadow_pass.value=T.map.depthTexture,h.uniforms.resolution.value=T.mapSize,h.uniforms.radius.value=T.radius,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(L,null,x,h,v,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radiu
vendor: 7,410 bytes, line 4103
4103s,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(L,null,x,d,v,null)}function E(T,L,x,A){let k=null;const B=x.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(B!==void 0)k=B;else if(k=x.isPointLight===!0?l:o,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){const U=k.uuid,te=L.uuid;let ee=c[U];ee===void 0&&(ee={},c[U]=ee);let $=ee[te];$===void 0&&($=k.clone(),ee[te]=$,L.addEventListener("dispose",b)),k=$}if(k.visible=L.visible,k.wireframe=L.wireframe,A===qr?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,x.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const U=i.properties.get(k);U.light=x}return k}function S(T,L,x,A,k){if(T.visible===!1)return;if(T.layers.test(L.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&k===qr)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,T.matrixWorld);const te=e.update(T),ee=T.material;if(Array.isArray(ee)){const $=te.groups;for(let ne=0,K=$.length;ne<K;ne++){const X=$[ne],ge=ee[X.materialIndex];if(ge&&ge.visible){const _e=E(T,ge,A,k);T.onBeforeShadow(i,T,L,x,te,_e,X),i.renderBufferDirect(x,null,te,_e,T,X),T.onAfterShadow(i,T,L,x,te,_e,X)}}}else if(ee.visible){const $=E(T,ee,A,k);T.onBeforeShadow(i,T,L,x,te,$,null),i.renderBufferDirect(x,null,te,$,T,null),T.onAfterShadow(i,T,L,x,te,$,null)}}const U=T.children;for(let te=0,ee=U.length;te<ee;te++)S(U[te],L,x,A,k)}function b(T){T.target.removeEventListener("dispose",b);for(const x in c){const A=c[x],k=T.target.uuid;k in A&&(A[k].dispose(),delete A[k])}}}function My(i,e){function t(){let Y=!1;const Te=new At;let xe=null;const Pe=new At(0,0,0,0);return{setMask:function(De){xe!==De&&!Y&&(i.colorMask(De,De,De,De),xe=De)},setLocked:function(De){Y=De},setClear:function(De,ye,Ve,ze,Et){Et===!0&&(De*=ze,ye*=ze,Ve*=ze),Te.set(De,ye,Ve,ze),Pe.equals(Te)===!1&&(i.clearColor(De,ye,Ve,ze),Pe.copy(Te))},reset:function(){Y=!1,xe=null,Pe.set(-1,0,0,0)}}}function n(){let Y=!1,Te=!1,xe=null,Pe=null,De=null;return{setReversed:function(ye){if(Te!==ye){const Ve=e.get("EXT_clip_control");ye?Ve.clipControlEXT(Ve.LOWER_LEFT_EXT,Ve.ZERO_TO_ONE_EXT):Ve.clipControlEXT(Ve.LOWER_LEFT_EXT,Ve.NEGATIVE_ONE_TO_ONE_EXT),Te=ye;const ze=De;De=null,this.setClear(ze)}},getReversed:function(){return Te},setTest:function(ye){ye?F(i.DEPTH_TEST):O(i.DEPTH_TEST)},setMask:function(ye){xe!==ye&&!Y&&(i.depthMask(ye),xe=ye)},setFunc:function(ye){if(Te&&(ye=hm[ye]),Pe!==ye){switch(ye){case Ao:i.depthFunc(i.NEVER);break;case Ro:i.depthFunc(i.ALWAYS);break;case Co:i.depthFunc(i.LESS);break;case br:i.depthFunc(i.LEQUAL);break;case Po:i.depthFunc(i.EQUAL);break;case Do:i.depthFunc(i.GEQUAL);break;case Lo:i.depthFunc(i.GREATER);break;case Io:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Pe=ye}},setLocked:function(ye){Y=ye},setClear:function(ye){De!==ye&&(De=ye,Te&&(ye=1-ye),i.clearDepth(ye))},reset:function(){Y=!1,xe=null,Pe=null,De=null,Te=!1}}}function r(){let Y=!1,Te=null,xe=null,Pe=null,De=null,ye=null,Ve=null,ze=null,Et=null;return{setTest:function(mt){Y||(mt?F(i.STENCIL_TEST):O(i.STENCIL_TEST))},setMask:function(mt){Te!==mt&&!Y&&(i.stencilMask(mt),Te=mt)},setFunc:function(mt,tn,nn){(xe!==mt||Pe!==tn||De!==nn)&&(i.stencilFunc(mt,tn,nn),xe=mt,Pe=tn,De=nn)},setOp:function(mt,tn,nn){(ye!==mt||Ve!==tn||ze!==nn)&&(i.stencilOp(mt,tn,nn),ye=mt,Ve=tn,ze=nn)},setLocked:function(mt){Y=mt},setClear:function(mt){Et!==mt&&(i.clearStencil(mt),Et=mt)},reset:function(){Y=!1,Te=null,xe=null,Pe=null,De=null,ye=null,Ve=null,ze=null,Et=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let u={},f={},h={},d=new WeakMap,g=[],v=null,m=!1,p=null,w=null,E=null,S=null,b=null,T=null,L=null,x=new at(0,0,0),A=0,k=!1,B=null,U=null,te=null,ee=null,$=null;const ne=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let K=!1,X=0;const ge=i.getParameter(i.VERSION);ge.indexOf("WebGL")!==-1?(X=parseFloat(/^WebGL (\d)/.exec(ge)[1]),K=X>=1):ge.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),K=X>=2);let _e=null,ve={};const Ee=i.getParameter(i.SCISSOR_BOX),We=i.getParameter(i.VIEWPORT),Je=new At().fromArray(Ee),Ue=new At().fromArray(We);function ie(Y,Te,xe,Pe){const De=new Uint8Array(4),ye=i.createTexture();i.bindTexture(Y,ye),i.texParameteri(Y,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(Y,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ve=0;Ve<xe;Ve++)Y===i.TEXTURE_3D||Y===i.TEXTURE_2D_ARRAY?i.texImage3D(Te,0,i.RGBA,1,1,Pe,0,i.RGBA,i.UNSIGNED_BYTE,De):i.texImage2D(Te+Ve,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,De);return ye}const q={};q[i.TEXTURE_2D]=ie(i.TEXTURE_2D,i.TEXTURE_2D,1),q[i.TEXTURE_CUBE_MAP]=ie(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),q[i.TEXTURE_2D_ARRAY]=ie(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),q[i.TEXTURE_3D]=ie(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),F(i.DEPTH_TEST),a.setFunc(br),J(!1),D(pc),F(i.CULL_FACE),G(Kn);function F(Y){u[Y]!==!0&&(i.enable(Y),u[Y]=!0)}function O(Y){u[Y]!==!1&&(i.disable(Y),u[Y]=!1)}function P(Y,Te){return h[Y]!==Te?(i.bindFramebuffer(Y,Te),h[Y]=Te,Y===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=Te),Y===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=Te),!0):!1}function W(Y,Te){let xe=g,Pe=!1;if(Y){xe=d.get(Te),xe===void 0&&(xe=[],d.set(Te,xe));const De=Y.textures;if(xe.length!==De.length||xe[0]!==i.COLOR_ATTACHMENT0){for(let ye=0,Ve=De.length;ye<Ve;ye++)xe[ye]=i.COLOR_ATTACHMENT0+ye;xe.length=De.length,Pe=!0}}else xe[0]!==i.BACK&&(xe[0]=i.BACK,Pe=!0);Pe&&i.drawBuffers(xe)}function he(Y){return v!==Y?(i.useProgram(Y),v=Y,!0):!1}const pe={[Li]:i.FUNC_ADD,[Ip]:i.FUNC_SUBTRACT,[Np]:i.FUNC_REVERSE_SUBTRACT};pe[Up]=i.MIN,pe[Op]=i.MAX;const R={[Fp]:i.ZERO,[Bp]:i.ONE,[zp]:i.SRC_COLOR,[To]:i.SRC_ALPHA,[Xp]:i.SRC_ALPHA_SATURATE,[Gp]:i.DST_COLOR,[Hp]:i.DST_ALPHA,[kp]:i.ONE_MINUS_SRC_COLOR,[wo]:i.ONE_MINUS_SRC_ALPHA,[Wp]:i.ONE_MINUS_DST_COLOR,[Vp]:i.ONE_MINUS_DST_ALPHA,[qp]:i.CONSTANT_COLOR,[Yp]:i.ONE_MINUS_CONSTANT_COLOR,[jp]:i.CONSTANT_ALPHA,[$p]:i.ONE_MINUS_CONSTANT_ALPHA};function G(Y,Te,xe,Pe,De,ye,Ve,ze,Et,mt){if(Y===Kn){m===!0&&(O(i.BLEND),m=!1);return}if(m===!1&&(F(i.BLEND),m=!0),Y!==Lp){if(Y!==p||mt!==k){if((w!==Li||b!==Li)&&(i.blendEquation(i.FUNC_ADD),w=Li,b=Li),mt)switch(Y){case gr:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case mc:i.blendFunc(i.ONE,i.ONE);break;case gc:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case xc:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ot("WebGLState: Invalid blending: ",Y);break}else switch(Y){case gr:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case mc:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case gc:ot("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;
vendor: 10,603 bytes, line 4103
4103case xc:ot("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ot("WebGLState: Invalid blending: ",Y);break}E=null,S=null,T=null,L=null,x.set(0,0,0),A=0,p=Y,k=mt}return}De=De||Te,ye=ye||xe,Ve=Ve||Pe,(Te!==w||De!==b)&&(i.blendEquationSeparate(pe[Te],pe[De]),w=Te,b=De),(xe!==E||Pe!==S||ye!==T||Ve!==L)&&(i.blendFuncSeparate(R[xe],R[Pe],R[ye],R[Ve]),E=xe,S=Pe,T=ye,L=Ve),(ze.equals(x)===!1||Et!==A)&&(i.blendColor(ze.r,ze.g,ze.b,Et),x.copy(ze),A=Et),p=Y,k=!1}function I(Y,Te){Y.side===un?O(i.CULL_FACE):F(i.CULL_FACE);let xe=Y.side===en;Te&&(xe=!xe),J(xe),Y.blending===gr&&Y.transparent===!1?G(Kn):G(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst,Y.blendEquationAlpha,Y.blendSrcAlpha,Y.blendDstAlpha,Y.blendColor,Y.blendAlpha,Y.premultipliedAlpha),a.setFunc(Y.depthFunc),a.setTest(Y.depthTest),a.setMask(Y.depthWrite),s.setMask(Y.colorWrite);const Pe=Y.stencilWrite;o.setTest(Pe),Pe&&(o.setMask(Y.stencilWriteMask),o.setFunc(Y.stencilFunc,Y.stencilRef,Y.stencilFuncMask),o.setOp(Y.stencilFail,Y.stencilZFail,Y.stencilZPass)),ae(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),Y.alphaToCoverage===!0?F(i.SAMPLE_ALPHA_TO_COVERAGE):O(i.SAMPLE_ALPHA_TO_COVERAGE)}function J(Y){B!==Y&&(Y?i.frontFace(i.CW):i.frontFace(i.CCW),B=Y)}function D(Y){Y!==Cp?(F(i.CULL_FACE),Y!==U&&(Y===pc?i.cullFace(i.BACK):Y===Pp?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):O(i.CULL_FACE),U=Y}function j(Y){Y!==te&&(K&&i.lineWidth(Y),te=Y)}function ae(Y,Te,xe){Y?(F(i.POLYGON_OFFSET_FILL),(ee!==Te||$!==xe)&&(ee=Te,$=xe,a.getReversed()&&(Te=-Te),i.polygonOffset(Te,xe))):O(i.POLYGON_OFFSET_FILL)}function re(Y){Y?F(i.SCISSOR_TEST):O(i.SCISSOR_TEST)}function H(Y){Y===void 0&&(Y=i.TEXTURE0+ne-1),_e!==Y&&(i.activeTexture(Y),_e=Y)}function y(Y,Te,xe){xe===void 0&&(_e===null?xe=i.TEXTURE0+ne-1:xe=_e);let Pe=ve[xe];Pe===void 0&&(Pe={type:void 0,texture:void 0},ve[xe]=Pe),(Pe.type!==Y||Pe.texture!==Te)&&(_e!==xe&&(i.activeTexture(xe),_e=xe),i.bindTexture(Y,Te||q[Y]),Pe.type=Y,Pe.texture=Te)}function Se(){const Y=ve[_e];Y!==void 0&&Y.type!==void 0&&(i.bindTexture(Y.type,null),Y.type=void 0,Y.texture=void 0)}function Fe(){try{i.compressedTexImage2D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function C(){try{i.compressedTexImage3D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function _(){try{i.texSubImage2D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function z(){try{i.texSubImage3D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function Z(){try{i.compressedTexSubImage2D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function oe(){try{i.compressedTexSubImage3D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function Me(){try{i.texStorage2D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function be(){try{i.texStorage3D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function fe(){try{i.texImage2D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function me(){try{i.texImage3D(...arguments)}catch(Y){ot("WebGLState:",Y)}}function we(Y){return f[Y]!==void 0?f[Y]:i.getParameter(Y)}function He(Y,Te){f[Y]!==Te&&(i.pixelStorei(Y,Te),f[Y]=Te)}function Re(Y){Je.equals(Y)===!1&&(i.scissor(Y.x,Y.y,Y.z,Y.w),Je.copy(Y))}function Ce(Y){Ue.equals(Y)===!1&&(i.viewport(Y.x,Y.y,Y.z,Y.w),Ue.copy(Y))}function Xe(Y,Te){let xe=c.get(Te);xe===void 0&&(xe=new WeakMap,c.set(Te,xe));let Pe=xe.get(Y);Pe===void 0&&(Pe=i.getUniformBlockIndex(Te,Y.name),xe.set(Y,Pe))}function $e(Y,Te){const Pe=c.get(Te).get(Y);l.get(Te)!==Pe&&(i.uniformBlockBinding(Te,Pe,Y.__bindingPointIndex),l.set(Te,Pe))}function et(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},_e=null,ve={},h={},d=new WeakMap,g=[],v=null,m=!1,p=null,w=null,E=null,S=null,b=null,T=null,L=null,x=new at(0,0,0),A=0,k=!1,B=null,U=null,te=null,ee=null,$=null,Je.set(0,0,i.canvas.width,i.canvas.height),Ue.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:F,disable:O,bindFramebuffer:P,drawBuffers:W,useProgram:he,setBlending:G,setMaterial:I,setFlipSided:J,setCullFace:D,setLineWidth:j,setPolygonOffset:ae,setScissorTest:re,activeTexture:H,bindTexture:y,unbindTexture:Se,compressedTexImage2D:Fe,compressedTexImage3D:C,texImage2D:fe,texImage3D:me,pixelStorei:He,getParameter:we,updateUBOMapping:Xe,uniformBlockBinding:$e,texStorage2D:Me,texStorage3D:be,texSubImage2D:_,texSubImage3D:z,compressedTexSubImage2D:Z,compressedTexSubImage3D:oe,scissor:Re,viewport:Ce,reset:et}}function by(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new de,u=new WeakMap,f=new Set;let h;const d=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(C,_){return g?new OffscreenCanvas(C,_):ha("canvas")}function m(C,_,z){let Z=1;const oe=Fe(C);if((oe.width>z||oe.height>z)&&(Z=z/Math.max(oe.width,oe.height)),Z<1)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap||typeof VideoFrame<"u"&&C instanceof VideoFrame){const Me=Math.floor(Z*oe.width),be=Math.floor(Z*oe.height);h===void 0&&(h=v(Me,be));const fe=_?v(Me,be):h;return fe.width=Me,fe.height=be,fe.getContext("2d").drawImage(C,0,0,Me,be),Ze("WebGLRenderer: Texture has been resized from ("+oe.width+"x"+oe.height+") to ("+Me+"x"+be+")."),fe}else return"data"in C&&Ze("WebGLRenderer: Image in DataTexture is too big ("+oe.width+"x"+oe.height+")."),C;return C}function p(C){return C.generateMipmaps}function w(C){i.generateMipmap(C)}function E(C){return C.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:C.isWebGL3DRenderTarget?i.TEXTURE_3D:C.isWebGLArrayRenderTarget||C.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function S(C,_,z,Z,oe,Me=!1){if(C!==null){if(i[C]!==void 0)return i[C];Ze("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let be;Z&&(be=e.get("EXT_texture_norm16"),be||Ze("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let fe=_;if(_===i.RED&&(z===i.FLOAT&&(fe=i.R32F),z===i.HALF_FLOAT&&(fe=i.R16F),z===i.UNSIGNED_BYTE&&(fe=i.R8),z===i.UNSIGNED_SHORT&&be&&(fe=be.R16_EXT),z===i.SHORT&&be&&(fe=be.R16_SNORM_EXT)),_===i.RED_INTEGER&&(z===i.UNSIGNED_BYTE&&(fe=i.R8UI),z===i.UNSIGNED_SHORT&&(fe=i.R16UI),z===i.UNSIGNED_INT&&(fe=i.R32UI),z===i.BYTE&&(fe=i.R8I),z===i.SHORT&&(fe=i.R16I),z===i.INT&&(fe=i.R32I)),_===i.RG&&(z===i.FLOAT&&(fe=i.RG32F),z===i.HALF_FLOAT&&(fe=i.RG16F),z===i.UNSIGNED_BYTE&&(fe=i.RG8),z===i.UNSIGNED_SHORT&&be&&(fe=be.RG16_EXT),z===i.SHORT&&be&&(fe=be.RG16_SNORM_EXT)),_===i.RG_INTEGER&&(z===i.UNSIGNED_BYTE&&(fe=i.RG8UI),z===i.UNSIGNED_SHORT&&(fe=i.RG16UI),z===i.UNSIGNED_INT&&(fe=i.RG32UI),z===i.BYTE&&(fe=i.RG8I),z===i.SHORT&&(fe=i.RG16I),z===i.INT&&(fe=i.RG32I)),_===i.RGB_INTEGER&&(z===i.UNSIGNED_BYTE&&(fe=i.RGB8UI),z===i.UNSIGNED_SHORT&&(fe=i.RGB16UI),z===i.UNSIGNED_INT&&(fe=i.RGB32UI),z===i.BYTE&&(fe=i.RGB8I),z===i.SHORT&&(fe=i.RGB16I),z===i.INT&&(fe=i.RGB32I)),_===i.RGBA_INTEGER&&(z===i.UNSIGNED_BYTE&&(fe=i.RGBA8UI),z===i.UNSIGNED_SHORT&&(fe=i.RGBA16UI),z===i.UNSIGNED_INT&&(fe=i.RGBA32UI),z===i.BYTE&&(fe=i.RGBA8I),z===i.SHORT&&(fe=i.RGBA16I),z===i.INT&&(fe=i.RGBA32I)),_===i.RGB&&(z===i.UNSIGNED_SHORT&&be&&(fe=be.RGB16_EXT),z===i.SHORT&&be&&(fe=be.RGB16_SNORM_EXT),z===i.UNSIGNED_INT_5_9_9_9_REV&&(fe=i.RGB9_E5),z===i.UNSIGNED_INT_10F_11F_11F_REV&&(fe=i.R11F_G11F_B10F)),_===i.RGBA){const me=Me?ca:lt.getTransfer(oe);z===i.FLOAT&&(fe=i.RGBA32F),z===i.HALF_FLOAT&&(fe=i.RGBA16F),z===i.UNSIGNED_BYTE&&(fe=me===dt?i.SRGB8_ALPHA8:i.RGBA8),z===i.UNSIGNED_SHORT&&be&&(fe=be.RGBA16_EXT),z===i.SHORT&&be&&(fe=be.RGBA16_SNORM_EXT),z===i.UNSIGNED_SHORT_4_4_4_4&&(fe=i.RGBA4),z===i.UNSIGNED_SHORT_5_5_5_1&&(fe=i.RGB5_A1)}return(fe===i.R16F||fe===i.R32F||fe===i.RG16F||fe===i.RG32F||fe===i.RGBA16F||fe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function b(C,_){let z;return C?_===null||_===Bn||_===ns?z=i.DEPTH24_STENCIL8:_===Tn?z=i.DEPTH32F_STENCIL8:_===ts&&(z=i.DEPTH24_STENCIL8,Ze("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===Bn||_===ns?z=i.DEPTH_COMPONENT24:_===Tn?z=i.DEPTH_COMPONENT32F:_===ts&&(z=i.DEPTH_COMPONENT16),z}function T(C,_){return p(C)===!0||C.isFramebufferTexture&&C.minFilter!==Ht&&C.minFilter!==qt?Math.log2(Math.max(_.width,_.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?_.mipmaps.length:1}function L(C){const _=C.target;_.removeEventListener("dispose",L),A(_),_.isVideoTexture&&u.delete(_),_.isHTMLTexture&&f.delete(_)}function x(C){const _=C.target;_.removeEventListener("dispose",x),B(_)}function A(C){const _=n.get(C);if(_.__webglInit===void 0)return;const z=C.source,Z=d.get(z);if(Z){const oe=Z[_.__cacheKey];oe.usedTimes--,oe.usedTimes===0&&k(C),Object.keys(Z).length===0&&d.delete(z)}n.remove(C)}function k(C){const _=n.get(C);i.deleteTexture(_.__webglTexture);const z=C.source,Z=d.get(z);delete Z[_.__cacheKey],a.memory.textures--}function B(C){const _=n.get(C);if(C.depthTexture&&(C.depthTexture.dispose(),n.remove(C.depthTexture)),C.isWebGLCubeRen
vendor: 4,935 bytes, line 4103
4103derTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(_.__webglFramebuffer[Z]))for(let oe=0;oe<_.__webglFramebuffer[Z].length;oe++)i.deleteFramebuffer(_.__webglFramebuffer[Z][oe]);else i.deleteFramebuffer(_.__webglFramebuffer[Z]);_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer[Z])}else{if(Array.isArray(_.__webglFramebuffer))for(let Z=0;Z<_.__webglFramebuffer.length;Z++)i.deleteFramebuffer(_.__webglFramebuffer[Z]);else i.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&i.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let Z=0;Z<_.__webglColorRenderbuffer.length;Z++)_.__webglColorRenderbuffer[Z]&&i.deleteRenderbuffer(_.__webglColorRenderbuffer[Z]);_.__webglDepthRenderbuffer&&i.deleteRenderbuffer(_.__webglDepthRenderbuffer)}const z=C.textures;for(let Z=0,oe=z.length;Z<oe;Z++){const Me=n.get(z[Z]);Me.__webglTexture&&(i.deleteTexture(Me.__webglTexture),a.memory.textures--),n.remove(z[Z])}n.remove(C)}let U=0;function te(){U=0}function ee(){return U}function $(C){U=C}function ne(){const C=U;return C>=r.maxTextures&&Ze("WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+r.maxTextures),U+=1,C}function K(C){const _=[];return _.push(C.wrapS),_.push(C.wrapT),_.push(C.wrapR||0),_.push(C.magFilter),_.push(C.minFilter),_.push(C.anisotropy),_.push(C.internalFormat),_.push(C.format),_.push(C.type),_.push(C.generateMipmaps),_.push(C.premultiplyAlpha),_.push(C.flipY),_.push(C.unpackAlignment),_.push(C.colorSpace),_.join()}function X(C,_){const z=n.get(C);if(C.isVideoTexture&&y(C),C.isRenderTargetTexture===!1&&C.isExternalTexture!==!0&&C.version>0&&z.__version!==C.version){const Z=C.image;if(Z===null)Ze("WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)Ze("WebGLRenderer: Texture marked for update but image is incomplete");else{O(z,C,_);return}}else C.isExternalTexture&&(z.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,z.__webglTexture,i.TEXTURE0+_)}function ge(C,_){const z=n.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&z.__version!==C.version){O(z,C,_);return}else C.isExternalTexture&&(z.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,z.__webglTexture,i.TEXTURE0+_)}function _e(C,_){const z=n.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&z.__version!==C.version){O(z,C,_);return}t.bindTexture(i.TEXTURE_3D,z.__webglTexture,i.TEXTURE0+_)}function ve(C,_){const z=n.get(C);if(C.isCubeDepthTexture!==!0&&C.version>0&&z.__version!==C.version){P(z,C,_);return}t.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture,i.TEXTURE0+_)}const Ee={[ra]:i.REPEAT,[Nn]:i.CLAMP_TO_EDGE,[sa]:i.MIRRORED_REPEAT},We={[Ht]:i.NEAREST,[Jp]:i.NEAREST_MIPMAP_NEAREST,[fs]:i.NEAREST_MIPMAP_LINEAR,[qt]:i.LINEAR,[Ia]:i.LINEAR_MIPMAP_NEAREST,[Ui]:i.LINEAR_MIPMAP_LINEAR},Je={[tm]:i.NEVER,[am]:i.ALWAYS,[nm]:i.LESS,[Dl]:i.LEQUAL,[im]:i.EQUAL,[Ll]:i.GEQUAL,[rm]:i.GREATER,[sm]:i.NOTEQUAL};function Ue(C,_){if(_.type===Tn&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===qt||_.magFilter===Ia||_.magFilter===fs||_.magFilter===Ui||_.minFilter===qt||_.minFilter===Ia||_.minFilter===fs||_.minFilter===Ui)&&Ze("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(C,i.TEXTURE_WRAP_S,Ee[_.wrapS]),i.texParameteri(C,i.TEXTURE_WRAP_T,Ee[_.wrapT]),(C===i.TEXTURE_3D||C===i.TEXTURE_2D_ARRAY)&&i.texParameteri(C,i.TEXTURE_WRAP_R,Ee[_.wrapR]),i.texParameteri(C,i.TEXTURE_MAG_FILTER,We[_.magFilter]),i.texParameteri(C,i.TEXTURE_MIN_FILTER,We[_.minFilter]),_.compareFunction&&(i.texParameteri(C,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(C,i.TEXTURE_COMPARE_FUNC,Je[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===Ht||_.minFilter!==fs&&_.minFilter!==Ui||_.type===Tn&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||n.get(_).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(C,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),n.get(_).__currentAnisotropy=_.anisotropy}}}function ie(C,_){let z=!1;C.__webglInit===void 0&&(C.__webglInit=!0,_.addEventListener("dispose",L));const Z=_.source;let oe=d.get(Z);oe===void 0&&(oe={},d.set(Z,oe));const Me=K(_);if(Me!==C.__cacheKey){oe[Me]===void 0&&(oe[Me]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,z=!0),oe[Me].usedTimes++;const be=oe[C.__cacheKey];be!==void 0&&(oe[C.__cacheKey].usedTimes--,be.usedTimes===0&&k(_)),C.__cacheKey=Me,C.__webglTexture=oe[Me].texture}return z}function q(C,_,z){return Math.floor(Math.floor(C/z)/_)}function F(C,_,z,Z){const Me=C.updateRanges;if(Me.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,_.width,_.height,z,Z,_.data);else{Me.sort((He,Re)=>
vendor: 5,973 bytes, line 4103
4103He.start-Re.start);let be=0;for(let He=1;He<Me.length;He++){const Re=Me[be],Ce=Me[He],Xe=Re.start+Re.count,$e=q(Ce.start,_.width,4),et=q(Re.start,_.width,4);Ce.start<=Xe+1&&$e===et&&q(Ce.start+Ce.count-1,_.width,4)===$e?Re.count=Math.max(Re.count,Ce.start+Ce.count-Re.start):(++be,Me[be]=Ce)}Me.length=be+1;const fe=t.getParameter(i.UNPACK_ROW_LENGTH),me=t.getParameter(i.UNPACK_SKIP_PIXELS),we=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,_.width);for(let He=0,Re=Me.length;He<Re;He++){const Ce=Me[He],Xe=Math.floor(Ce.start/4),$e=Math.ceil(Ce.count/4),et=Xe%_.width,Y=Math.floor(Xe/_.width),Te=$e,xe=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,et),t.pixelStorei(i.UNPACK_SKIP_ROWS,Y),t.texSubImage2D(i.TEXTURE_2D,0,et,Y,Te,xe,z,Z,_.data)}C.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,fe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,me),t.pixelStorei(i.UNPACK_SKIP_ROWS,we)}}function O(C,_,z){let Z=i.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),_.isData3DTexture&&(Z=i.TEXTURE_3D);const oe=ie(C,_),Me=_.source;t.bindTexture(Z,C.__webglTexture,i.TEXTURE0+z);const be=n.get(Me);if(Me.version!==be.__version||oe===!0){if(t.activeTexture(i.TEXTURE0+z),(typeof ImageBitmap<"u"&&_.image instanceof ImageBitmap)===!1){const xe=lt.getPrimaries(lt.workingColorSpace),Pe=_.colorSpace===_i?null:lt.getPrimaries(_.colorSpace),De=_.colorSpace===_i||xe===Pe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,De)}t.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment);let me=m(_.image,!1,r.maxTextureSize);me=Se(_,me);const we=s.convert(_.format,_.colorSpace),He=s.convert(_.type);let Re=S(_.internalFormat,we,He,_.normalized,_.colorSpace,_.isVideoTexture);Ue(Z,_);let Ce;const Xe=_.mipmaps,$e=_.isVideoTexture!==!0,et=be.__version===void 0||oe===!0,Y=Me.dataReady,Te=T(_,me);if(_.isDepthTexture)Re=b(_.format===Oi,_.type),et&&($e?t.texStorage2D(i.TEXTURE_2D,1,Re,me.width,me.height):t.texImage2D(i.TEXTURE_2D,0,Re,me.width,me.height,0,we,He,null));else if(_.isDataTexture)if(Xe.length>0){$e&&et&&t.texStorage2D(i.TEXTURE_2D,Te,Re,Xe[0].width,Xe[0].height);for(let xe=0,Pe=Xe.length;xe<Pe;xe++)Ce=Xe[xe],$e?Y&&t.texSubImage2D(i.TEXTURE_2D,xe,0,0,Ce.width,Ce.height,we,He,Ce.data):t.texImage2D(i.TEXTURE_2D,xe,Re,Ce.width,Ce.height,0,we,He,Ce.data);_.generateMipmaps=!1}else $e?(et&&t.texStorage2D(i.TEXTURE_2D,Te,Re,me.width,me.height),Y&&F(_,me,we,He)):t.texImage2D(i.TEXTURE_2D,0,Re,me.width,me.height,0,we,He,me.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){$e&&et&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Te,Re,Xe[0].width,Xe[0].height,me.depth);for(let xe=0,Pe=Xe.length;xe<Pe;xe++)if(Ce=Xe[xe],_.format!==wn)if(we!==null)if($e){if(Y)if(_.layerUpdates.size>0){const De=rh(Ce.width,Ce.height,_.format,_.type);for(const ye of _.layerUpdates){const Ve=Ce.data.subarray(ye*De/Ce.data.BYTES_PER_ELEMENT,(ye+1)*De/Ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,xe,0,0,ye,Ce.width,Ce.height,1,we,Ve)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,xe,0,0,0,Ce.width,Ce.height,me.depth,we,Ce.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,xe,Re,Ce.width,Ce.height,me.depth,0,Ce.data,0,0);else Ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else $e?Y&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,xe,0,0,0,Ce.width,Ce.height,me.depth,we,He,Ce.data):t.texImage3D(i.TEXTURE_2D_ARRAY,xe,Re,Ce.width,Ce.height,me.depth,0,we,He,Ce.data)}else{$e&&et&&t.texStorage2D(i.TEXTURE_2D,Te,Re,Xe[0].width,Xe[0].height);for(let xe=0,Pe=Xe.length;xe<Pe;xe++)Ce=Xe[xe],_.format!==wn?we!==null?$e?Y&&t.compressedTexSubImage2D(i.TEXTURE_2D,xe,0,0,Ce.width,Ce.height,we,Ce.data):t.compressedTexImage2D(i.TEXTURE_2D,xe,Re,Ce.width,Ce.height,0,Ce.data):Ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):$e?Y&&t.texSubImage2D(i.TEXTURE_2D,xe,0,0,Ce.width,Ce.height,we,He,Ce.data):t.texImage2D(i.TEXTURE_2D,xe,Re,Ce.width,Ce.height,0,we,He,Ce.data)}else if(_.isDataArrayTexture)if($e){if(et&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Te,Re,me.width,me.height,me.depth),Y)if(_.layerUpdates.size>0){const xe=rh(me.width,me.height,_.format,_.type);for(const Pe of _.layerUpdates){const De=me.data.subarray(Pe*xe/me.data.BYTES_PER_ELEMENT,(Pe+1)*xe/me.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Pe,me.width,me.height,1,we,He,De)}_.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,me.width,me.height,me.depth,we,He,me.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Re,me.width,me.height,me.depth,0,we,He,me.data);else if(_.isData3DTexture)$e?(et&&t.texStorage3D(i.TEXTURE_3D,Te,Re,me.width,me.height,me.depth),Y&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,me.width,me.height,me.depth,we,He,me.data)):t.texImage3D(i.TEXTURE_3D,0,Re,me.width,me.height,me.depth,0,we,He,me.data);else if(_.isFramebufferTexture){if(et)if($e)t.texStorage2D(i.TEXTURE_2D,Te,Re,me.width,me.height);else{let xe=me.width,Pe=me.height;for(let De=0;De<Te;De++)t.texImage2D(i.TEXTURE_2D,De,Re,xe,Pe,0,we,He,null),xe>>=1,Pe>>=1}}else if(_.isHTMLTexture){if("texElementImage2D"in i){const xe=i.canvas;if(xe.hasAttribute("layoutsubtree")||xe.setAttribute("layoutsubtree","true"),me.parentNode!==xe){xe.appendChild(me),f.add(_),xe.onpaint=Pe=>{const De=Pe.changedElements;for(const ye of f)De.includes(ye.image)&&(ye.needsUpdate=!0)},xe.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,me);else{const De=i.RGBA,ye=i.RGBA,Ve=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,De,ye,Ve,me)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Xe.length>0){if($e&&et){const xe=Fe(Xe[0]);
vendor: 8,362 bytes, line 4103
4103t.texStorage2D(i.TEXTURE_2D,Te,Re,xe.width,xe.height)}for(let xe=0,Pe=Xe.length;xe<Pe;xe++)Ce=Xe[xe],$e?Y&&t.texSubImage2D(i.TEXTURE_2D,xe,0,0,we,He,Ce):t.texImage2D(i.TEXTURE_2D,xe,Re,we,He,Ce);_.generateMipmaps=!1}else if($e){if(et){const xe=Fe(me);t.texStorage2D(i.TEXTURE_2D,Te,Re,xe.width,xe.height)}Y&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,we,He,me)}else t.texImage2D(i.TEXTURE_2D,0,Re,we,He,me);p(_)&&w(Z),be.__version=Me.version,_.onUpdate&&_.onUpdate(_)}C.__version=_.version}function P(C,_,z){if(_.image.length!==6)return;const Z=ie(C,_),oe=_.source;t.bindTexture(i.TEXTURE_CUBE_MAP,C.__webglTexture,i.TEXTURE0+z);const Me=n.get(oe);if(oe.version!==Me.__version||Z===!0){t.activeTexture(i.TEXTURE0+z);const be=lt.getPrimaries(lt.workingColorSpace),fe=_.colorSpace===_i?null:lt.getPrimaries(_.colorSpace),me=_.colorSpace===_i||be===fe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,me);const we=_.isCompressedTexture||_.image[0].isCompressedTexture,He=_.image[0]&&_.image[0].isDataTexture,Re=[];for(let ye=0;ye<6;ye++)!we&&!He?Re[ye]=m(_.image[ye],!0,r.maxCubemapSize):Re[ye]=He?_.image[ye].image:_.image[ye],Re[ye]=Se(_,Re[ye]);const Ce=Re[0],Xe=s.convert(_.format,_.colorSpace),$e=s.convert(_.type),et=S(_.internalFormat,Xe,$e,_.normalized,_.colorSpace),Y=_.isVideoTexture!==!0,Te=Me.__version===void 0||Z===!0,xe=oe.dataReady;let Pe=T(_,Ce);Ue(i.TEXTURE_CUBE_MAP,_);let De;if(we){Y&&Te&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Pe,et,Ce.width,Ce.height);for(let ye=0;ye<6;ye++){De=Re[ye].mipmaps;for(let Ve=0;Ve<De.length;Ve++){const ze=De[Ve];_.format!==wn?Xe!==null?Y?xe&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve,0,0,ze.width,ze.height,Xe,ze.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve,et,ze.width,ze.height,0,ze.data):Ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Y?xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve,0,0,ze.width,ze.height,Xe,$e,ze.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve,et,ze.width,ze.height,0,Xe,$e,ze.data)}}}else{if(De=_.mipmaps,Y&&Te){De.length>0&&Pe++;const ye=Fe(Re[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Pe,et,ye.width,ye.height)}for(let ye=0;ye<6;ye++)if(He){Y?xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,Re[ye].width,Re[ye].height,Xe,$e,Re[ye].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,et,Re[ye].width,Re[ye].height,0,Xe,$e,Re[ye].data);for(let Ve=0;Ve<De.length;Ve++){const Et=De[Ve].image[ye].image;Y?xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve+1,0,0,Et.width,Et.height,Xe,$e,Et.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve+1,et,Et.width,Et.height,0,Xe,$e,Et.data)}}else{Y?xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,Xe,$e,Re[ye]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,et,Xe,$e,Re[ye]);for(let Ve=0;Ve<De.length;Ve++){const ze=De[Ve];Y?xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve+1,0,0,Xe,$e,ze.image[ye]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ye,Ve+1,et,Xe,$e,ze.image[ye])}}}p(_)&&w(i.TEXTURE_CUBE_MAP),Me.__version=oe.version,_.onUpdate&&_.onUpdate(_)}C.__version=_.version}function W(C,_,z,Z,oe,Me){const be=s.convert(z.format,z.colorSpace),fe=s.convert(z.type),me=S(z.internalFormat,be,fe,z.normalized,z.colorSpace),we=n.get(_),He=n.get(z);if(He.__renderTarget=_,!we.__hasExternalTextures){const Re=Math.max(1,_.width>>Me),Ce=Math.max(1,_.height>>Me);oe===i.TEXTURE_3D||oe===i.TEXTURE_2D_ARRAY?t.texImage3D(oe,Me,me,Re,Ce,_.depth,0,be,fe,null):t.texImage2D(oe,Me,me,Re,Ce,0,be,fe,null)}t.bindFramebuffer(i.FRAMEBUFFER,C),H(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,oe,He.__webglTexture,0,re(_)):(oe===i.TEXTURE_2D||oe>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&oe<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,oe,He.__webglTexture,Me),t.bindFramebuffer(i.FRAMEBUFFER,null)}function he(C,_,z){if(i.bindRenderbuffer(i.RENDERBUFFER,C),_.depthBuffer){const Z=_.depthTexture,oe=Z&&Z.isDepthTexture?Z.type:null,Me=b(_.stencilBuffer,oe),be=_.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;H(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,re(_),Me,_.width,_.height):z?i.renderbufferStorageMultisample(i.RENDERBUFFER,re(_),Me,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,Me,_.width,_.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,be,i.RENDERBUFFER,C)}else{const Z=_.textures;for(let oe=0;oe<Z.length;oe++){const Me=Z[oe],be=s.convert(Me.format,Me.colorSpace),fe=s.convert(Me.type),me=S(Me.internalFormat,be,fe,Me.normalized,Me.colorSpace);H(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,re(_),me,_.width,_.height):z?i.renderbufferStorageMultisample(i.RENDERBUFFER,re(_),me,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,me,_.width,_.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function pe(C,_,z){const Z=_.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,C),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const oe=n.get(_.depthTexture);if(oe.__renderTarget=_,(!oe.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),Z){if(oe.__webglInit===void 0&&(oe.__webglInit=!0,_.depthTexture.addEventListener("dispose",L)),oe.__webglTexture===void 0){oe.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,oe.__webglTexture),Ue(i.TEXTURE_CUBE_MAP,_.depthTexture);const we=s.convert(_.depthTexture.format),He=s.convert(_.depthTexture.type);let Re;_.depthTexture.format===ei?Re=i.DEPTH_COMPONENT24:_.depthTexture.format===Oi&&(Re=i.DEPTH24_STENCIL8);for(let Ce=0;Ce<6;Ce++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,Re,_.width,_.height,0,we,He,null)}}else X(_.depthTexture,0);const Me=oe.__webglTexture,be=re(_),fe=Z?i.TEXTURE_CUBE_MAP_POSITIVE_X+z:i.TEXTURE_2D,me=_.depthTexture.format===Oi?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(_.depthTexture.format===ei)H(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,me,fe,Me,0,be):i.framebufferTexture2D(i.FRAMEBUFFER,me,fe,Me,0);else if(_.depthTexture.format===Oi)H(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,me,fe,Me,0,be):i.framebufferTexture2D(i.FRAMEBUFFER,me,fe,Me,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function R(C){const _=n.get(C),z=C.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==C.depthTexture){const Z=C.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),Z){const oe=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,Z.removeEventListener("dispose",oe)};Z.addEventListener("dispose",oe),_.__depthDisposeCallback=oe}_.__boundDepthTexture=Z}if(C.depthTexture&&!_.__autoAllocateDepthBuffer)if(z)for(let Z=0;Z<6;Z++)pe(_.__webglFramebuffer[Z],C,Z);else{const Z=C.texture.mipmaps;Z&&Z.length>0?pe(_.__webglFramebuffer[0],C,0):pe(_.__webglFramebuffer,C,0)}else if(z){_.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer[Z]),_.__webglDepthbuffer[Z]===void 0)_.__webglDepthbuffer[Z]=i.createRenderbuffer(),he(_.__webglDepthbuffer[Z],C,!1);else{const oe=C.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Me=_.__webglDepthbuffer[Z];i.bindRenderbuffer(i.RENDERBUFFER,Me),i.framebufferRenderbuffer(i.FRAMEBUFFER,oe,i.RENDERBUFFER,Me)}}else{const Z=C.texture.mipmaps;if(Z&&Z.length>0?t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=i.createRenderbuffer(),he(_.__webglDepthbuffer,C,!1);else{const oe=C.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Me=_.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,Me),i.framebufferRenderbuffer(i.FRAMEBUFFER,oe,i.RENDERBUFFER,Me)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function G(C,_,z){const Z=n.get(C);_!==void 0&&W(Z.__webglFramebuffer,C,C.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),z!==void 0&&R(C)}function I(C){const _=C.texture,z=n.get(C),Z=n.get(_);C.addEventListener("dispose",x);
vendor: 1,030 bytes, line 4103
4103const oe=C.textures,Me=C.isWebGLCubeRenderTarget===!0,be=oe.length>1;if(be||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=_.version,a.memory.textures++),Me){z.__webglFramebuffer=[];for(let fe=0;fe<6;fe++)if(_.mipmaps&&_.mipmaps.length>0){z.__webglFramebuffer[fe]=[];for(let me=0;me<_.mipmaps.length;me++)z.__webglFramebuffer[fe][me]=i.createFramebuffer()}else z.__webglFramebuffer[fe]=i.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){z.__webglFramebuffer=[];for(let fe=0;fe<_.mipmaps.length;fe++)z.__webglFramebuffer[fe]=i.createFramebuffer()}else z.__webglFramebuffer=i.createFramebuffer();if(be)for(let fe=0,me=oe.length;fe<me;fe++){const we=n.get(oe[fe]);we.__webglTexture===void 0&&(we.__webglTexture=i.createTexture(),a.memory.textures++)}if(C.samples>0&&H(C)===!1){z.__webglMultisampledFramebuffer=i.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let fe=0;fe<oe.length;fe++){const me=oe[fe];z.__webglColorRen
vendor: 22,125 bytes, lines 4103-4127
4103derbuffer[fe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,z.__webglColorRenderbuffer[fe]);const we=s.convert(me.format,me.colorSpace),He=s.convert(me.type),Re=S(me.internalFormat,we,He,me.normalized,me.colorSpace,C.isXRRenderTarget===!0),Ce=re(C);i.renderbufferStorageMultisample(i.RENDERBUFFER,Ce,Re,C.width,C.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+fe,i.RENDERBUFFER,z.__webglColorRenderbuffer[fe])}i.bindRenderbuffer(i.RENDERBUFFER,null),C.depthBuffer&&(z.__webglDepthRenderbuffer=i.createRenderbuffer(),he(z.__webglDepthRenderbuffer,C,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(Me){t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture),Ue(i.TEXTURE_CUBE_MAP,_);for(let fe=0;fe<6;fe++)if(_.mipmaps&&_.mipmaps.length>0)for(let me=0;me<_.mipmaps.length;me++)W(z.__webglFramebuffer[fe][me],C,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+fe,me);else W(z.__webglFramebuffer[fe],C,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0);p(_)&&w(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(be){for(let fe=0,me=oe.length;fe<me;fe++){const we=oe[fe],He=n.get(we);let Re=i.TEXTURE_2D;(C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(Re=C.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Re,He.__webglTexture),Ue(Re,we),W(z.__webglFramebuffer,C,we,i.COLOR_ATTACHMENT0+fe,Re,0),p(we)&&w(Re)}t.unbindTexture()}else{let fe=i.TEXTURE_2D;if((C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(fe=C.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(fe,Z.__webglTexture),Ue(fe,_),_.mipmaps&&_.mipmaps.length>0)for(let me=0;me<_.mipmaps.length;me++)W(z.__webglFramebuffer[me],C,_,i.COLOR_ATTACHMENT0,fe,me);else W(z.__webglFramebuffer,C,_,i.COLOR_ATTACHMENT0,fe,0);p(_)&&w(fe),t.unbindTexture()}C.depthBuffer&&R(C)}function J(C){const _=C.textures;for(let z=0,Z=_.length;z<Z;z++){const oe=_[z];if(p(oe)){const Me=E(C),be=n.get(oe).__webglTexture;t.bindTexture(Me,be),w(Me),t.unbindTexture()}}}const D=[],j=[];function ae(C){if(C.samples>0){if(H(C)===!1){const _=C.textures,z=C.width,Z=C.height;let oe=i.COLOR_BUFFER_BIT;const Me=C.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,be=n.get(C),fe=_.length>1;if(fe)for(let we=0;we<_.length;we++)t.bindFramebuffer(i.FRAMEBUFFER,be.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+we,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,be.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+we,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,be.__webglMultisampledFramebuffer);const me=C.texture.mipmaps;me&&me.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,be.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,be.__webglFramebuffer);for(let we=0;we<_.length;we++){if(C.resolveDepthBuffer&&(C.depthBuffer&&(oe|=i.DEPTH_BUFFER_BIT),C.stencilBuffer&&C.resolveStencilBuffer&&(oe|=i.STENCIL_BUFFER_BIT)),fe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,be.__webglColorRenderbuffer[we]);const He=n.get(_[we]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,He,0)}i.blitFramebuffer(0,0,z,Z,0,0,z,Z,oe,i.NEAREST),l===!0&&(D.length=0,j.length=0,D.push(i.COLOR_ATTACHMENT0+we),C.depthBuffer&&C.resolveDepthBuffer===!1&&(D.push(Me),j.push(Me),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,j)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,D))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),fe)for(let we=0;we<_.length;we++){t.bindFramebuffer(i.FRAMEBUFFER,be.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+we,i.RENDERBUFFER,be.__webglColorRenderbuffer[we]);const He=n.get(_[we]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,be.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+we,i.TEXTURE_2D,He,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,be.__webglMultisampledFramebuffer)}else if(C.depthBuffer&&C.resolveDepthBuffer===!1&&l){const _=C.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[_])}}}function re(C){return Math.min(r.maxSamples,C.samples)}function H(C){const _=n.get(C);return C.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function y(C){const _=a.render.frame;u.get(C)!==_&&(u.set(C,_),C.update())}function Se(C,_){const z=C.colorSpace,Z=C.format,oe=C.type;return C.isCompressedTexture===!0||C.isVideoTexture===!0||z!==la&&z!==_i&&(lt.getTransfer(z)===dt?(Z!==wn||oe!==fn)&&Ze("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ot("WebGLTextures: Unsupported texture color space:",z)),_}function Fe(C){return typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement?(c.width=C.naturalWidth||C.width,c.height=C.naturalHeight||C.height):typeof VideoFrame<"u"&&C instanceof VideoFrame?(c.width=C.displayWidth,c.height=C.displayHeight):(c.width=C.width,c.height=C.height),c}this.allocateTextureUnit=ne,this.resetTextureUnits=te,this.getTextureUnits=ee,this.setTextureUnits=$,this.setTexture2D=X,this.setTexture2DArray=ge,this.setTexture3D=_e,this.setTextureCube=ve,this.rebindTextures=G,this.setupRenderTarget=I,this.updateRenderTargetMipmap=J,this.updateMultisampleRenderTarget=ae,this.setupDepthRenderbuffer=R,this.setupFrameBufferTexture=W,this.useMultisampledRTT=H,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Ey(i,e){function t(n,r=_i){let s;const a=lt.getTransfer(r);if(n===fn)return i.UNSIGNED_BYTE;if(n===Tl)return i.UNSIGNED_SHORT_4_4_4_4;if(n===wl)return i.UNSIGNED_SHORT_5_5_5_1;if(n===bu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Eu)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Su)return i.BYTE;if(n===Mu)return i.SHORT;if(n===ts)return i.UNSIGNED_SHORT;if(n===El)return i.INT;if(n===Bn)return i.UNSIGNED_INT;if(n===Tn)return i.FLOAT;if(n===Qn)return i.HALF_FLOAT;if(n===Tu)return i.ALPHA;if(n===wu)return i.RGB;if(n===wn)return i.RGBA;if(n===ei)return i.DEPTH_COMPONENT;if(n===Oi)return i.DEPTH_STENCIL;if(n===Al)return i.RED;if(n===Rl)return i.RED_INTEGER;if(n===Bi)return i.RG;if(n===Cl)return i.RG_INTEGER;if(n===Pl)return i.RGBA_INTEGER;if(n===Xs||n===qs||n===Ys||n===js)if(a===dt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Xs)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===qs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ys)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===js)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Xs)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===qs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ys)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===js)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===No||n===Uo||n===Oo||n===Fo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===No)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Uo)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Oo)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Bo||n===zo||n===ko||n===Ho||n===Vo||n===aa||n===Go)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Bo||n===zo)return a===dt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ko)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ho)return s.COMPRESSED_R11_EAC;if(n===Vo)return s.COMPRESSED_SIGNED_R11_EAC;if(n===aa)return s.COMPRESSED_RG11_EAC;if(n===Go)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Wo||n===Xo||n===qo||n===Yo||n===jo||n===$o||n===Ko||n===Zo||n===Jo||n===Qo||n===el||n===tl||n===nl||n===il)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Wo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Xo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===qo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Yo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===jo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===$o)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ko)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Zo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Jo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Qo)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===el)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===tl)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===nl)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===il)return a===dt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===rl||n===sl||n===al)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===rl)return a===dt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===sl)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===al)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ol||n===ll||n===oa||n===cl)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===ol)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ll)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===oa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===cl)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ns?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Ty=` 4104void main() { 4105 4106 gl_Position = vec4( position, 1.0 ); 4107 4108}`,wy=` 4109uniform sampler2DArray depthColor; 4110uniform float depthWidth; 4111uniform float depthHeight; 4112 4113void main() { 4114 4115 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4116 4117 if ( coord.x >= 1.0 ) { 4118 4119 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4120 4121 } else { 4122 4123 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4124 4125 } 4126 4127}`;class Ay{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Ou(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new zn({vertexShader:Ty,fragmentShader:wy,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ot(new Rr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Ry extends bi{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,f=null,h=null,d=null,g=null;const v=typeof XRWebGLBinding<"u",m=new Ay,p={},w=t.getContextAttributes();let E=null,S=null;const b=[],T=[],L=new de;let x=null;const A=new xn;A.viewport=new At;const k=new xn;k.viewport=new At;const B=[A,k],U=new Ug;let te=null,ee=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let q=b[ie];return q===void 0&&(q=new ka,b[ie]=q),q.getTargetRaySpace()},this.getControllerGrip=function(ie){let q=b[ie];return q===void 0&&(q=new ka,b[ie]=q),q.getGripSpace()},this.getHand=function(ie){let q=b[ie];return q===void 0&&(q=new ka,b[ie]=q),q.getHandSpace()};function $(ie){const q=T.indexOf(ie.inputSource);if(q===-1)return;const F=b[q];F!==void 0&&(F.update(ie.inputSource,ie.frame,c||a),F.dispatchEvent({type:ie.type,data:ie.inputSource}))}function ne(){r.removeEventListener("select",$),r.removeEventListener("selectstart",$),r.removeEventListener("selectend",$),r.removeEventListener("squeeze",$),r.removeEventListener("squeezestart",$),r.removeEventListener("squeezeend",$),r.removeEventListener("end",ne),r.removeEventListener("inputsourceschange",K);for(let ie=0;ie<b.length;ie++){const q=T[ie];q!==null&&(T[ie]=null,b[ie].disconnect(q))}te=null,ee=null,m.reset();for(const ie in p)delete p[ie];e.setRenderTarget(E),d=null,h=null,f=null,r=null,S=null,Ue.stop(),n.isPresenting=!1,e.setPixelRatio(x),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){s=ie,n.isPresenting===!0&&Ze("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){o=ie,n.isPresenting===!0&&Ze("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ie){c=ie},this.getBaseLayer=function(){return h!==null?h:d},this.getBinding=function(){return f===null&&v&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(ie){if(r=ie,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",$),r.addEventListener("selectstart",$),r.addEventListener("selectend",$),r.addEventListener("squeeze",$),r.addEventListener("squeezestart",$),r.addEventListener("squeezeend",$),r.addEventListener("end",ne),r.addEventListener("inputsourceschange",K),w.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(L),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let F=null,O=null,P=null;w.depth&&(P=w.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,F=w.stencil?Oi:ei,O=w.stencil?ns:Bn);const W={colorFormat:t.RGBA8,depthFormat:P,scaleFactor:s};f=this.getBinding(),h=f.createProjectionLayer(W),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),S=new Fn(h.textureWidth,h.textureHeight,{format:wn,type:fn,depthTexture:new Tr(h.textureWidth,h.textureHeight,O,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const F={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,F),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),S=new Fn(d.framebufferWidth,d.framebufferHeight,{format:wn,type:fn,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Ue.setContext(r),Ue.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function K(ie){for(let q=0;q<ie.removed.length;q++){const F=ie.removed[q],O=T.indexOf(F);O>=0&&(T[O]=null,b[O].disconnect(F))}for(let q=0;q<ie.added.length;q++){const F=ie.added[q];let O=T.indexOf(F);if(O===-1){for(let W=0;W<b.length;W++)if(W>=T.length){T.push(F),O=W;break}else if(T[W]===null){T[W]=F,O=W;break}if(O===-1)break}const P=b[O];P&&P.connect(F)}}const X=new V,ge=new V;function _e(ie,q,F){X.setFromMatrixPosition(q.matrixWorld),ge.setFromMatrixPosition(F.matrixWorld);const O=X.distanceTo(ge),P=q.projectionMatrix.elements,W=F.projectionMatrix.elements,he=P[14]/(P[10]-1),pe=P[14]/(P[10]+1),R=(P[9]+1)/P[5],G=(P[9]-1)/P[5],I=(P[8]-1)/P[0],J=(W[8]+1)/W[0],D=he*I,j=he*J,ae=O/(-I+J),re=ae*-I;if(q.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(re),ie.translateZ(ae),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert(),P[10]===-1)ie.projectionMatrix.copy(q.projectionMatrix),ie.projectionMatrixInverse.copy(q.projectionMatrixInverse);else{const H=he+ae,y=pe+ae,Se=D-re,Fe=j+(O-re),C=R*pe/y*H,_=G*pe/y*H;ie.projectionMatrix.makePerspective(Se,Fe,C,_,H,y),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}}function ve(ie,q){q===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(q.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;let q=ie.near,F=ie.far;m.texture!==null&&(m.depthNear>0&&(q=m.depthNear),m.depthFar>0&&(F=m.depthFar)),U.near=k.near=A.near=q,U.far=k.far=A.far=F,(te!==U.near||ee!==U.far)&&(r.updateRenderState({depthNear:U.near,depthFar:U.far}),te=U.near,ee=U.far),U.layers.mask=ie.layers.mask|6,A.layers.mask=U.layers.mask&-5,k.layers.mask=U.layers.mask&-3;const O=ie.parent,P=U.cameras;ve(U,O);for(let W=0;W<P.length;W++)ve(P[W],O);P.length===2?_e(U,A,k):U.projectionMatrix.copy(A.projectionMatrix),Ee(ie,U,O)};function Ee(ie,q,F){F===null?ie.matrix.copy(q.matrixWorld):(ie.matrix.copy(F.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(q.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(q.projectionMatrix),ie.projectionMatrixInverse.copy(q.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=fl*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(h===null&&d===null))return l},this.setFoveation=function(ie){l=ie,h!==null&&(h.fixedFoveation=ie),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=ie)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(U)},this.getCameraTexture=function(ie){return p[ie]};let We=null;function Je(ie,q){if(u=q.getViewerPose(c||a),g=q,u!==null){const F=u.views;d!==null&&(e.setRenderTargetFramebuffer(S,d.framebuffer),e.setRenderTarget(S));let O=!1;F.length!==U.cameras.length&&(U.cameras.length=0,O=!0);for(let pe=0;pe<F.length;pe++){const R=F[pe];let G=null;if(d!==null)G=d.getViewport(R);else{const J=f.getViewSubImage(h,R);G=J.viewport,pe===0&&(e.setRenderTargetTextures(S,J.colorTexture,J.depthStencilTexture),e.setRenderTarget(S))}let I=B[pe];I===void 0&&(I=new xn,I.layers.enable(pe),I.viewport=new At,B[pe]=I),I.matrix.fromArray(R.transform.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale),I.projectionMatrix.fromArray(R.projectionMatrix),I.projectionMatrixInverse.copy(I.projectionMatrix).invert(),I.viewport.set(G.x,G.y,G.width,G.height),pe===0&&(U.matrix.copy(I.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),O===!0&&U.cameras.push(I)}const P=r.enabledFeatures;if(P&&P.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&v){f=n.getBinding();const pe=f.getDepthInformation(F[0]);pe&&pe.isValid&&pe.texture&&m.init(pe,r.renderState)}if(P&&P.includes("camera-access")&&v){e.state.unbindTexture(),f=n.getBinding();for(let pe=0;pe<F.length;pe++){const R=F[pe].camera;if(R){let G=p[R];G||(G=new Ou,p[R]=G);const I=f.getCameraImage(R);G.sourceTexture=I}}}}for(let F=0;F<b.length;F++){const O=T[F],P=b[F];O!==null&&P!==void 0&&P.update(O,q,c||a)}We&&We(ie,q),q.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:q}),g=null}const Ue=new $u;Ue.setAnimationLoop(Je),this.setAnimationLoop=function(ie){We=ie},this.dispose=function(){}}}const Cy=new pt,nf=new je;nf.set(-1,0,0,0,1,0,0,0,1);function Py(i,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Xu(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function r(m,p,w,E,S){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?s(m,p):p.isMeshLambertMaterial?(s(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(s(m,p),f(m,p)):p.isMeshPhongMaterial?(s(m,p),u(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(s(m,p),h(m,p),p.isMeshPhysicalMaterial&&d(m,p,S)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),v(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?l(m,p,w,E):p.isSpriteMaterial?c(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===en&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===en&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const w=e.get(p),E=w.envMap,S=w.envMapRotation;E&&(m.envMap.value=E,m.envMapRotation.value.setFromMatrix4(Cy.makeRotationFromEuler(S)).transpose(),E.isCubeTexture&&E.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(nf),m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize
vendor: 4,538 bytes, line 4127
4127+p.gapSize,m.scale.value=p.scale}function l(m,p,w,E){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*w,m.scale.value=E*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function f(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function h(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,w){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===en&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=w.texture,m.transmissionSamplerSize.value.set(w.width,w.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function v(m,p){const w=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(w.matrixWorld),m.nearDistance.value=w.shadow.camera.near,m.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Dy(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(S,b){const T=b.program;n.uniformBlockBinding(S,T)}function c(S,b){let T=r[S.id];T===void 0&&(m(S),T=u(S),r[S.id]=T,S.addEventListener("dispose",w));const L=b.program;n.updateUBOMapping(S,L);const x=e.render.frame;s[S.id]!==x&&(h(S),s[S.id]=x)}function u(S){const b=f();S.__bindingPointIndex=b;const T=i.createBuffer(),L=S.__size,x=S.usage;return i.bindBuffer(i.UNIFORM_BUFFER,T),i.bufferData(i.UNIFORM_BUFFER,L,x),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,b,T),T}function f(){for(let S=0;S<o;
4127S++)if(a.indexOf(S)===-1)return a.push(S),S;return ot("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(S){const b=r[S.id],T=S.uniforms,L=S.__cache;i.bindBuffer(i.UNIFORM_BUFFER,b);for(let x=0,A=T.length;x<A;x++){const k=T[x];if(Array.isArray(k))for(let B=0,U=k.length;B<U;B++)d(k[B],x,B,L);else d(k,x,0,L)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(S,b,T,L){if(v(S,b,T,L)===!0){const x=S.__offset,A=S.value;if(Array.isArray(A)){let k=0;for(let B=0;B<A.length;B++){const U=A[B],te=p(U);g(U,S.__data,k),typeof U!="number"&&typeof U!="boolean"&&!U.isMatrix3&&!ArrayBuffer.isView(U)&&(k+=te.storage/Float32Array.BYTES_PER_ELEMENT)}}else g(A,S.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,x,S.__data)}}function g(S,b,T){typeof S=="number"||typeof S=="boolean"?b[0]=S:S.isMatrix3?(b[0]=S.elements[0],b[1]=S.elements[1],b[2]=S.elements[2],b[3]=0,b[4]=S.elements[3],b[5]=S.elements[4],b[6]=S.elements[5],b[7]=0,b[8]=S.elements[6],b[9]=S.elements[7],b[10]=S.elements[8],b[11]=0):ArrayBuffer.isView(S)?b.set(new S.constructor(S.buffer,S.byteOffset,b.length)):S.toArray(b,T)}function v(S,b,T,L){const x=S.value,A=b+"_"+T;if(L[A]===void 0)return typeof x=="number"||typeof x=="boolean"?L[A]=x:ArrayBuffer.isView(x)?L[A]=x.slice():L[A]=x.clone(),!0;{const k=L[A];if(typeof x=="number"||typeof x=="boolean"){if(k!==x)return L[A]=x,!0}else{if(ArrayBuffer.isView(x))return!0;if(k.equals(x)===!1)return k.copy(x),!0}}return!1}function m(S){const b=S.uniforms;let T=0;const L=16;for(let A=0,k=b.length;A<k;A++){const B=Array.isArray(b[A])?b[A]:[b[A]];for(let U=0,te=B.length;U<te;U++){const ee=B[U],$=Array.isArray(ee.value)?ee.value:[ee.value];for(let ne=0,K=$.length;ne<K;ne++){const X=$[ne],ge=p(X),_e=T%L,ve=_e%ge.boundary,Ee=_e+ve;T+=ve,Ee!==0&&L-Ee<ge.storage&&(T+=L-Ee),ee.__data=new Float32Array(ge.storage/Float32Array.BYTES_PER_ELEMENT),ee.__offset=T,T+=ge.storage}}}const x=T%L;return x>
41270&&(T+=L-x),S.__size=T,S.__cache={},this}function p(S){const b={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(b.boundary=4,b.storage=4):S.isVector2?(b.boundary=8,b.storage=8):S.isVector3||S.isColor?(b.boundary=16,b.storage=12):S.isVector4?(b.boundary=16,b.storage=16):S.isMatrix3?(b.boundary=48,b.storage=48):S.isMatrix4?(b.boundary=64,b.storage=64):S.isTexture?Ze("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(S)?(b.boundary=16,b.storage=S.byteLength):Ze("WebGLRenderer: Unsupported uniform value type.",S),b}function w(S){const b=S.target;b.removeEventListener("dispose",w);const T=a.indexOf(b.__bindingPointIndex);a.splice(T,1),i.deleteBuffer(r[b.id]),delete r[b.id],delete s[b.id]}function E(){for(const S in r)i.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:E}}const Ly=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
vendor: 4,818 bytes, line 4127
412714942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Dn=null;function Iy(){return Dn===null&&(Dn=new Nu(Ly,16,16,Bi,Qn),Dn.name="DFG_LUT",Dn.minFilter=qt,Dn.magFilter=qt,Dn.wrapS=Nn,Dn.wrapT=Nn,Dn.generateMipmaps=!1,Dn.needsUpdate=!0),Dn}class Ny{constructor(e={}){const{canvas:t=lm(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:h=!1,outputBufferType:d=fn}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;const v=d,m=new Set([Pl,Cl,Rl]),p=new Set([fn,Bn,ts,ns,Tl,wl]),w=new Uint32Array(4),E=new Int32Array(4),S=new V;let b=null,T=null;const L=[],x=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=On,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const k=this;let B=!1,U=null,te=null,ee=null,$=null;this._outputColorSpace=Jt;let ne=0,K=0,X=null,ge=-1,_e=null;const ve=new At,Ee=new At;let We=null;const Je=new at(0);let Ue=0,ie=t.width,q=t.height,F=1,O=null,P=null;const W=new At(0,0,ie,q),he=new At(0,0,ie,q);let pe=!1;const R=new Fl;let G=!1,I=!1;const J=new pt,D=new V,j=new At,ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let re=!1;function H(){return X===null?F:1}let y=n;function Se(M,Q){return t.getContext(M,Q)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${bl}`),t.addEventListener("webglcontextlost",Et,!1),t.addEventListener("webglcontextrestored",mt,!1),t.addEventListener("webglcontextcreationerror",tn,!1),y===null){const Q="webgl2";if(y=Se(Q,M),y===null)throw Se(Q)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(M){throw ot("WebGLRenderer: "+M.message),M}let Fe,C,_,z,Z,oe,Me,be,fe,me,we,He,Re,Ce,Xe,$e,et,Y,Te,xe,Pe,De,ye;function Ve(){Fe=new I_(y),Fe.init(),Pe=new Ey(y,Fe),C=new T_(y,Fe,e,Pe),_=new My(y,Fe),C.reversedDepthBuffer&&h&&_.buffers.depth.setReversed(!0),te=y.createFramebuffer(),ee=y.createFramebuffer(),$=y.createFramebuffer(),z=new O_(y),Z=new ly,oe=new by(y,Fe,_,Z,C,Pe,z),Me=new L_(k),be=new kg(y),De=new b_(y,be),fe=new N_(y,be,z,De),me=new B_(y,fe,be,De,z),Y=new F_(y,C,oe),Xe=new w_(Z),we=new oy(k,Me,Fe,C,De,Xe),He=new Py(k,Z),Re=new hy,Ce=new gy(Fe),et=new M_(k,Me,_,me,g,l),$e=new Sy(k,me,C),ye=new Dy(y,z,C,_),Te=new E_(y,Fe,z),xe=new U_(y,Fe,z),z.programs=we.programs,k.c
vendor: 4,043 bytes, line 4127
4127apabilities=C,k.extensions=Fe,k.properties=Z,k.renderLists=Re,k.shadowMap=$e,k.state=_,k.info=z}Ve(),v!==fn&&(A=new k_(v,t.width,t.height,o,r,s));const ze=new Ry(k,y);this.xr=ze,this.getContext=function(){return y},this.getContextAttributes=function(){return y.getContextAttributes()},this.forceContextLoss=function(){const M=Fe.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Fe.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return F},this.setPixelRatio=function(M){M!==void 0&&(F=M,this.setSize(ie,q,!1))},this.getSize=function(M){return M.set(ie,q)},this.setSize=function(M,Q,ce=!0){if(ze.isPresenting){Ze("WebGLRenderer: Can't change size while VR device is presenting.");return}ie=M,q=Q,t.width=Math.floor(M*F),t.height=Math.floor(Q*F),ce===!0&&(t.style.width=M+"px",t.style.height=Q+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,M,Q)},this.getDrawingBufferSize=function(M){return M.set(ie*F,q*F).floor()},this.setDrawingBufferSize=function(M,Q,ce){ie=M,q=Q,F=ce,t.width=Math.floor(M*ce),t.height=Math.floor(Q*ce),this.setViewport(0,0,M,Q)},this.setEffects=function(M){if(v===fn){ot("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let Q=0;Q<M.length;Q++)if(M[Q].isOutputPass===!0){Ze("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}A.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(ve)},this.getViewport=function(M){return M.copy(W)},this.setViewport=function(M,Q,ce,se){M.isVector4?W.set(M.x,M.y,M.z,M.w):W.set(M,Q,ce,se),_.viewport(ve.copy(W).multiplyScalar(F).round())},this.getScissor=function(M){return M.copy(he)},this.setScissor=function(M,Q,ce,se){M.isVector4?he.set(M.x,M.y,M.z,M.w):he.set(M,Q,ce,se),_.scissor(Ee.copy(he).multiplyScalar(F).round())},this.getScissorTest=function(){return pe},this.setScissorTest=function(M){_.setScissorTest(pe=M)},this.setOpaqueSort=function(M){O=M},this.setTransparentSort=function(M){P=M},this.getClearColor=function(M){return M.copy(et.getClearColor())},this.setClearColor=function(){et.setClearColor(...arguments)},this.getClearAlpha=function(){return et.getClearAlpha()},this.setClearAlpha=function(){et.setClearAlpha(...arguments)},this.clear=function(M=!0,Q=!0,ce=!0){let se=0;if(M){let le=!1;if(X!==null){const Ne=X.texture.format;le=m.has(Ne)}if(le){const Ne=X.texture.type,Be=p.has(Ne),Ie=et.getClearColor(),Ge=et.getClearAlpha(),qe=Ie.r,nt=Ie.g,rt=Ie.b;Be?(w[0]=qe,w[1]=nt,w[2]=rt,w[3]=Ge,y.clearBufferuiv(y.COLOR,0,w)):(E[0]=qe,E[1]=nt,E[2]=rt,E[3]=Ge,y.clearBufferiv(y.COLOR,0,E))}else se|=y.COLOR_BUFFER_BIT}Q&&(se|=y.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ce&&(se|=y.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),se!==0&&y.clear(se)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(M){M.setRenderer(this),U=M},this.dispose=function(){t.removeEventListener("webglcontextlost",Et,!1),t.removeEventListener("webglcontextrestored",mt,!1),t.removeEventListener("webglcontextcreationerror",tn,!1),et.dispose(),Re.dispose(),Ce.dispose(),Z.dispose(),Me.dispose(),me.dispose(),De.dispose(),ye.dispose(),we.dispose(),ze.dispose(),ze.removeEventListener("sessionstart",Ct),ze.removeEventListener("sessionend",Vt),wt.stop()};function Et(M){M.preventDefault(),ua("WebGLRenderer: Context Lost."),B=!0}function mt(){ua("WebGLRenderer: Context Restored."),B=!1;const M=z.autoReset,Q=$e.enabled,ce=$e.autoUpdate,se=$e.needsUpdate,le=$e.type;Ve(),z.autoReset=M,$e.enabled=Q,$e.autoUpdate=ce,$e.needsUpdate=se,$e.type=le}function tn(M){ot("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function nn(M){const Q=M.target;Q.removeEventListener("dispose",nn),Ae(Q)}function Ae(M){Ke(M),Z.remove(M)}function Ke(M){const Q=Z.get(M).programs;
vendor: 8,549 bytes, line 4127
4127Q!==void 0&&(Q.forEach(function(ce){we.releaseProgram(ce)}),M.isShaderMaterial&&we.releaseShaderCache(M))}this.renderBufferDirect=function(M,Q,ce,se,le,Ne){Q===null&&(Q=ae);const Be=le.isMesh&&le.matrixWorld.determinantAffine()<0,Ie=_f(M,Q,ce,se,le);_.setMaterial(se,Be);let Ge=ce.index,qe=1;if(se.wireframe===!0){if(Ge=fe.getWireframeAttribute(ce),Ge===void 0)return;qe=2}const nt=ce.drawRange,rt=ce.attributes.position;let Ye=nt.start*qe,gt=(nt.start+nt.count)*qe;Ne!==null&&(Ye=Math.max(Ye,Ne.start*qe),gt=Math.min(gt,(Ne.start+Ne.count)*qe)),Ge!==null?(Ye=Math.max(Ye,0),gt=Math.min(gt,Ge.count)):rt!=null&&(Ye=Math.max(Ye,0),gt=Math.min(gt,rt.count));const Dt=gt-Ye;if(Dt<0||Dt===1/0)return;De.setup(le,se,Ie,ce,Ge);let Pt,yt=Te;if(Ge!==null&&(Pt=be.get(Ge),yt=xe,yt.setIndex(Pt)),le.isMesh)se.wireframe===!0?(_.setLineWidth(se.wireframeLinewidth*H()),yt.setMode(y.LINES)):yt.setMode(y.TRIANGLES);else if(le.isLine){let Gt=se.linewidth;Gt===void 0&&(Gt=1),_.setLineWidth(Gt*H()),le.isLineSegments?yt.setMode(y.LINES):le.isLineLoop?yt.setMode(y.LINE_LOOP):yt.setMode(y.LINE_STRIP)}else le.isPoints?yt.setMode(y.POINTS):le.isSprite&&yt.setMode(y.TRIANGLES);if(le.isBatchedMesh)if(Fe.get("WEBGL_multi_draw"))yt.renderMultiDraw(le._multiDrawStarts,le._multiDrawCounts,le._multiDrawCount);else{const Gt=le._multiDrawStarts,Oe=le._multiDrawCounts,rn=le._multiDrawCount,ct=Ge?be.get(Ge).bytesPerElement:1,dn=Z.get(se).currentProgram.getUniforms();for(let Cn=0;Cn<rn;Cn++)dn.setValue(y,"_gl_DrawID",Cn),yt.render(Gt[Cn]/ct,Oe[Cn])}else if(le.isInstancedMesh)yt.renderInstances(Ye,Dt,le.count);else if(ce.isInstancedBufferGeometry){const Gt=ce._maxInstanceCount!==void 0?ce._maxInstanceCount:1/0,Oe=Math.min(ce.instanceCount,Gt);yt.renderInstances(Ye,Dt,Oe)}else yt.render(Ye,Dt)};function tt(M,Q,ce){M.transparent===!0&&M.side===un&&M.forceSinglePass===!1?(M.side=en,M.needsUpdate=!0,us(M,Q,ce),M.side=Si,M.needsUpdate=!0,us(M,Q,ce),M.side=un):us(M,Q,ce)}this.compile=function(M,Q,ce=null){ce===null&&(ce=M),T=Ce.get(ce),T.init(Q),x.push(T),ce.traverseVisible(function(le){le.isLight&&le.layers.test(Q.layers)&&(T.pushLight(le),le.castShadow&&T.pushShadow(le))}),M!==ce&&M.traverseVisible(function(le){le.isLight&&le.layers.test(Q.layers)&&(T.pushLight(le),le.castShadow&&T.pushShadow(le))}),T.setupLights();const se=new Set;return M.traverse(function(le){if(!(le.isMesh||le.isPoints||le.isLine||le.isSprite))return;const Ne=le.material;if(Ne)if(Array.isArray(Ne))for(let Be=0;Be<Ne.length;Be++){const Ie=Ne[Be];tt(Ie,ce,le),se.add(Ie)}else tt(Ne,ce,le),se.add(Ne)}),T=x.pop(),se},this.compileAsync=function(M,Q,ce=null){const se=this.compile(M,Q,ce);return new Promise(le=>{function Ne(){if(se.forEach(function(Be){Z.get(Be).currentProgram.isReady()&&se.delete(Be)}),se.size===0){le(M);return}setTimeout(Ne,10)}Fe.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let ue=null;function ht(M){ue&&ue(M)}function Ct(){wt.stop()}function Vt(){wt.start()}const wt=new $u;wt.setAnimationLoop(ht),typeof self<"u"&&wt.setContext(self),this.setAnimationLoop=function(M){ue=M,ze.setAnimationLoop(M),M===null?wt.stop():wt.start()},ze.addEventListener("sessionstart",Ct),ze.addEventListener("sessionend",Vt),this.render=function(M,Q){if(Q!==void 0&&Q.isCamera!==!0){ot("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(B===!0)return;U!==null&&U.renderStart(M,Q);const ce=ze.enabled===!0&&ze.isPresenting===!0,se=A!==null&&(X===null||ce)&&A.begin(k,X);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),Q.parent===null&&Q.matrixWorldAutoUpdate===!0&&Q.updateMatrixWorld(),ze.enabled===!0&&ze.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(ze.cameraAutoUpdate===!0&&ze.updateCamera(Q),Q=ze.getCamera()),M.isScene===!0&&M.onBeforeRender(k,M,Q,X),T=Ce.get(M,x.length),T.init(Q),T.state.textureUnits=oe.getTextureUnits(),x.push(T),J.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),R.setFromProjectionMatrix(J,Un,Q.reversedDepth),I=this.localClippingEnabled,G=Xe.init(this.clippingPlanes,I),b=Re.get(M,L.length),b.init(),L.push(b),ze.enabled===!0&&ze.isPresenting===!0){const Be=k.xr.getDepthSensingMesh();Be!==null&&Nt(Be,Q,-1/0,k.sortObjects)}Nt(M,Q,0,k.sortObjects),b.finish(),k.sortObjects===!0&&b.sort(O,P,Q.reversedDepth),re=ze.enabled===!1||ze.isPresenting===!1||ze.hasDepthSensing()===!1,re&&et.addToRenderList(b,M),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),G===!0&&Xe.beginShadows();const le=T.state.shadowsArray;if($e.render(le,M,Q),G===!0&&Xe.endShadows(),(se&&A.hasRenderPass())===!1){const Be=b.opaque,Ie=b.transmissive;if(T.setupLights(),Q.isArrayCamera){const Ge=Q.cameras;if(Ie.length>0)for(let qe=0,nt=Ge.length;qe<nt;qe++){const rt=Ge[qe];$t(Be,Ie,M,rt)}re&&et.render(M);for(let qe=0,nt=Ge.length;qe<nt;qe++){const rt=Ge[qe];ft(b,M,rt,rt.viewport)}}else Ie.length>0&&$t(Be,Ie,M,Q),re&&et.render(M),ft(b,M,Q)}X!==null&&K===0&&(oe.updateMultisampleRenderTarget(X),oe.updateRenderTargetMipmap(X)),se&&A.end(k),M.isScene===!0&&M.onAfterRender(k,M,Q),De.resetDefaultState(),ge=-1,_e=null,x.pop(),x.length>0?(T=x[x.length-1],oe.setTextureUnits(T.state.textureUnits),G===!0&&Xe.setGlobalState(k.clippingPlanes,T.state.camera)):T=null,L.pop(),L.length>0?b=L[L.length-1]:b=null,U!==null&&U.renderEnd()};function Nt(M,Q,ce,se){if(M.visible===!1)return;if(M.layers.test(Q.layers)){if(M.isGroup)ce=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(Q);else if(M.isLightProbeGrid)T.pushLightProbeGrid(M);else if(M.isLight)T.pushLight(M),M.castShadow&&T.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||R.intersectsSprite(M)){se&&j.setFromMatrixPosition(M.matrixWorld).applyMatrix4(J);const Be=me.update(M),Ie=M.material;Ie.visible&&b.push(M,Be,Ie,ce,j.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||R.intersectsObject(M))){const Be=me.update(M),Ie=M.material;if(se&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),j.copy(M.boundingSphere.center)):(Be.boundingSphere===null&&Be.computeBoundingSphere(),j.copy(Be.boundingSphere.center)),j.applyMatrix4(M.matrixWorld).applyMatrix4(J)),Array.isArray(Ie)){const Ge=Be.groups;for(let qe=0,nt=Ge.length;qe<nt;qe++){const rt=Ge[qe],Ye=Ie[rt.materialIndex];Ye&&Ye.visible&&b.push(M,Be,Ye,ce,j.z,rt)}}else Ie.visible&&b.push(M,Be,Ie,ce,j.z,null)}}const Ne=M.children;for(let Be=0,Ie=Ne.length;Be<Ie;Be++)Nt(Ne[Be],Q,ce,se)}function ft(M,Q,ce,se){const{opaque:le,transmissive:Ne,transparent:Be}=M;T.setupLightsView(ce),G===!0&&Xe.setGlobalState(k.clippingPlanes,ce),se&&_.viewport(ve.copy(se)),le.length>0&&Hi(le,Q,ce),Ne.length>0&&Hi(Ne,Q,ce),Be.length>0&&Hi(Be,Q,ce),_.buffers.depth.setTest(!0),_.buffers.depth.setMask(!0),_.buffers.color.setMask(!0),_.setPolygonOffset(!1)}function $t(M,Q,ce,se){if((ce.isScene===!0?ce.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[se.id]===void 0){const Ye=Fe.has("EXT_color_buffer_half_float")||Fe.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[se.id]=new Fn(1,1,{generateMipmaps:!0,type:Ye?Qn:fn,minFilter:Ui,samples:Math.max(4,C.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:lt.workingColorSpace})}const Ne=T.state.transmissionRenderTarget[se.id],Be=se.viewport||ve;Ne.setSize(Be.z*k.transmissionResolutionScale,Be.w*k.transmissionResolutionScale);const Ie=k.getRenderTarget(),Ge=k.getActiveCubeFace(),qe=k.getActiveMipmapLevel();k.setRenderTarget(Ne),k.getClearColor(Je),Ue=k.getClearAlpha(),Ue<1&&k.setClearColor(16777215,.5),k.clear(),re&&et.render(ce);const nt=k.toneMapping;k.toneMapping=On;const rt=se.viewport;if(se.viewport!==void 0&&(se.viewport=void 0),T.setupLightsView(se),G===!0&&Xe.setGlobalState(k.clippingPlanes,se),Hi(M,ce,se),oe.updateMultisampleRenderTarget(Ne),oe.updateRenderTargetMipmap(Ne),Fe.has("WEBGL_multisampled_render_to_texture")===!1){let Ye=!1;for(let gt=0,Dt=Q.length;gt<Dt;gt++){const Pt=Q[gt],{object:yt,geometry:Gt,material:Oe,group:rn}=Pt;if(Oe.side===un&&yt.layers.test(se.layers)){const ct=Oe.side;Oe.side=en,Oe.needsUpdate=!0,Ir(yt,ce,se,Gt,Oe,rn),Oe.side=ct,Oe.needsUpdate=!0,Ye=!0}}Ye===!0&&(oe.updateMultisampleRenderTarget(Ne),oe.updateRenderTargetMipmap(Ne))}k.setRenderTarget(Ie,Ge,qe),k.setClearColor(Je,Ue),rt!==void 0&&(se.viewport=rt),k.toneMapping=nt}function Hi(M,Q,ce){const se=Q.isScene===!0?Q.overrideMaterial:null;for(let le=0,Ne=M.length;le<Ne;le++){const Be=M[le],{object:Ie,geometry:Ge,group:qe}=Be;let nt=Be.material;nt.allowOverride===!0&&se!==null&&(nt=se),Ie.layers.test(ce.layers
4127)&&Ir(Ie,Q,ce,Ge,nt,qe)}}function Ir(M,Q,ce,se,le,Ne){M.onBeforeRender(k,Q,ce,se,le,Ne),M.modelViewMatrix.multiplyMatrices(ce.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),le.onBeforeRender(k,Q,ce,se,M,Ne),le.transparent===!0&&le.side===un&&le.forceSinglePass===!1?(le.side=en,le.needsUpdate=!0,k.renderBufferDirect(ce,Q,se,le,M,Ne),le.side=Si,le.needsUpdate=!0,k.renderBufferDirect(ce,Q,se,le,M,Ne),le.side=un):k.renderBufferDirect(ce,Q,se,le,M,Ne),M.onAfterRender(k,Q,ce,se,le,Ne)}function us(M,Q,ce){Q.isScene!==!0&&(Q=ae);const se=Z.get(M),le=T.state.lights,Ne=T.state.shadowsArray,Be=le.state.version,Ie=we.getParameters(M,le.state,Ne,Q,ce,T.state.lightProbeGridArray),Ge=we.getProgramCacheKey(Ie);let qe=se.programs;se.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?Q.environment:null,se.fog=Q.fog;const nt=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;se.envMap=Me.get(M.envMap||se.environment,nt),se.envMapRotation=se.environment!==null&&M.envMap===null?Q.environmentRotation:M.envMapRotation,qe===void 0&&(M.addEventListener("dispose",nn),qe=new Map,se.programs=qe);let rt=qe.get(Ge);if(rt!==void 0){if(se.currentProgram===rt&&se.lightsStateVersion===Be)return ic(M,Ie),rt}else Ie.uniforms=we.getUniforms(M),U!==null&&M.isNodeMaterial&&U.build(M,ce,Ie),M.onBeforeCompile(Ie,k),rt=we.acquireProgram(Ie,Ge),qe.set(Ge,rt),se.uniforms=Ie.uniforms;const Ye=se.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Ye.clippingPlanes=Xe.uniform),ic(M,Ie),se.needsLights=yf(M),se.lightsStateVersion=Be,se.needsLights&&(Ye.ambientLightColor.value=le.state.ambient,Ye.lightProbe.value=le.state.probe,Ye.directionalLights.value=le.state.directional,Ye.directionalLightShadows.value=le.state.directionalShadow,Ye.spotLights.value=le.state.spot,Ye.spotLightShadows.value=le.state.spotShadow,Ye.rectAreaLights.value=le.state.rectArea,Ye.ltc_1.value=le.state.rectAreaLTC1,Ye.ltc_2.value=le.state.rectAreaLTC2,Ye.pointLights.value=le.state.point,Ye.pointLightShadows.value=le.state.pointShadow,Ye.hemisphereLights.value=le.state.hemi,Ye.directionalShadowMatrix.value=le.state.directionalShadowMatrix,Ye.spotLightMatrix.value=le.state.spotLightMatrix,Ye.spotLightMap.value=le.state.spotLightMap,Ye.pointShadowMatrix.value=le.state.pointShadowMatrix),se.lightProbeGrid=T.state.lightProbeGridArray.length>0,se.currentProgram=rt,se.uniformsList=null,rt}function nc(M){if(M.uniformsList===null){const Q=M.currentProgram.getUniforms();M.uniformsList=Ks.seqWithValue(Q.seq,M.uniforms)}return M.uniformsList}function ic(M,Q){const ce=Z.get(M);ce.outputColorSpace=Q.outputColorSpace,ce.batching=Q.batching,ce.batchingColor=Q.batchingColor,ce.instancing=Q.instancing,ce.instancingColor=Q.instancingColor,ce.instancingMorph=Q.instancingMorph,ce.skinning=Q.skinning,ce.morphTargets=Q.morphTargets,ce.morphNormals=Q.morphNormals,ce.morphColors=Q.morphColors,ce.morphTargetsCount=Q.morphTargetsCount,ce.numClippingPlanes=Q.numClippingPlanes,ce.numIntersection=Q.numClipIntersection,ce.vertexAlphas=Q.vertexAlphas,ce.vertexTangents=Q.vertexTangents,ce.toneMapping=Q.toneMapping}function xf(M,Q){if(M.length===0)return null;if(M.length===1)return M[0].texture!==null?M[0]:null;S.setFromMatrixPosition(Q.matrixWorld);for(let ce=0,se=M.length;ce<se;ce++){const le=M[ce];if(le.texture!==null&&le.boundingBox.containsPoint(S))return le}return null}function _f(M,Q,ce,se,le){Q.isScene!==!0&&(Q=ae),oe.resetTextureUnits();const Ne=Q.fog,Be=se.isMeshStandardMaterial||se.isMeshLambertMaterial||se.isMeshPhongMaterial?Q.environment:null,Ie=X===null?k.outputColorSpace:X.isXRRenderTarget===!0?X.texture.colorSpace:lt.workingColorSpace,Ge=se.isMeshStandardMaterial||se.isMeshLambertMaterial&&!se.envMap||se.isMeshPhongMaterial&&!se.envMap,qe=Me.get(se.envMap||Be,Ge),nt=se.vertexColors===!0&&!!ce.attributes.color&&ce.attributes.color.itemSize===4,rt=!!ce.attributes.tangent&&(!!se.normalMap||se.anisotropy>0),Ye=!!ce.morphAttributes.position,gt=!!ce.morphAttributes.normal,Dt=!!ce.morphAttributes.color;let Pt=On;se.toneMapped&&(X===null||X.isXRRenderTarget===!0)&&(Pt=k.toneMapping);const yt=ce.morphAttributes.position||ce.morphAttributes.normal||ce.morphAttributes.color,Gt=yt!==void 0?yt.length:0,Oe=Z.get(se),rn=T.state.lights;if(G===!0&&(I===!0||M!==_e)){const Mt=M===_e&&se.id===ge;Xe.setState(se,M,Mt)}let ct=!1;se.version===Oe.__version?(Oe.needsLights&&Oe.lightsStateVersion!==rn.state.ver
vendor: 5,490 bytes, line 4127
4127sion||Oe.outputColorSpace!==Ie||le.isBatchedMesh&&Oe.batching===!1||!le.isBatchedMesh&&Oe.batching===!0||le.isBatchedMesh&&Oe.batchingColor===!0&&le.colorTexture===null||le.isBatchedMesh&&Oe.batchingColor===!1&&le.colorTexture!==null||le.isInstancedMesh&&Oe.instancing===!1||!le.isInstancedMesh&&Oe.instancing===!0||le.isSkinnedMesh&&Oe.skinning===!1||!le.isSkinnedMesh&&Oe.skinning===!0||le.isInstancedMesh&&Oe.instancingColor===!0&&le.instanceColor===null||le.isInstancedMesh&&Oe.instancingColor===!1&&le.instanceColor!==null||le.isInstancedMesh&&Oe.instancingMorph===!0&&le.morphTexture===null||le.isInstancedMesh&&Oe.instancingMorph===!1&&le.morphTexture!==null||Oe.envMap!==qe||se.fog===!0&&Oe.fog!==Ne||Oe.numClippingPlanes!==void 0&&(Oe.numClippingPlanes!==Xe.numPlanes||Oe.numIntersection!==Xe.numIntersection)||Oe.vertexAlphas!==nt||Oe.vertexTangents!==rt||Oe.morphTargets!==Ye||Oe.morphNormals!==gt||Oe.morphColors!==Dt||Oe.toneMapping!==Pt||Oe.morphTargetsCount!==Gt||!!Oe.lightProbeGrid!=T.state.lightProbeGridArray.length>0)&&(ct=!0):(ct=!0,Oe.__version=se.version);let dn=Oe.currentProgram;ct===!0&&(dn=us(se,Q,le),U&&se.isNodeMaterial&&U.onUpdateProgram(se,dn,Oe));let Cn=!1,ai=!1,Vi=!1;const St=dn.getUniforms(),Lt=Oe.uniforms;if(_.useProgram(dn.program)&&(Cn=!0,ai=!0,Vi=!0),se.id!==ge&&(ge=se.id,ai=!0),Oe.needsLights){const Mt=xf(T.state.lightProbeGridArray,le);Oe.lightProbeGrid!==Mt&&(Oe.lightProbeGrid=Mt,ai=!0)}if(Cn||_e!==M){_.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),St.setValue(y,"projectionMatrix",M.projectionMatrix),St.setValue(y,"viewMatrix",M.matrixWorldInverse);const li=St.map.cameraPosition;li!==void 0&&li.setValue(y,D.setFromMatrixPosition(M.matrixWorld)),C.logarithmicDepthBuffer&&St.setValue(y,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&St.setValue(y,"isOrthographic",M.isOrthographicCamera===!0),_e!==M&&(_e=M,ai=!0,Vi=!0)}if(Oe.needsLights&&(rn.state.directionalShadowMap.length>0&&St.setValue(y,"directionalShadowMap",rn.state.directionalShadowMap,oe),rn.state.spotShadowMap.length>0&&St.setValue(y,"spotShadowMap",rn.state.spotShadowMap,oe),rn.state.pointShadowMap.length>0&&St.setValue(y,"pointShadowMap",rn.state.pointShadowMap,oe)),le.isSkinnedMesh){St.setOptional(y,le,"bindMatrix"),St.setOptional(y,le,"bindMatrixInverse");const Mt=le.skeleton;Mt&&(Mt.boneTexture===null&&Mt.computeBoneTexture(),St.setValue(y,"boneTexture",Mt.boneTexture,oe))}le.isBatchedMesh&&(St.setOptional(y,le,"batchingTexture"),St.setValue(y,"batchingTexture",le._matricesTexture,oe),St.setOptional(y,le,"batchingIdTexture"),St.setValue(y,"batchingIdTexture",le._indirectTexture,oe),St.setOptional(y,le,"batchingColorTexture"),le._colorsTexture!==null&&St.setValue(y,"batchingColorTexture",le._colorsTexture,oe));const oi=ce.morphAttributes;if((oi.position!==void 0||oi.normal!==void 0||oi.color!==void 0)&&Y.update(le,ce,dn),(ai||Oe.receiveShadow!==le.receiveShadow)&&(Oe.receiveShadow=le.receiveShadow,St.setValue(y,"receiveShadow",le.receiveShadow)),(se.isMeshStandardMaterial||se.isMeshLambertMaterial||se.isMeshPhongMaterial)&&se.envMap===null&&Q.environment!==null&&(Lt.envMapIntensity.value=Q.environmentIntensity),Lt.dfgLUT!==void 0&&(Lt.dfgLUT.value=Iy()),ai){if(St.setValue(y,"toneMappingExposure",k.toneMappingExposure),Oe.needsLights&&vf(Lt,Vi),Ne&&se.fog===!0&&He.refreshFogUniforms(Lt,Ne),He.refreshMaterialUniforms(Lt,se,F,q,T.state.transmissionRenderTarget[M.id]),Oe.needsLights&&Oe.lightProbeGrid){const Mt=Oe.lightProbeGrid;Lt.probesSH.value=Mt.texture,Lt.probesMin.value.copy(Mt.boundingBox.min),Lt.probesMax.value.copy(Mt.boundingBox.max),Lt.probesResolution.value.copy(Mt.resolution)}Ks.upload(y,nc(Oe),Lt,oe)}if(se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(Ks.upload(y,nc(Oe),Lt,oe),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&St.setValue(y,"center",le.center),St.setValue(y,"modelViewMatrix",le.modelViewMatrix),St.setValue(y,"normalMatrix",le.normalMatrix),St.setValue(y,"modelMatrix",le.matrixWorld),se.uniformsGroups!==void 0){const Mt=se.uniformsGroups;for(let li=0,Gi=Mt.length;li<Gi;li++){const rc=Mt[li];ye.update(rc,dn),ye.bind(rc,dn)}}return dn}function vf(M,Q){M.ambientLightColor.needsUpdate=Q,M.lightProbe.needsUpdate=Q,M.directionalLights.needsUpdate=Q,M.directionalLightShadows.needsUpdate=Q,M.pointLights.needsUpdate=Q,M.pointLightShadows.needsUpdate=Q,M.spotLights.needsUpdate=Q,M.spotLightShadows.needsUpdate=Q,M.rectAreaLights.needsUpdate=Q,M.hemisphereLights.needsUpdate=Q}function yf(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return ne},this.getActiveMipmapLevel=function(){return K},this.getRenderTarget=function(){return X},this.setRenderTargetTextures=function(M,Q,ce){const se=Z.get(M);se.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,se.__autoAllocateDepthBuffer===!1&&(se.__useRenderToTexture=!1),Z.get(M.texture).__webglTexture=Q,Z.get(M.depthTexture).__webglTexture=se.__autoAllocateDepthBuffer?void 0:ce,se.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,Q){const ce=Z.get(M);ce.__webglFramebuffer=Q,ce.__useDefaultFramebuffer=Q===void 0},this.setRenderTarget=function(M,Q=0,ce=0){X=M,ne=Q,K=ce;let se=null,le=!1,Ne=!1;
vendor: 8,710 bytes, line 4127
4127if(M){const Ie=Z.get(M);if(Ie.__useDefaultFramebuffer!==void 0){_.bindFramebuffer(y.FRAMEBUFFER,Ie.__webglFramebuffer),ve.copy(M.viewport),Ee.copy(M.scissor),We=M.scissorTest,_.viewport(ve),_.scissor(Ee),_.setScissorTest(We),ge=-1;return}else if(Ie.__webglFramebuffer===void 0)oe.setupRenderTarget(M);else if(Ie.__hasExternalTextures)oe.rebindTextures(M,Z.get(M.texture).__webglTexture,Z.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const nt=M.depthTexture;if(Ie.__boundDepthTexture!==nt){if(nt!==null&&Z.has(nt)&&(M.width!==nt.image.width||M.height!==nt.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");oe.setupDepthRenderbuffer(M)}}const Ge=M.texture;(Ge.isData3DTexture||Ge.isDataArrayTexture||Ge.isCompressedArrayTexture)&&(Ne=!0);const qe=Z.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(qe[Q])?se=qe[Q][ce]:se=qe[Q],le=!0):M.samples>0&&oe.useMultisampledRTT(M)===!1?se=Z.get(M).__webglMultisampledFramebuffer:Array.isArray(qe)?se=qe[ce]:se=qe,ve.copy(M.viewport),Ee.copy(M.scissor),We=M.scissorTest}else ve.copy(W).multiplyScalar(F).floor(),Ee.copy(he).multiplyScalar(F).floor(),We=pe;if(ce!==0&&(se=te),_.bindFramebuffer(y.FRAMEBUFFER,se)&&_.drawBuffers(M,se),_.viewport(ve),_.scissor(Ee),_.setScissorTest(We),le){const Ie=Z.get(M.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Ie.__webglTexture,ce)}else if(Ne){const Ie=Q;for(let Ge=0;Ge<M.textures.length;Ge++){const qe=Z.get(M.textures[Ge]);y.framebufferTextureLayer(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0+Ge,qe.__webglTexture,ce,Ie)}}else if(M!==null&&ce!==0){const Ie=Z.get(M.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,Ie.__webglTexture,ce)}ge=-1},this.readRenderTargetPixels=function(M,Q,ce,se,le,Ne,Be,Ie=0){if(!(M&&M.isWebGLRenderTarget)){ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ge=Z.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Be!==void 0&&(Ge=Ge[Be]),Ge){_.bindFramebuffer(y.FRAMEBUFFER,Ge);try{const qe=M.textures[Ie],nt=qe.format,rt=qe.type;if(M.textures.length>1&&y.readBuffer(y.COLOR_ATTACHMENT0+Ie),!C.textureFormatReadable(nt)){ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!C.textureTypeReadable(rt)){ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Q>=0&&Q<=M.width-se&&ce>=0&&ce<=M.height-le&&y.readPixels(Q,ce,se,le,Pe.convert(nt),Pe.convert(rt),Ne)}finally{const qe=X!==null?Z.get(X).__webglFramebuffer:null;_.bindFramebuffer(y.FRAMEBUFFER,qe)}}},this.readRenderTargetPixelsAsync=async function(M,Q,ce,se,le,Ne,Be,Ie=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ge=Z.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Be!==void 0&&(Ge=Ge[Be]),Ge)if(Q>=0&&Q<=M.width-se&&ce>=0&&ce<=M.height-le){_.bindFramebuffer(y.FRAMEBUFFER,Ge);const qe=M.textures[Ie],nt=qe.format,rt=qe.type;if(M.textures.length>1&&y.readBuffer(y.COLOR_ATTACHMENT0+Ie),!C.textureFormatReadable(nt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!C.textureTypeReadable(rt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ye=y.createBuffer();y.bindBuffer(y.PIXEL_PACK_BUFFER,Ye),y.bufferData(y.PIXEL_PACK_BUFFER,Ne.byteLength,y.STREAM_READ),y.readPixels(Q,ce,se,le,Pe.convert(nt),Pe.convert(rt),0);const gt=X!==null?Z.get(X).__webglFramebuffer:null;_.bindFramebuffer(y.FRAMEBUFFER,gt);const Dt=y.fenceSync(y.SYNC_GPU_COMMANDS_COMPLETE,0);return y.flush(),await cm(y,Dt,4),y.bindBuffer(y.PIXEL_PACK_BUFFER,Ye),y.getBufferSubData(y.PIXEL_PACK_BUFFER,0,Ne),y.deleteBuffer(Ye),y.deleteSync(Dt),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,Q=null,ce=0){const se=Math.pow(2,-ce),le=Math.floor(M.image.width*se),Ne=Math.floor(M.image.height*se),Be=Q!==null?Q.x:0,Ie=Q!==null?Q.y:0;oe.setTexture2D(M,0),y.copyTexSubImage2D(y.TEXTURE_2D,ce,0,0,Be,Ie,le,Ne),_.unbindTexture()},this.copyTextureToTexture=function(M,Q,ce=null,se=null,le=0,Ne=0){let Be,Ie,Ge,qe,nt,rt,Ye,gt,Dt;const Pt=M.isCompressedTexture?M.mipmaps[Ne]:M.image;if(ce!==null)Be=ce.max.x-ce.min.x,Ie=ce.max.y-ce.min.y,Ge=ce.isBox3?ce.max.z-ce.min.z:1,qe=ce.min.x,nt=ce.min.y,rt=ce.isBox3?ce.min.z:0;else{const Lt=Math.pow(2,-le);Be=Math.floor(Pt.width*Lt),Ie=Math.floor(Pt.height*Lt),M.isDataArrayTexture?Ge=Pt.depth:M.isData3DTexture?Ge=Math.floor(Pt.depth*Lt):Ge=1,qe=0,nt=0,rt=0}se!==null?(Ye=se.x,gt=se.y,Dt=se.z):(Ye=0,gt=0,Dt=0);const yt=Pe.convert(Q.format),Gt=Pe.convert(Q.type);let Oe;Q.isData3DTexture?(oe.setTexture3D(Q,0),Oe=y.TEXTURE_3D):Q.isDataArrayTexture||Q.isCompressedArrayTexture?(oe.setTexture2DArray(Q,0),Oe=y.TEXTURE_2D_ARRAY):(oe.setTexture2D(Q,0),Oe=y.TEXTURE_2D),_.activeTexture(y.TEXTURE0),_.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,Q.flipY),_.pixelStorei(y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),_.pixelStorei(y.UNPACK_ALIGNMENT,Q.unpackAlignment);const rn=_.getParameter(y.UNPACK_ROW_LENGTH),ct=_.getParameter(y.UNPACK_IMAGE_HEIGHT),dn=_.getParameter(y.UNPACK_SKIP_PIXELS),Cn=_.getParameter(y.UNPACK_SKIP_ROWS),ai=_.getParameter(y.UNPACK_SKIP_IMAGES);_.pixelStorei(y.UNPACK_ROW_LENGTH,Pt.width),_.pixelStorei(y.UNPACK_IMAGE_HEIGHT,Pt.height),_.pixelStorei(y.UNPACK_SKIP_PIXELS,qe),_.pixelStorei(y.UNPACK_SKIP_ROWS,nt),_.pixelStorei(y.UNPACK_SKIP_IMAGES,rt);const Vi=M.isDataArrayTexture||M.isData3DTexture,St=Q.isDataArrayTexture||Q.isData3DTexture;if(M.isDepthTexture){const Lt=Z.get(M),oi=Z.get(Q),Mt=Z.get(Lt.__renderTarget),li=Z.get(oi.__renderTarget);_.bindFramebuffer(y.READ_FRAMEBUFFER,Mt.__webglFramebuffer),_.bindFramebuffer(y.DRAW_FRAMEBUFFER,li.__webglFramebuffer);for(let Gi=0;Gi<Ge;Gi++)Vi&&(y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,Z.get(M).__webglTexture,le,rt+Gi),y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,Z.get(Q).__webglTexture,Ne,Dt+Gi)),y.blitFramebuffer(qe,nt,Be,Ie,Ye,gt,Be,Ie,y.DEPTH_BUFFER_BIT,y.NEAREST);_.bindFramebuffer(y.READ_FRAMEBUFFER,null),_.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else if(le!==0||M.isRenderTargetTexture||Z.has(M)){const Lt=Z.get(M),oi=Z.get(Q);_.bindFramebuffer(y.READ_FRAMEBUFFER,ee),_.bindFramebuffer(y.DRAW_FRAMEBUFFER,$);for(let Mt=0;Mt<Ge;Mt++)Vi?y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,Lt.__webglTexture,le,rt+Mt):y.framebufferTexture2D(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,Lt.__webglTexture,le),St?y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,oi.__webglTexture,Ne,Dt+Mt):y.framebufferTexture2D(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,oi.__webglTexture,Ne),le!==0?y.blitFramebuffer(qe,nt,Be,Ie,Ye,gt,Be,Ie,y.COLOR_BUFFER_BIT,y.NEAREST):St?y.copyTexSubImage3D(Oe,Ne,Ye,gt,Dt+Mt,qe,nt,Be,Ie):y.copyTexSubImage2D(Oe,Ne,Ye,gt,qe,nt,Be,Ie);_.bindFramebuffer(y.READ_FRAMEBUFFER,null),_.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else St?M.isDataTexture||M.isData3DTexture?y.texSubImage3D(Oe,Ne,Ye,gt,Dt,Be,Ie,Ge,yt,Gt,Pt.data):Q.isCompressedArrayTexture?y.compressedTexSubImage3D(Oe,Ne,Ye,gt,Dt,Be,Ie,Ge,yt,Pt.data):y.texSubImage3D(Oe,Ne,Ye,gt,Dt,Be,Ie,Ge,yt,Gt,Pt):M.isDataTexture?y.texSubImage2D(y.TEXTURE_2D,Ne,Ye,gt,Be,Ie,yt,Gt,Pt.data):M.isCompressedTexture?y.compressedTexSubImage2D(y.TEXTURE_2D,Ne,Ye,gt,Pt.width,Pt.height,yt,Pt.data):y.texSubImage2D(y.TEXTURE_2D,Ne,Ye,gt,Be,Ie,yt,Gt,Pt);_.pixelStorei(y.UNPACK_ROW_LENGTH,rn),_.pixelStorei(y.UNPACK_IMAGE_HEIGHT,ct),_.pixelStorei(y.UNPACK_SKIP_PIXELS,dn),_.pixelStorei(y.UNPACK_SKIP_ROWS,Cn),_.pixelStorei(y.UNPACK_SKIP_IMAGES,ai),Ne===0&&Q.generateMipmaps&&y.generateMipmap(Oe),_.unbindTexture()},this.initRenderTarget=function(M){Z.get(M).__webglFramebuffer===void 0&&oe.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?oe.setTextureCube(M,0):M.isData3DTexture?oe.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?oe.setTexture2DArray(M,0):oe.setTexture2D(M,0),_.unbindTexture()},this.resetState=function(){ne=0,K=0,X=null,_.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Un}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();
vendor: 18,288 bytes, line 4127
4127t.drawingBufferColorSpace=lt._getDrawingBufferColorSpace(e),t.unpackColorSpace=lt._getUnpackColorSpace()}}const Rh={type:"change"},$l={type:"start"},rf={type:"end"},ks=new Ol,Ch=new gi,Uy=Math.cos(70*fm.DEG2RAD),Ut=new V,Qt=2*Math.PI,vt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},mo=1e-6;class Oy extends Bg{constructor(e,t=null){super(e,t),this.state=vt.NONE,this.target=new V,this.cursor=new V,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:mr.ROTATE,MIDDLE:mr.DOLLY,RIGHT:mr.PAN},this.touches={ONE:ur.ROTATE,TWO:ur.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new V,this._lastQuaternion=new ti,this._lastTargetPosition=new V,this._quat=new ti().setFromUnitVectors(e.up,new V(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new th,this._sphericalDelta=new th,this._scale=1,this._panOffset=new V,this._rotateStart=new de,this._rotateEnd=new de,this._rotateDelta=new de,this._panStart=new de,this._panEnd=new de,this._panDelta=new de,this._dollyStart=new de,this._dollyEnd=new de,this._dollyDelta=new de,this._dollyDirection=new V,this._mouse=new de,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=By.bind(this),this._onPointerDown=Fy.bind(this),this._onPointerUp=zy.bind(this),this._onContextMenu=qy.bind(this),this._onMouseWheel=Vy.bind(this),this._onKeyDown=Gy.bind(this),this._onTouchStart=Wy.bind(this),this._onTouchMove=Xy.bind(this),this._onMouseDown=ky.bind(this),this._onMouseMove=Hy.bind(this),this._interceptControlDown=Yy.bind(this),this._interceptControlUp=jy.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Rh),this.update(),this.state=vt.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;Ut.copy(t).sub(this.target),Ut.applyQuaternion(this._quat),this._spherical.setFromVector3(Ut),this.autoRotate&&this.state===vt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Qt:n>Math.PI&&(n-=Qt),r<-Math.PI?r+=Qt:r>Math.PI&&(r-=Qt),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(Ut.setFromSpherical(this._spherical),Ut.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ut),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=Ut.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new V(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new V(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=Ut.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(ks.origin.copy(this.object.position),ks.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ks.direction))<Uy?this.object.lookAt(this.target):(Ch.setFromNormalAndCoplanarPoint(this.object.up,this.target),ks.intersectPlane(Ch,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>mo||8*(1-this._lastQuaternion.dot(this.object.quaternion))>mo||this._lastTargetPosition.distanceToSquared(this.target)>mo?(this.dispatchEvent(Rh),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Qt/60*this.autoRotateSpeed*e:Qt/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ut.setFromMatrixColumn(t,0),Ut.multiplyScalar(-e),this._panOffset.add(Ut)}_panUp(e,t){this.screenSpacePanning===!0?Ut.setFromMatrixColumn(t,1):(Ut.setFromMatrixColumn(t,0),Ut.crossVectors(this.object.up,Ut)),Ut.multiplyScalar(e),this._panOffset.add(Ut)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Ut.copy(r).sub(this.target);let s=Ut.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Qt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Qt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Qt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Qt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Qt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Qt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Qt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Qt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new de,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Fy(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function By(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function zy(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(rf),this.state=vt.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function ky(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case mr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=vt.DOLLY;break;case mr.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=vt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=vt.ROTATE}break;case mr.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=vt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=vt.PAN}break;default:this.state=vt.NONE}this.state!==vt.NONE&&this.dispatchEvent($l)}function Hy(i){switch(this.state){case vt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case vt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case vt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function Vy(i){this.enabled===!1||this.enableZoom===!1||this.state!==vt.NONE||(i.preventDefault(),this.dispatchEvent($l),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(rf))}function Gy(i){this.enabled!==!1&&this._handleKeyDown(i)}function Wy(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case ur.ROTATE:if(this.enableRotate===!1)return;
4127this._handleTouchStartRotate(i),this.state=vt.TOUCH_ROTATE;break;case ur.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=vt.TOUCH_PAN;break;default:this.state=vt.NONE}break;case 2:switch(this.touches.TWO){case ur.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=vt.TOUCH_DOLLY_PAN;break;case ur.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=vt.TOUCH_DOLLY_ROTATE;break;default:this.state=vt.NONE}break;default:this.state=vt.NONE}this.state!==vt.NONE&&this.dispatchEvent($l)}function Xy(i){switch(this._trackPointer(i),this.state){case vt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case vt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case vt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case vt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=vt.NONE}}function qy(i){this.enabled!==!1&&i.preventDefault()}function Yy(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function jy(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const os=Jt;class da extends Yl{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,n,r){const s=this,a=new Cg(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e){const t=this;function n(F,O){if(F.nodeType!==1)return;F.hasAttribute("filter")&&console.warn("THREE.SVGLoader: Filters are not supported.");const P=b(F);let W=!1,he=null;switch(F.nodeName){case"svg":O=v(F,O);break;case"style":s(F);break;case"g":O=v(F,O);break;case"path":O=v(F,O),F.hasAttribute("d")&&(he=r(F));break;case"rect":O=v(F,O),he=l(F);break;case"polygon":O=v(F,O),he=c(F);break;case"polyline":O=v(F,O),he=u(F);break;case"circle":O=v(F,O),he=f(F);break;case"ellipse":O=v(F,O),he=h(F);break;case"line":O=v(F,O),he=d(F);break;case"defs":W=!0;break;case"use":O=v(F,O);const G=(F.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),I=F.viewportElement.getElementById(G);I?n(I,O):console.warn("SVGLoader: 'use node' references non-existent node id: "+G);break}if(he){O.fill!==void 0&&O.fill!=="none"&&!O.fill.startsWith("url")&&he.color.setStyle(O.fill,os),x(he,Ue),$.push(he);const R=Object.assign({},O);R.strokeWidth=O.strokeWidth*te(Ue),he.userData={node:F,style:R,transform:Ue.clone(),gradients:K}}const pe=F.childNodes;for(let R=0;R<pe.length;R++){const G=pe[R];W&&G.nodeName!=="style"&&G.nodeName!=="defs"||n(G,O)}P&&(X.pop(),X.length>0?Ue.copy(X[X.length-1]):Ue.identity())}function r(F){const O=new Ri,P=new de,W=new de,he=new de;let pe=!0,R=!1;const G=F.getAttribute("d");if(G===""||G==="none")return null;const I=G.match(/[a-df-z][^a-df-z]*/ig);for(let J=0,D=I.length;J<D;J++){const j=I[J],ae=j.charAt(0),re=j.slice(1).trim();pe===!0&&(R=!0,pe=!1);let H;switch(ae){case"M":H=p(re);for(let y=0,Se=H.length;y<Se;y+=2)P.x=H[y+0],P.y=H[y+1],W.x=P.x,W.y=P.y,y===0?O.moveTo(P.x,P.y):O.lineTo(P.x,P.y),y===0&&he.copy(P);break;case"H":H=p(re);for(let y=0,Se=H.length;y<Se;y++)P.x=H[y],W.x=P.x,W.y=P.y,O.lineTo(P.x,P.y),y===0&&R===!0&&he.copy(P);break;case"V":H=p(re);for(let y=0,Se=H.length;y<Se;y++)P.y=H[y],W.x=P.x,W.y=P.y,O.lineTo(P.x,P.y),y===0&&R===!0&&he.copy(P);break;case"L":H=p(re);for(let y=0,Se=H.length;y<Se;y+=2)P.x=H[y+0],P.y=H[y+1],W.x=P.x,W.y=P.y,O.lineTo(P.x,P.y),y===0&&R===!0&&he.copy(P);break;case"C":H=p(re);for(let y=0,Se=H.length;y<Se;y+=6)O.bezierCurveTo(H[y+0],H[y+1],H[y+2],H[y+3],H[y+4],H[y+5]),W.x=H[y+2],W.y=H[y+3],P.x=H[y+4],P.y=H[y+5],y===0&&R===!0&&he.copy(P);break;case"S":H=p(re);for(let y=0,Se=H.length;y<Se;y+=4)O.bezierCurveTo(m(P.x,W.x),m(P.y,W.y),H[y+0],H[y+1],H[y+2],H[y+3]),W.x=H[y+0],W.y=H[y+1],P.x=H[y+2],P.y=H[y+3],y===0&&R===!0&&he.copy(P);break;case"Q":H=p(re);for(let y=0,Se=H.length;y<Se;y+=4)O.quadraticCurveTo(H[y+0],H[y+1],H[y+2],H[y+3]),W.x=H[y+0],W.y=H[y+1],P.x=H[y+2],P.y=H[y+3],y===0&&R===!0&&he.copy(P);break;case"T":H=p(re);for(let y=0,Se=H.length;y<Se;y+=2){const Fe=m(P.x,W.x),C=m(P.y,W.y);O.quadraticCurveTo(Fe,C,H[y+0],H[y+1]),W.x=Fe,W.y=C,P.x=H[y+0],P.y=H[y+1],y===0&&R===!0&&he.copy(P)}break;case"A":H=p(re,[3,4],7);for(let y=0,Se=H.length;y<Se;y+=7){if(H[y+5]==P.x&&H[y+6]==P.y)continue;const Fe=P.clone();P.x=H[y+5],P.y=H[y+6],W.x=P.x,W.y=P.y,a(O,H[y],H[y+1],H[y+2],H[y+3],H[y+4],Fe,P),y===0&&R===!0&&he.copy(P)}break;case"m":H=p(re);for(let y=0,Se=H.length;y<Se;y+=2)P.x+=H[y+0],P.y+=H[y+1],W.x=P.x,W.y=P.y,y===0?O.moveTo(P.x,P.y):O.lineTo(P.x,P.y),y===0&&he.copy(P);break;case"h":H=p(re);for(let y=0,Se=H.length;y<Se;y++)P.x+=H[y],W.x=P.x,W.y=P.y,O.lineTo(P.x,P.y),y===0&&R===!0&&he.copy(P);break;case"v":H=p(re);for(let y=0,Se=H.length;y<Se;y++)P.y+=H[y],W.x=P.x,W.y=P.y,O.lineTo(P.x,P.y),y===0&&R===!0&&he.copy(P);break;case"l":H=p(re);for(let y=0,Se=H.length;y<Se;y+=2)P.x+=H[y+0],P.y+=H[y+1],W.x=P.x,W.y=P.y,O.lineTo(P.x,P.y),y===0&&R===!0&&he.copy(P);break;case"c":H=p(re);for(let y=0,Se=H.length;y<Se;y+=6)O.bezierCurveTo(P.x+H[y+0],P.y+H[y+1],P.x+H[y+2],P.y+H[y+3],P.x+H[y+4],P.y+H[y+5]),W.x=P.x+H[y+2],W.y=P.y+H[y+3],P.x+=H[y+4],P.y+=H[y+5],y===0&&R===!0&&he.copy(P);break;case"s":H=p(re);for(let y=0,Se=H.length;y<Se;y+=4)O.bezierCurveTo(m(P.x,W.x),m(P.y,W.y),P.x+H[y+0],P.y+H[y+1],P.x+H[y+2],P.y+H[y+3]),W.x=P.x+H[y+0],W.y=P.y+H[y+1],P.x+=H[y+2],P.y+=H[y+3],y===0&&R===!0&&he.copy(P);break;case"q":H=p(re);for(let y=0,Se=H.length;y<Se;y+=4)O.quadraticCurveTo(P.x+H[y+0],P.y+H[y+1],P.x+H[y+2],P.y+H[y+3]),W.x=P.x+H[y+0],W.y=P.y+H[y+1],P.x+=H[y+2],P.y+=H[y+3],y===0&&R===!0&&he.copy(P);break;case"t":H=p(re);for(let y=0,Se=H.length;y<Se;y+=2){const Fe=m(P.x,W.x),C=m(P.y,W.y);O.quadraticCurveTo(Fe,C,P.x+H[y+0],P.y+H[y+1]),W.x=Fe,W.y=C,P.x=P.x+H[y+0],P.y=P.y+H[y+1],y===0&&R===!0&&he.copy(P)}break;case"a":H=p(re,[3,4],7);for(let y=0,Se=H.length;y<Se;y+=7){if(H[y+5]==0&&H[y+6]==0)continue;const Fe=P.clone();P.x+=H[y+5],P.y+=H[y+6],W.x=P.x,W.y=P.y,a(O,H[y],H[y+1],H[y+2],H[y+3],H[y+4],Fe,P),y===0&&R===!0&&he.copy(P)}break;case"Z":case"z":O.currentPath.autoClose=!0,O.currentPath.curves.length>0&&(P.copy(he),O.currentPath.currentPoint.copy(P),pe=!0);break;default:console.warn(j)}R=!1}return O}function s(F){if(!(!F.sheet||!F.sheet.cssRules||!F.sheet.cssRules.length))for(let O=0;O<F.sheet.cssRules.length;O++){const P=F.sheet.cssRules[O];if(P.type!==1)continue;
4127const W=P.selectorText.split(/,/gm).filter(Boolean).map(he=>he.trim());for(let he=0;he<W.length;he++){const pe=Object.fromEntries(Object.entries(P.style).filter(([,R])=>R!==""));ne[W[he]]=Object.assign(ne[W[he]]||{},pe)}}}function a(F,O,P,W,he,pe,R,G){if(O==0||P==0){F.lineTo(G.x,G.y);return}W=W*Math.PI/180,O=Math.abs(O),P=Math.abs(P);const I=(R.x-G.x)/2,J=(R.y-G.y)/2,D=Math.cos(W)*I+Math.sin(W)*J,j=-Math.sin(W)*I+Math.cos(W)*J;let ae=O*O,re=P*P;const H=D*D,y=j*j,Se=H/ae+y/re;if(Se>1){const me=Math.sqrt(Se);O=me*O,P=me*P,ae=O*O,re=P*P}const Fe=ae*y+re*H,C=(ae*re-Fe)/Fe;let _=Math.sqrt(Math.max(0,C));he===pe&&(_=-_);const z=_*O*j/P,Z=-_*P*D/O,oe=Math.cos(W)*z-Math.sin(W)*Z+(R.x+G.x)/2,Me=Math.sin(W)*z+Math.cos(W)*Z+(R.y+G.y)/2,be=o(1,0,(D-z)/O,(j-Z)/P),fe=o((D-z)/O,(j-Z)/P,(-D-z)/O,(-j-Z)/P)%(Math.PI*2);F.currentPath.absellipse(oe,Me,O,P,be,be+fe,pe===0,W)}function o(F,O,P,W){const he=F*P+O*W,pe=Math.sqrt(F*F+O*O)*Math.sqrt(P*P+W*W);let R=Math.acos(Math.max(-1,Math.min(1,he/pe)));return F*W-O*P<0&&(R=-R),R}function l(F){const O=S(F.getAttribute("x")||0),P=S(F.getAttribute("y")||0),W=S(F.getAttribute("rx")||F.getAttribute("ry")||0),he=S(F.getAttribute("ry")||F.getAttribute("rx")||0),pe=S(F.getAttribute("width")),R=S(F.getAttribute("height")),G=1-.551915024494,I=new Ri;return I.moveTo(O+W,P),I.lineTo(O+pe-W,P),(W!==0||he!==0)&&I.bezierCurveTo(O+pe-W*G,P,O+pe,P+he*G,O+pe,P+he),I.lineTo(O+pe,P+R-he),(W!==0||he!==0)&&I.bezierCurveTo(O+pe,P+R-he*G,O+pe-W*G,P+R,O+pe-W,P+R),I.lineTo(O+W,P+R),(W!==0||he!==0)&&I.bezierCurveTo(O+W*G,P+R,O,P+R-he*G,O,P+R-he),I.lineTo(O,P+he),(W!==0||he!==0)&&I.bezierCurveTo(O,P+he*G,O+W*G,P,O+W,P),I}function c(F){function O(pe,R,G){const I=S(R),J=S(G);he===0?W.moveTo(I,J):W.lineTo(I,J),he++}const P=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,W=new Ri;let he=0;return F.getAttribute("points").replace(P,O),W.currentPath.autoClose=!0,W}function u(F){function O(pe,R,G){const I=S(R),J=S(G);he===0?W.moveTo(I,J):W.lineTo(I,J),he++}const P=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,W=new Ri;let he=0;return F.getAttribute("points").replace(P,O),W.currentPath.autoClose=!1,W}function f(F){const O=S(F.getAttribute("cx")||0),P=S(F.getAttribute("cy")||0),W=S(F.getAttribute("r")||0),he=new wr;he.absarc(O,P,W,0,Math.PI*2);const pe=new Ri;return pe.subPaths.push(he),pe}function h(F){const O=S(F.getAttribute("cx")||0),P=S(F.getAttribute("cy")||0),W=S(F.getAttribute("rx")||0),he=S(F.getAttribute("ry")||0),pe=new wr;pe.absellipse(O,P,W,he,0,Math.PI*2);const R=new Ri;return R.subPaths.push(pe),R}
4127function d(F){const O=S(F.getAttribute("x1")||0),P=S(F.getAttribute("y1")||0),W=S(F.getAttribute("x2")||0),he=S(F.getAttribute("y2")||0),pe=new Ri;return pe.moveTo(O,P),pe.lineTo(W,he),pe.currentPath.autoClose=!1,pe}function g(F){const O="http://www.w3.org/1999/xlink",P=F.querySelectorAll("linearGradient, radialGradient"),W=["x1","y1","x2","y2","cx","cy","r","fx","fy","gradientUnits","gradientTransform","spreadMethod"],he={};for(const R of P){const G=R.getAttribute("id");if(!G)continue;const I={type:R.nodeName==="radialGradient"?"radialGradient":"linearGradient",attrs:{},stops:null,href:null},J=R.getAttributeNS(O,"href")||R.getAttribute("href")||"";J.startsWith("#")&&(I.href=J.substring(1));for(const j of W)R.hasAttribute(j)&&(I.attrs[j]=R.getAttribute(j));const D=R.querySelectorAll("stop");if(D.length>0){I.stops=[];for(const j of D){let ae=j.getAttribute("stop-color");!ae&&j.style&&(ae=j.style["stop-color"]),ae||(ae="#000");let re=j.getAttribute("stop-opacity");(re===null||re==="")&&j.style&&(re=j.style["stop-opacity"]),re=re===null||re===""||re===void 0?1:Math.max(0,Math.min(1,parseFloat(re)));const H=Math.max(0,Math.min(1,parseFloat(j.getAttribute("offset")||"0")));I.stops.push({offset:H,color:ae,opacity:re})}}he[G]=I}function pe(R,G){const I=he[R];if(!I||G.has(R))return I;if(G.add(R),I.href&&he[I.href]){const J=pe(I.href,G);if(J){I.stops||(I.stops=J.stops);for(const D in J.attrs)D in I.attrs||(I.attrs[D]=J.attrs[D])}}return I}for(const R in he)pe(R,new Set);for(const R in he){let j=function(ae){return typeof ae!="string"?0:ae.endsWith("%")?parseFloat(ae)/100:S(ae)};const G=he[R],I=G.attrs,J=I.gradientUnits==="userSpaceOnUse"?"userSpaceOnUse":"objectBoundingBox",D={type:G.type,gradientUnits:J,spreadMethod:I.spreadMethod==="reflect"||I.spreadMethod==="repeat"?I.spreadMethod:"pad",gradientTransform:null,stops:(G.stops||[]).slice().sort((ae,re)=>ae.offset-re.offset)};if(I.gradientTransform&&(D.gradientTransform=new je,L(I.gradientTransform,D.gradientTransform)),G.type==="linearGradient")D.x1=I.x1!==void 0?j(I.x1):0,D.y1=I.y1!==void 0?j(I.y1):0,D.x2=I.x2!==void 0?j(I.x2):J==="objectBoundingBox"?1:0,D.y2=I.y2!==void 0?j(I.y2):0;else{const ae=J==="objectBoundingBox"?.5:0,re=J==="objectBoundingBox"?.5:0;D.cx=I.cx!==void 0?j(I.cx):ae,D.cy=I.cy!==void 0?j(I.cy):ae,D.r=I.r!==void 0?j(I.r):re,D.fx=I.fx!==void 0?j(I.fx):D.cx,D.fy=I.fy!==void 0?j(I.fy):D.cy}K[R]=D}}function v(F,O){O=Object.assign({},O);let P={};if(F.hasAttribute("class")){const R=F.getAttribute("class").split(/\s/).filter(Boolean).map(G=>G.trim());for(let G=0;G<R.length;G++)P=Object.assign(P,ne["."+R[G]])}F.hasAttribute("id")&&(P=Object.assign(P,ne["#"+F.getAttribute("id")]));function W(R,G,I){I===void 0&&(I=function(D){return D}),F.hasAttribute(R)&&(O[G]=I(F.getAttribute(R))),P[G]&&(O[G]=I(P[G])),F.style&&F.style[R]!==""&&(O[G]=I(F.style[R]))}function he(R){return Math.max(0,Math.min(1,S(R)))}function pe(R){return Math.max(0,S(R))}return W("fill","fill"),W("fill-opacity","fillOpacity",he),W("fill-rule","fillRule"),W("opacity","opacity",he),W("stroke","stroke"),W("stroke-opacity","strokeOpacity",he),W("stroke-width","strokeWidth",pe),W("stroke-linejoin","strokeLineJoin"),W("stroke-linecap","strokeLineCap"),W("stroke-miterlimit","strokeMiterLimit",pe),W("visibility","visibility"),O}function m(F,O){return F-(O-F)}function p(F,O,P){if(typeof F!="string")throw new TypeError("Invalid input: "+typeof F);const W={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},he=0,pe=1,R=2,G=3;let I=he,J=!0,D="",j="";const ae=[];function re(Fe,C,_){const z=new SyntaxError('Unexpected character "'+Fe+'" at index '+C+".");throw z.partial=_,z}function H(){D!==""&&(j===""?ae.push(Number(D)):ae.push(Number(D)*Math.pow(10,Number(j)))),D="",j=""}let y;const Se=F.length;for(let Fe=0;Fe<Se;Fe++){if(y=F[Fe],Array.isArray(O)&&O.includes(ae.length%P)&&W.FLAGS.test(y)){I=pe,D=y,H();continue}if(I===he){if(W.WHITESPACE.test(y))continue;if(W.DIGIT.test(y)||W.SIGN.test(y)){I=pe,D=y;continue}if(W.POINT.test(y)){I=R,D=y;continue}W.COMMA.test(y)&&(J&&re(y,Fe,ae),J=!0)}if(I===pe){if(W.DIGIT.test(y)){D+=y;continue}if(W.POINT.test(y)){D+=y,I=R;continue}if(W.EXP.test(y)){I=G;continue}W.SIGN.test(y)&&D.length===1&&W.SIGN.test(D[0])&&re(y,Fe,ae)}if(I===R){if(W.DIGIT.test(y)){D+=y;continue}if(W.EXP.test(y)){I=G;continue}W.POINT.test(y)&&D[D.length-1]==="."&&re(y,Fe,ae)}if(I===G){if(W.DIGIT.test(y)){j+=y;continue}if(W.SIGN.test(y)){if(j===""){j+=y;continue}j.length===1&&W.SIGN.test(j)&&re(y,Fe,ae)}}W.WHITESPACE.test(y)?(H(),I=he,J=!1):W.COMMA.test(y)?(H(),I=he,J=!0):W.SIGN.test(y)?(H(),I=pe,D=y):W.POINT.test(y)?(H(),I=R,D=y):re(y,Fe,ae)}return H(),ae}const w=["mm","cm","in","pt","pc","px"],E={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1}
4127,cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function S(F){let O="px";if(typeof F=="string"||F instanceof String)for(let W=0,he=w.length;W<he;W++){const pe=w[W];if(F.endsWith(pe)){O=pe,F=F.substring(0,F.length-pe.length);break}}let P;return O==="px"&&t.defaultUnit!=="px"?P=E.in[t.defaultUnit]/t.defaultDPI:(P=E[O][t.defaultUnit],P<0&&(P=E[O].in*t.defaultDPI)),P*parseFloat(F)}function b(F){if(!(F.hasAttribute("transform")||F.nodeName==="use"&&(F.hasAttribute("x")||F.hasAttribute("y"))))return null;const O=T(F);return X.length>0&&O.premultiply(X[X.length-1]),Ue.copy(O),X.push(O),O}function T(F){const O=new je;if(F.nodeName==="use"&&(F.hasAttribute("x")||F.hasAttribute("y"))){const P=S(F.getAttribute("x")||0),W=S(F.getAttribute("y")||0);O.makeTranslation(P,W)}return F.hasAttribute("transform")&&L(F.getAttribute("transform"),O),O}function L(F,O){const P=ge,W=F.split(")");for(let he=W.length-1;he>=0;he--){const pe=W[he].trim();if(pe==="")continue;const R=pe.indexOf("("),G=pe.length;if(R>0&&R<G){const I=pe.slice(0,R),J=p(pe.slice(R+1));switch(P.identity(),I){case"translate":if(J.length>=1){const D=J[0];let j=0;J.length>=2&&(j=J[1]),P.makeTranslation(D,j)}break;case"rotate":if(J.length>=1){let D=0,j=0,ae=0;D=J[0]*Math.PI/180,J.length>=3&&(j=J[1],ae=J[2]),_e.makeTranslation(-j,-ae),ve.makeRotation(D),Ee.multiplyMatrices(ve,_e),_e.makeTranslation(j,ae),P.multiplyMatrices(_e,Ee)}break;case"scale":if(J.length>=1){const D=J[0];let j=D;J.length>=2&&(j=J[1]),P.makeScale(D,j)}break;case"skewX":J.length===1&&P.set(1,Math.tan(J[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":J.length===1&&P.set(1,0,0,Math.tan(J[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":J.length===6&&P.set(J[0],J[2],J[4],J[1],J[3],J[5],0,0,1);break}O.premultiply(P)}}return O}function x(F,O){function P(R){Je.set(R.x,R.y,1).applyMatrix3(O),R.set(Je.x,Je.y)}function W(R){const G=R.xRadius,I=R.yRadius,J=Math.cos(R.aRotation),D=Math.sin(R.aRotation),j=new V(G*J,G*D,0),ae=new V(-I*D,I*J,0),re=j.applyMatrix3(O),H=ae.applyMatrix3(O),y=ge.set(re.x,H.x,0,re.y,H.y,0,0,0,1),Se=_e.copy(y).invert(),_=ve.copy(Se).transpose().multiply(Se).elements,z=ee(_[0],_[1],_[4]),Z=Math.sqrt(z.rt1),oe=Math.sqrt(z.rt2);if(R.xRadius=1/Z,R.yRadius=1/oe,R.aRotation=Math.atan2(z.sn,z.cs),!((R.aEndAngle-R.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const be=_e.set(Z,0,0,0,oe,0,0,0,1),fe=ve.set(z.cs,z.sn,0,-z.sn,z.cs,0,0,0,1),me=be.multiply(fe).multiply(y),we=He=>{const{x:Re,y:Ce}=new V(Math.cos(He),Math.sin(He),0).applyMatrix3(me);return Math.atan2(Ce,Re)};R.aStartAngle=we(R.aStartAngle),R.aEndAngle=we(R.aEndAngle),A(O)&&(R.aClockwise=!R.aClockwise)}}function he(R){const G=B(O),I=U(O);R.xRadius*=G,R.yRadius*=I;const J=G>Number.EPSILON?Math.atan2(O.elements[1],O.elements[0]):Math.atan2(-O.elements[3],O.elements[4]);R.aRotation+=J,A(O)&&(R.aStartAngle*=-1,R.aEndAngle*=-1,R.aClockwise=!R.aClockwise)}const pe=F.subPaths;for(let R=0,G=pe.length;R<G;R++){const J=pe[R].curves;for(let D=0;D<J.length;D++){const j=J[D];j.isLineCurve?(P(j.v1),P(j.v2)):j.isCubicBezierCurve?(P(j.v0),P(j.v1),P(j.v2),P(j.v3)):j.isQuadraticBezierCurve?(P(j.v0),P(j.v1),P(j.v2)):j.isEllipseCurve&&(We.set(j.aX,j.aY),P(We),j.aX=We.x,j.aY=We.y,k(O)?W(j):he(j))}}}function A(F){const O=F.elements;return O[0]*O[4]-O[1]*O[3]<0}function k(F){const O=F.elements,P=O[0]*O[3]+O[1]*O[4];if(P===0)return!1;const W=B(F),he=U(F);return Math.abs(P/(W*he))>Number.EPSILON}function B(F){const O=F.elements;return Math.sqrt(O[0]*O[0]+O[1]*O[1])}function U(F){const O=F.elements;return Math.sqrt(O[3]*O[3]+O[4]*O[4])}function te(F){const O=F.elements,P=O[0]*O[4]-O[1]*O[3];return Math.sqrt(Math.abs(P))}function ee(F,O,P){let W,he,pe,R,G;const I=F+P,J=F-P,D=Math.sqrt(J*J+4*O*O);return I>0?(W=.5*(I+D),G=1/W,he=F*G*P-O*G*O):I<0?he=.5*(I-D):(W=.5*D,he=-.5*D),J>0?pe=J+D:pe=J-D,Math.abs(pe)>2*Math.abs(O)?(G=-2*O/pe,R=1/Math.sqrt(1+G*G),pe=G*R):Math.abs(O)===0?(pe=1,R=0):(G=-.5*pe/O,pe=1/Math.sqrt(1+G*G),R=G*pe),J>0&&(G=pe,pe=-R,R=G),{rt1:W,rt2:he,cs:pe,sn:R}}const $=[],ne={},K={}
4127,X=[],ge=new je,_e=new je,ve=new je,Ee=new je,We=new de,Je=new V,Ue=new je,ie=new DOMParser().parseFromString(e,"image/svg+xml");return g(ie),n(ie.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:$,gradients:K,xml:ie.documentElement}}static createFillMaterial(e){const t=e.userData.style;if(t.fill===void 0||t.fill==="none")return null;const n=e.color;let r=null;const s=Ph.exec(t.fill);if(s){const o=e.userData.gradients&&e.userData.gradients[s[1]];r=$y(o,e)}const a=new zi({opacity:t.fillOpacity*(t.opacity||1),transparent:!0,side:un,depthWrite:!1});return r!==null?a.map=r:a.color=n,a}static createStrokeMaterial(e){const t=e.userData.style;return t.stroke===void 0||t.stroke==="none"?null:(Ph.test(t.stroke)&&console.warn("THREE.SVGLoader: Gradient strokes are not supported."),new zi({color:new at().setStyle(t.stroke,os),opacity:t.strokeOpacity*(t.opacity||1),transparent:!0,side:un,depthWrite:!1}))}static createShapes(e){return console.warn("SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead."),e.toShapes()}static getStrokeStyle(e,t,n,r,s){return e=e!==void 0?e:1,t=t!==void 0?t:"#000",n=n!==void 0?n:"miter",r=r!==void 0?r:"butt",s=s!==void 0?s:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:r,strokeMiterLimit:s}}static pointsToStroke(e,t,n,r){const s=[],a=[],o=[];if(da.pointsToStrokeWithBuffers(e,t,n,r,s,a,o)===0)return null;const l=new jt;return l.setAttribute("position",new bt(s,3)),l.setAttribute("normal",new bt(a,3)),l.setAttribute("uv",new bt(o,2)),l}static pointsToStrokeWithBuffers(e,t,n,r,s,a,o,l){const c=new de,u=new de,f=new de,h=new de,d=new de,g=new de,v=new de,m=new de,p=new de,w=new de,E=new de,S=new de,b=new de,T=new de,L=new de,x=new de,A=new de;n=n!==void 0?n:12,r=r!==void 0?r:.001,l=l!==void 0?l:0,e=pe(e);const k=e.length;if(k<2)return 0;const B=e[0].equals(e[k-1]);let U,te=e[0],ee;const $=t.strokeWidth/2,ne=1/(k-1);let K=0,X,ge,_e,ve,Ee=!1,We=0,Je=l*3,Ue=l*2;ie(e[0],e[1],c).multiplyScalar($),m.copy(e[0]).sub(c),p.copy(e[0]).add(c),w.copy(m),E.copy(p);for(let R=1;R<k;R++){U=e[R],R===k-1?B?ee=e[1]:ee=void 0:ee=e[R+1];const G=c;if(ie(te,U,G),f.copy(G).multiplyScalar($),S.copy(U).sub(f),b.copy(U).add(f),X=K+ne,ge=!1,ee!==void 0){ie(U,ee,u),f.copy(u).multiplyScalar($),T.copy(U).sub(f),L.copy(U).add(f),_e=!0,f.subVectors(ee,te),G.dot(f)<0&&(_e=!1),R===1&&(Ee=_e),f.subVectors(ee,U),f.normalize();const I=Math.abs(G.dot(f));if(I>Number.EPSILON){const J=$/I;f.multiplyScalar(-J),h.subVectors(U,te),d.copy(h).setLength(J).add(f),x.copy(d).negate();const D=d.length(),j=h.length();h.divideScalar(j),g.subVectors(ee,U);const ae=g.length();if(g.divideScalar(ae),h.dot(x)<j&&g.dot(x)<ae&&(ge=!0),A.copy(d).add(U),x.add(U),ge){const re=_e?p:m,H=(A.x-re.x)*(x.y-re.y)-(A.y-re.y)*(x.x-re.x);(_e&&H<0||!_e&&H>0)&&x.copy(re)}switch(ve=!1,ge?_e?(L.copy(x),b.copy(x)):(T.copy(x),S.copy(x)):O(),t.strokeLineJoin){case"bevel":P(_e,ge,X);break;case"round":W(_e,ge),_e?F(U,S,T,X,0):F(U,L,b,X,1);break;case"miter":case"miter-clip":default:const re=$*t.strokeMiterLimit/D;if(re<1)if(t.strokeLineJoin!=="miter-clip"){P(_e,ge,X);break}else W(_e,ge),_e?(g.subVectors(A,S).multiplyScalar(re).add(S),v.subVectors(A,T).multiplyScalar(re).add(T),q(S,X,0),q(g,X,0),q(U,X,.5),q(U,X,.5),q(g,X,0),q(v,X,0),q(U,X,.5),q(v,X,0),q(T,X,0)):(g.subVectors(A,b).multiplyScalar(re).add(b),v.subVectors(A,L).multiplyScalar(re).add(L),q(b,X,1),q(g,X,1),q(U,X,.5),q(U,X,.5),q(g,X,1),q(v,X,1),q(U,X,.5),q(v,X,1),q(L,X,1));else ge?(_e?(q(p,K,1),q(m,K,0),q(A,X,0),q(p,K,1),q(A,X,0),q(x,X,1)):(q(p,K,1),q(m,K,0),q(A,X,1),q(m,K,0),q(x,X,0),q(A,X,1)),_e?T.copy(A):L.copy(A)):_e?(q(S,X,0),q(A,X,0),q(U,X,.5),q(U,X,.5),q(A,X,0),q(T,X,0)):(q(b,X,1),q(A,X,1),q(U,X,.5),q(U,X,.5),q(A,X,1),q(L,X,1)),ve=!0;break}}else O()}else O();!B&&R===k-1&&he(e[0],w,E,_e,!0,K),K=X,te=U,m.copy(T),p.copy(L)}if(!B)he(U,S,b,_e,!1,X);else if(ge&&s){let R=A,G=x;Ee!==_e&&(R=x,G=A),_e?(ve||Ee)&&(G.toArray(s,0*3),G.toArray(s,3*3),ve&&R.toArray(s,1*3)):(ve||!Ee)&&(G.toArray(s,1*3),G.toArray(s,3*3),ve&&R.toArray(s,0*3))}if(s){const R=[new de,new de,new de],G=l*3;for(let I=G;I<Je;I+=9)R[0].set(s[I],s[I+1]),R[1].set(s[I+3],s[I+4]),R[2].set(s[I+6],s[I+7]),An.area(R)<0&&(s[I+3]=R[0].x,s[I+4]=R[0].y)}return We;function ie(R,G,I){return I.subVectors(G,R),I.set(-I.y,I.x).normalize()}function q(R,G,I){s&&(s[Je]=R.x,s[Je+1]=R.y,s[Je+2]=0,a&&(a[Je]=0,a[Je+1]=0,a[Je+2]=1),Je+=3,o&&(o[Ue]=G,o[Ue+1]=I,Ue+=2)),We+=3}function F(R,G,I,J,D){c.copy(G).sub(R).normalize(),u.copy(I).sub(R).normalize();let j=Math.PI;const ae=c.dot(u);Math.abs(ae)<1&&(j=Math.abs(Math.acos(ae))),j/=n,f.copy(G);for(let re=0,H=n-1;re<H;
4127re++)h.copy(f).rotateAround(R,j),q(f,J,D),q(h,J,D),q(R,J,.5),f.copy(h);q(f,J,D),q(I,J,D),q(R,J,.5)}function O(){q(p,K,1),q(m,K,0),q(S,X,0),q(p,K,1),q(S,X,0),q(b,X,1)}function P(R,G,I){G?R?(q(p,K,1),q(m,K,0),q(S,X,0),q(p,K,1),q(S,X,0),q(x,X,1),q(S,I,0),q(T,I,0),q(x,I,.5)):(q(p,K,1),q(m,K,0),q(b,X,1),q(m,K,0),q(x,X,0),q(b,X,1),q(b,I,1),q(x,I,0),q(L,I,1)):R?(q(S,I,0),q(T,I,0),q(U,I,.5)):(q(b,I,1),q(L,I,0),q(U,I,.5))}function W(R,G){G&&(R?(q(p,K,1),q(m,K,0),q(S,X,0),q(p,K,1),q(S,X,0),q(x,X,1),q(S,K,0),q(U,X,.5),q(x,X,1),q(U,X,.5),q(T,K,0),q(x,X,1)):(q(p,K,1),q(m,K,0),q(b,X,1),q(m,K,0),q(x,X,0),q(b,X,1),q(b,K,1),q(x,X,0),q(U,X,.5),q(U,X,.5),q(x,X,0),q(L,K,1)))}function he(R,G,I,J,D,j){switch(t.strokeLineCap){case"round":D?F(R,I,G,j,.5):F(R,G,I,j,.5);break;case"square":if(D)c.subVectors(G,R),u.set(c.y,-c.x),f.addVectors(c,u).add(R),h.subVectors(u,c).add(R),J?(f.toArray(s,1*3),h.toArray(s,0*3),h.toArray(s,3*3)):(f.toArray(s,1*3),o[3*2+1]===1?h.toArray(s,3*3):f.toArray(s,3*3),h.toArray(s,0*3));else{c.subVectors(I,R),u.set(c.y,-c.x),f.addVectors(c,u).add(R),h.subVectors(u,c).add(R);const ae=s.length;J?(f.toArray(s,ae-1*3),h.toArray(s,ae-2*3),h.toArray(s,ae-4*3)):(h.toArray(s,ae-2*3),f.toArray(s,ae-1*3),h.toArray(s,ae-4*3))}break}}function pe(R){let G=!1;for(let J=1,D=R.length-1;J<D;J++)if(R[J].distanceTo(R[J+1])<r){G=!0;break}if(!G)return R;const I=[];I.push(R[0]);for(let J=1,D=R.length-1;J<D;J++)R[J].distanceTo(R[J+1])>=r&&I.push(R[J]);return I.push(R[R.length-1]),I}}}const Ph=/^\s*url\(\s*(?:["']\s*)?#([^)'"\s]+)(?:\s*["'])?\s*\)\s*$/;function $y(i,e,t=256){if(!i||!Array.isArray(i.stops)||i.stops.length===0)return null;const n=e.userData.transform,r=i.gradientUnits==="objectBoundingBox";let s=null;if(r&&(s=Ky(e,n),s===null))return null;function a(f,h,d){d.set(f,h,1),i.gradientTransform&&d.applyMatrix3(i.gradientTransform),r&&d.set(s.minX+d.x*s.width,s.minY+d.y*s.height,1),n&&d.applyMatrix3(n)}const o=document.createElement("canvas");let l;if(i.type==="linearGradient"){o.width=t,o.height=1;const f=o.getContext("2d"),h=f.createLinearGradient(0,0,t,0);Dh(h,i.stops),f.fillStyle=h,f.fillRect(0,0,t,1);const d=new V,g=new V;a(i.x1,i.y1,d),a(i.x2,i.y2,g);const v=g.x-d.x,m=g.y-d.y,p=v*v+m*m||1e-20,w=v/p,E=m/p,S=-(w*d.x+E*d.y);l=new je().set(w,E,S,0,0,.5,0,0,1)}else{let f=i.cx,h=i.cy,d=i.fx,g=i.fy,v=i.r;if(i.gradientTransform){const x=new V;x.set(f,h,1).applyMatrix3(i.gradientTransform),f=x.x,h=x.y,x.set(d,g,1).applyMatrix3(i.gradientTransform),d=x.x,g=x.y}if(r&&(f=s.minX+f*s.width,h=s.minY+h*s.height,d=s.minX+d*s.width,g=s.minY+g*s.height,v=v*Math.sqrt((s.width*s.width+s.height*s.height)/2)),v<=0)return null;o.width=t,o.height=t;const m=o.getContext("2d"),p=f-v,w=h-v,E=2*v,S=t/E;m.setTransform(S,0,0,S,-p*S,-w*S);const b=m.createRadialGradient(d,g,0,f,h,v);Dh(b,i.stops),m.fillStyle=b,m.fillRect(p,w,E,E);const T=n?n.clone().invert():new je;l=new je().set(1/E,0,-p/E,0,1/E,-w/E,0,0,1).multiply(T)}const c=new Bl(o);
4127c.colorSpace=os,c.flipY=!1,c.matrixAutoUpdate=!1,c.matrix=l;const u=i.spreadMethod==="reflect"?sa:i.spreadMethod==="repeat"?ra:Nn;return c.wrapS=u,c.wrapT=u,c}function Ky(i,e){const t=e?e.clone().invert():null,n=new de,r=new ju;for(const s of i.subPaths)for(const a of s.getPoints())n.copy(a),t&&n.applyMatrix3(t),r.expandByPoint(n);return r.isEmpty()?null:{minX:r.min.x,minY:r.min.y,width:r.max.x-r.min.x,height:r.max.y-r.min.y}}function Dh(i,e){const t=new at;for(const n of e){let r=n.color;if(n.opacity<1){t.setStyle(n.color,os);const s=/rgb\(([^)]+)\)/.exec(t.getStyle(os));s&&(r=`rgba(${s[1]},${n.opacity})`)}i.addColorStop(Math.max(0,Math.min(1,n.offset)),r)}}const sf={gym:["THE GYM","warming up"],work:["THE OFFICE","on the clock"],sleep:["THE DORM","paused / off hours"]},mi=Object.keys(sf),Zy="#1a1a1a",Ci={floor:16053492,bot:0,eye:16777215,hemi:[16777215,15000804,2.2],sun:[16777215,1.15],rooms:{gym:{rug:16777215,wall:15395562},work:{rug:16448250,wall:15000804},sleep:{rug:15790320,wall:14606046}}},Lh=(i,e,t)=>`${i}|${Math.floor(e/t)}`;function Jy(i,e,t,n,r,s){return new V(n+(i%e-(e-1)/2)*r,0,(Math.floor(i/e)-(t-1)/2)*s)}const af=17,of=5.3;function Qy(i,e,t){const n=document.createElement("canvas");n.width=1024,n.height=320;const r=n.getContext("2d");r.fillStyle=t,r.textAlign="center",r.font="bold 150px system-ui, -apple-system, sans-serif",r.fillText(i,512,162),r.globalAlpha=.7,r.font="600 74px system-ui, -apple-system, sans-serif",r.fillText(e,512,262);const s=new Bl(n);
4127s.colorSpace=Jt;const a=new Iu(new Ul({map:s,transparent:!0}));return a.scale.set(af,of,1),a}const eS={reply:["ð¬","replying"],post:["âï¸","posting"],quote:["ð","quoting"],retweet:["ð","reposting"],like:["â¤ï¸","liking"],bookmark:["ð","saving"],follow:["â","following"],unfollow:["â","unfollowing"],"send-dm":["âï¸","DM"],mention:["ð£","mentioning"],search:["ð","scanning"],"check-follow-back":["ð","checking back"]};function tS(i){const[e,t]=eS[i]||["â¡",i],n=document.createElement("canvas");n.width=512,n.height=220;const r=n.getContext("2d");r.fillStyle="#ffffff",r.strokeStyle="rgba(20,22,28,0.18)",r.lineWidth=5,r.beginPath(),r.roundRect(8,8,496,150,60),r.fill(),r.stroke(),r.beginPath(),r.moveTo(226,152),r.lineTo(256,208),r.lineTo(286,152),r.closePath(),r.fillStyle="#ffffff",r.fill(),r.font="72px system-ui, -apple-system, sans-serif",r.textBaseline="middle",r.fillText(e,40,84),r.fillStyle="#15171c",r.font="600 54px system-ui, -apple-system, sans-serif",r.fillText(t,132,86);const s=new Bl(n);
4127return s.colorSpace=Jt,s}const lf=1.5,nS=i=>.78+.3*(1-Math.min(Math.max(i/lf,0),1))**1.5;async function iS(i,e){const t=await new da().loadAsync("/logo.svg"),n=new fr,r=new ln({color:i,roughness:.42,metalness:.05,side:un}),s=new zi({color:e,side:un,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-4}),a=[],o=[];t.paths.forEach((d,g)=>{const v=g>0;da.createShapes(d).forEach(m=>{const p=v?new ql(m):new Wl(m,{depth:860,bevelEnabled:!0,bevelThickness:55,bevelSize:50,bevelSegments:4});p.computeBoundingBox();const w=p.boundingBox.clone();p.center();const E=new Ot(p,v?s:r);E.position.copy(w.getCenter(new V)),E.userData.bb=w,E.name=v?"eye":"body",n.add(E),(v?o:a).push(E)})});const l=Math.max(...a.map(d=>d.userData.bb.max.z));o.forEach(d=>{d.position.z+=l+30-d.userData.bb.max.z});const c=new ni().setFromObject(n).getSize(new V),u=lf/c.y;n.scale.set(u,-u,u);const f=new ni().setFromObject(n);n.position.set(-(f.min.x+f.max.x)/2,-f.min.y,-(f.min.z+f.max.z)/2),n.updateMatrixWorld(!0),n.children.forEach(d=>{d.geometry.applyMatrix4(d.matrixWorld),d.position.set(0,0,0),d.scale.set(1,1,1);const g=d.geometry.attributes.position;for(let v=0;v<g.count;v+=1){const m=nS(g.getY(v));g.setX(v,g.getX(v)*m),g.setZ(v,g.getZ(v)*m)}if(g.needsUpdate=!0,d.geometry.computeBoundingBox(),d.name==="eye"){const v=d.geometry.boundingBox.getCenter(new V);d.geometry.center(),d.position.copy(v)}}),n.scale.set(1,1,1),n.position.set(0,0,0);const h=new fr;return h.add(n),h}function rS({bots:i,doing:e,onHover:t,onSelect:n,selectedId:r}){const s=ke.useRef(null),a=ke.useRef(t),o=ke.useRef(n),l=ke.useRef(i),c=ke.useRef(e),u=ke.useRef(r);a.current=t,o.current=n,u.current=r,l.current=i,c.current=e;const f=i.map(g=>`${g.id}:${g.level}`).join("|"),h=i.map(g=>`${g.id}:${g.state}`).join("|"),d=ke.useRef(0);return ke.useEffect(()=>{d.current+=1},[h]),ke.useEffect(()=>{var nn;const g=s.current;if(!g)return;const v=l.current,m=Math.max(v.length,1),p=(nn=window.matchMedia)==null?void 0:nn.call(window,"(prefers-reduced-motion: reduce)").matches,w=3.6,E=4.4,S=-E/2,b=Math.max(2,Math.ceil(Math.sqrt(m))),T=Math.ceil(m/b),L=b*w+3.5,x=T*E+4,A=3.5,k={};mi.forEach((Ae,Ke)=>{k[Ae]=(Ke-(mi.length-1)/2)*(L+A)});const B=mi.length*L+(mi.length-1)*A,U=new Ny({antialias:!0});U.setPixelRatio(Math.min(devicePixelRatio,2)),U.setSize(g.clientWidth,g.clientHeight),g.appendChild(U.domElement);const te=new wm;te.background=new at(Ci.floor);const ee=new xn(45,g.clientWidth/g.clientHeight,1,900),$=Math.atan(Math.tan(Math.PI*.125)*ee.aspect),ne=Math.max(B*.72/Math.tan($),x*1.25),K=new V(0,3.2,-x*.08);ee.position.set(ne*.04,ne*.46,K.z+ne*.86);const X=new Oy(ee,U.domElement);X.enableDamping=!0,X.target.copy(K),X.maxPolarAngle=Math.PI*.48,X.minDistance=5,X.maxDistance=ne*2.2,te.add(new Pg(...Ci.hemi));const ge=new Ig(...Ci.sun);ge.position.set(-10,18,10),te.add(ge);const _e=new Ot(new Rr(B*8,B*8),new ln({color:Ci.floor,roughness:1}));_e.rotation.x=-Math.PI/2,te.add(_e);const ve={};mi.forEach(Ae=>{ve[Ae]=v.map((Ke,tt)=>Jy(tt,b,T,k[Ae],w,E))});const Ee=3.4,We=.3,Je=[];mi.forEach((Ae,Ke)=>{const tt=Ci.rooms[Ae],ue=k[Ae],ht=new Ot(new Rr(L,x),new ln({color:tt.rug,roughness:1}));ht.rotation.x=-Math.PI/2,ht.position.set(ue,.02,0),te.add(ht);const Ct=new ln({color:tt.wall,roughness:.95}),Vt=new Ot(new Tt(L+We,Ee,We),Ct);Vt.position.set(ue,Ee/2,-x/2),te.add(Vt);const wt=Ke===0?-1:Ke===mi.length-1?1:0;if(wt){const ft=new Ot(new Tt(We,Ee,x),Ct);ft.position.set(ue+wt*L/2,Ee/2,0),te.add(ft)}const Nt=Qy(...sf[Ae],Zy);Nt.position.set(ue,Ee+3,-x/2),te.add(Nt),Je.push(Nt)});const Ue=(Ae,Ke,tt,ue)=>{const ht=new Nm(Ae,Ke,tt.length||1),Ct=new pt,Vt=new ti,wt=new V(1,1,1);tt.forEach((Nt,ft)=>{Ct.compose(new V(Nt.x,ue,Nt.z),Vt,wt),ht.setMatrixAt(ft,Ct)}),ht.count=tt.length,ht.instanceMatrix.needsUpdate=!0,te.add(ht)},ie=(Ae,Ke,tt)=>Ae.map(ue=>new V(ue.x+Ke,0,ue.z+tt)),q=new ln({color:13351060,roughness:.85}),F=new ln({color:9146265,roughness:.5,metalness:.4}),O=new ln({color:16185339,roughness:.95}),P=new ln({color:9414356,roughness:.95}),W=new ln({color:1778483,emissive:5082623,emissiveIntensity:1.1,roughness:.35}),he=new ln({color:16773324,emissive:16764794,emissiveIntensity:1.4,roughness:.6}),pe=new ln({color:7314794,roughness:.9}),R=new ln({color:12154202,roughness:.9}),G=new ln({color:12597547,roughness:.8}),I=ie(ve.gym,0,1.4);
4127Ue(new Tt(.12,.66,.44),F,[...ie(I,-.84,0),...ie(I,.84,0)],.33),Ue(new Tt(1.8,.08,.44),F,I,.62),Ue(new Tt(.34,.07,.07),F,[...ie(I,-.42,0),...ie(I,.42,0)],.72),Ue(new Tt(.11,.22,.22),G,[...ie(I,-.63,0),...ie(I,-.21,0),...ie(I,.21,0),...ie(I,.63,0)],.72),Ue(new vr(.07,.07,.26,10),W,ie(ve.gym,.88,.55),.13);const J=ie(ve.work,0,1.32);Ue(new Tt(1.9,.08,.95),q,J,.46),Ue(new Tt(.09,.46,.85),F,[...ie(J,-.88,0),...ie(J,.88,0)],.23),Ue(new Tt(.6,.035,.42),F,ie(J,-.1,-.14),.52),Ue(new Tt(.6,.3,.035),W,ie(J,-.1,.09),.67),Ue(new vr(.08,.07,.18,10),R,ie(J,.72,.12),.59);const D=ve.sleep;Ue(new Tt(.14,.44,.14),q,[...ie(D,-.68,-.92),...ie(D,.68,-.92),...ie(D,-.68,.92),...ie(D,.68,.92)],.22),Ue(new Tt(1.6,.22,2.14),q,D,.55),Ue(new Tt(1.5,.26,2),O,D,.79),Ue(new Tt(1.64,1,.14),q,ie(D,0,-1.07),.95),Ue(new Tt(1.64,.5,.14),q,ie(D,0,1.07),.7),Ue(new Tt(1.15,.18,.44),O,ie(D,0,-.7),1.01),Ue(new Tt(1.2,.16,1.2),P,ie(D,0,.45),1);const j=new Tt(1,1,1);Ue(new Tt(.46,.55,.46),q,ie(D,1.3,-.85),.27),Ue(new Tt(.2,.26,.2),he,ie(D,1.3,-.85),.68);const ae=mi.flatMap(Ae=>[-1,1].map(Ke=>new V(k[Ae]+Ke*(L/2-1.1),0,-x/2+1.1)));Ue(new vr(.34,.28,.55,12),R,ae,.27),Ue(new kl(.55,1.5,8),pe,ae,1.25);const re=new Ot(new Xl(.5,.62,28),new zi({color:3108845,transparent:!0,opacity:.85}));re.rotation.x=-Math.PI/2,re.visible=!1,te.add(re);const H=new zl(.42,16),y=new zi({color:0,transparent:!0,opacity:.16,depthWrite:!1}),Se={},Fe=Ae=>(Se[Ae]=Se[Ae]||tS(Ae),Se[Ae]);let C=0,_=!1;const z=[],Z=new Fg,oe=Ae=>ve[Ae]?Ae:"work",Me=(Ae,Ke,tt)=>{const ue=ve[Ke][Ae].clone();return Ke==="sleep"&&(ue.z+=.75*tt-.55),ue};iS(Ci.bot,Ci.eye).then(Ae=>{_||v.forEach((Ke,tt)=>{const ue=oe(Ke.state),ht=Ae.clone(!0),Ct=.85+(Ke.level||1)/100*.55,Vt=Me(tt,ue,Ct),wt=new Ot(j,P);wt.scale.set(1.55,.86*Ct,1.35),wt.position.set(ve.sleep[tt].x,.92+.43*Ct,ve.sleep[tt].z+.35),wt.visible=ue==="sleep",te.add(wt),ht.position.copy(Vt),ht.scale.setScalar(Ct),ht.userData.bot=Ke,te.add(ht);const Nt=new Ot(H,y);Nt.rotation.x=-Math.PI/2,Nt.position.set(Vt.x,.04,Vt.z),te.add(Nt);const ft=[];ht.traverse(Ir=>{Ir.name==="eye"&&ft.push(Ir)});const $t=new Iu(new Ul({transparent:!0,depthTest:!1}));$t.visible=!1,$t.renderOrder=2,te.add($t);const Hi=ve.work[tt].z+S;z.push({g:ht,shadow:Nt,eyes:ft,bot:Ke,home:Vt,bubble:$t,size:Ct,duvet:wt,i:tt,st:ue,room:k[ue],laneZ:Hi,laneKey:Lh(ue,tt,b),held:[],doingKey:null,popAt:-99,path:[],away:!1,phase:Math.random()*Math.PI*2,speed:.9+Math.random()*.5,strollAt:4+Math.random()*14})})}).catch(Ae=>console.warn("[BotWorld] logo failed to load",Ae));const be=new Og,fe=new de;let me=!1;const we=Ae=>{const Ke=U.domElement.getBoundingClientRect();fe.set((Ae.clientX-Ke.left)/Ke.width*2-1,-((Ae.clientY-Ke.top)/Ke.height)*2+1),me=!0},He=()=>{var Ae;me=!1,(Ae=a.current)==null||Ae.call(a,null)};let Re=null;const Ce=Ae=>{Re=[Ae.clientX,Ae.clientY]},Xe=Ae=>{if(!Re||!o.current)return;const Ke=Math.hypot(Ae.clientX-Re[0],Ae.clientY-Re[1]);Re=null,!(Ke>5)&&(we(Ae),o.current($e()||null))};U.domElement.addEventListener("pointermove",we),U.domElement.addEventListener("pointerleave",He),U.domElement.addEventListener("pointerdown",Ce),U.domElement.addEventListener("pointerup",Xe);function $e(){var Ke;be.setFromCamera(fe,ee);const Ae=be.intersectObjects(z.map(tt=>tt.g),!0)[0];for(let tt=Ae==null?void 0:Ae.object;tt;tt=tt.parent)if((Ke=tt.userData)!=null&&Ke.bot)return tt.userData.bot;return null}let et=null;function Y(){if(!me||!a.current)return;const Ae=$e();Ae!==et&&(et=Ae,a.current(Ae))}const Te=new V;let xe=0;const Pe=new Set,De=Ae=>{Ae.held.forEach(Ke=>Pe.delete(Ke)),Ae.held=[]},ye=(Ae,Ke)=>{De(Ae),Ae.held=Ke,Ke.forEach(tt=>Pe.add(tt))};function Ve(Ae,Ke){const tt=oe(Ke.state);Ae.bot=Ke,Ae.st=tt,Ae.room=k[tt],Ae.home=Me(Ae.i,tt,Ae.size);const ue=Lh(tt,Ae.i,b);ye(Ae,[Ae.laneKey,ue]),Ae.laneKey=ue,Ae.path=[new V(Ae.g.position.x,0,Ae.laneZ),new V(Ae.home.x,0,Ae.laneZ),Ae.home.clone()],Ae.away=!1,Ae.strollAt=6+Math.random()*14}let ze=d.current;function Et(){var tt;C=requestAnimationFrame(Et);const Ae=Math.min(Z.getDelta(),.05),Ke=Z.elapsedTime;if(ze!==d.current&&z.length){ze=d.current;const ue=new Map(l.current.map(ht=>[ht.id,ht]));for(const ht of z){const Ct=ue.get(ht.bot.id);Ct&&(oe(Ct.state)!==ht.st?Ve(ht,Ct):ht.bot=Ct)}}for(const ue of Je){const ht=Math.max(1,ee.position.distanceTo(ue.position)/ne);ue.scale.set(af*ht,of*ht,1)}re.visible=!1;for(const ue of z){if(!p&&ue.st!=="sleep"&&ue.path.length===0&&(ue.strollAt-=Ae,ue.strollAt<=0))if(ue.away)ue.path=[new V(ue.home.x,0,ue.laneZ),ue.home.clone()],ue.away=!1,ue.strollAt=8+Math.random()*20;else if(Pe.has(ue.laneKey))ue.strollAt=2+Math.random()*4;
4127else{const ft=L/2-2.2,$t=ue.room+(Math.random()*2-1)*ft;ye(ue,[ue.laneKey]),ue.path=[new V(ue.home.x,0,ue.laneZ),new V($t,0,ue.laneZ)],ue.away=!0,ue.strollAt=6+Math.random()*14}const ht=ue.path[0]||ue.home;Te.subVectors(ht,ue.g.position),Te.y=0;const Ct=Te.length(),Vt=Ct>.06&&!p;if(!Vt&&ue.path.length&&(ue.path.shift(),!ue.path.length&&!ue.away&&De(ue)),ue.duvet.visible=ue.st==="sleep"&&!ue.path.length,Vt){Te.normalize(),ue.g.position.addScaledVector(Te,Math.min(Ct,2.1*ue.speed*Ae)),ue.g.rotation.set(0,Math.atan2(Te.x,Te.z),0);const ft=Math.abs(Math.sin(Ke*7*ue.speed+ue.phase));ue.g.position.y=ft*.22,ue.g.rotation.z=Math.sin(Ke*7*ue.speed+ue.phase)*.1,ue.g.scale.set(ue.size,ue.size*(1-ft*.12),ue.size),ue.eyes.forEach($t=>{$t.scale.y=1}),ue.shadow.scale.setScalar(ue.size*(1-ft*.35))}else if(ue.away)ue.g.rotation.set(0,0,0),ue.g.position.y=Math.abs(Math.sin(Ke*1.6+ue.phase))*.04,ue.g.scale.setScalar(ue.size),ue.eyes.forEach(ft=>{ft.scale.y=1}),ue.shadow.scale.setScalar(ue.size);else if(ue.st==="sleep")ue.g.rotation.set(-Math.PI/2.15,0,0),ue.g.position.y=.92+.5*ue.size+Math.sin(Ke*1.1+ue.phase)*.02,ue.g.scale.setScalar(ue.size),ue.eyes.forEach(ft=>{ft.scale.y=.07}),ue.shadow.scale.setScalar(0);
4127else if(ue.st==="gym"){const ft=(Math.sin(Ke*2.4+ue.phase)+1)/2;ue.g.rotation.set(.05,0,0),ue.g.position.y=0,ue.g.scale.set(ue.size*(1+ft*.07),ue.size*(1-ft*.24),ue.size*(1+ft*.07)),ue.eyes.forEach($t=>{$t.scale.y=1}),ue.shadow.scale.setScalar(ue.size)}else ue.g.rotation.set(.14,0,0),ue.g.position.y=Math.abs(Math.sin(Ke*5+ue.phase))*.03,ue.g.scale.setScalar(ue.size),ue.eyes.forEach(ft=>{ft.scale.y=1}),ue.shadow.scale.setScalar(ue.size);ue.shadow.position.set(ue.g.position.x,.04,ue.g.position.z),ue.bot.id===u.current&&(re.visible=!0,re.scale.setScalar(ue.size*1.25),re.position.set(ue.g.position.x,.05,ue.g.position.z));const wt=(tt=c.current)==null?void 0:tt[ue.bot.id];wt&&wt.key!==ue.doingKey&&(ue.doingKey=wt.key,ue.popAt=Ke,ue.bubble.material.map=Fe(wt.type),ue.bubble.material.needsUpdate=!0);const Nt=Ke-ue.popAt;if(ue.bubble.visible=Nt<4,ue.bubble.visible){const ft=Math.min(1,Nt*7),$t=Math.min(1,(4-Nt)*3);ue.bubble.material.opacity=$t,ue.bubble.scale.set(2.1*ft,.9*ft,1),ue.bubble.position.set(ue.g.position.x,1.6+.9*ue.size+Math.sin(Ke*2+ue.phase)*.05,ue.g.position.z-(ue.st==="sleep"&&!Vt?1.1:0))}}xe-=Ae,xe<=0&&(Y(),xe=.1),X.update(),U.render(te,ee)}C=requestAnimationFrame(Et);const mt=()=>{g.clientWidth&&(ee.aspect=g.clientWidth/g.clientHeight,ee.updateProjectionMatrix(),U.setSize(g.clientWidth,g.clientHeight))},tn=new ResizeObserver(mt);return tn.observe(g),()=>{_=!0,cancelAnimationFrame(C),tn.disconnect(),U.domElement.removeEventListener("pointerdown",Ce),U.domElement.removeEventListener("pointerup",Xe),U.domElement.removeEventListener("pointermove",we),U.domElement.removeEventListener("pointerleave",He),X.dispose(),te.traverse(Ae=>{Ae.geometry&&Ae.geometry.dispose(),[].concat(Ae.material||[]).forEach(Ke=>{var tt;(tt=Ke.map)==null||tt.dispose(),Ke.dispose()})}),U.dispose(),g.removeChild(U.domElement)}},[f]),N.jsx("div",{ref:s,style:{width:"100%",height:"100%",minHeight:320,cursor:"grab"}})}const sS=[{name:"dms",type:"area",color:"blue.6",label:"DMs"},{name:"repliesOut",type:"area",color:"indigo.6",label:"Replies out"},{name:"replies",type:"area",color:"green.6",label:"Replies in"},{name:"followBacks",type:"area",color:"lime.5",label:"Followed back"},{name:"likes",type:"area",color:"pink.5",label:"Likes"},{name:"retweets",type:"area",color:"cyan.6",label:"Retweets"},{name:"posts",type:"area",color:"violet.6",label:"Posts"},{name:"follows",type:"area",color:"teal.6",label:"Follows"},{name:"errors",type:"area",color:"red.6",label:"Errors"},{name:"projected",type:"line",color:"orange.6",label:"Projected sends",strokeDasharray:"4 4"}],aS=14,oS="done,failed,skipped,expired",cf=200,hf=i=>({status:oS,limit:cf,before:i||Date.now()}),uf={failed:"red",skipped:"yellow",expired:"yellow"},lS={"account-reauth":"red","account-cooldown":"yellow","campaign-paused":"yellow","campaign-empty":"yellow","thread-escalated":"yellow","style-drift":"yellow","reply-received":"green","mention-received":"green","campaign-complete":"blue"},ff=new Set(["red","yellow"]),cS=[{value:"all",label:"Everything"},{value:"problems",label:"Needs a look"},{value:"system",label:"System events"},{value:"follow",label:"Follows"},{value:"check-follow-back",label:"Follow-backs"},{value:"unfollow",label:"Unfollows"},{value:"send-dm",label:"DMs"},{value:"reply",label:"Replies"},{value:"like",label:"Likes"},{value:"retweet",label:"Retweets"},{value:"post",label:"Posts"}],hS=new Set(["post","thread","quote"]);function uS(i,e){return e==="all"?!0:e==="problems"?ff.has(i.tone):e==="system"?!!i.system:e==="post"?hS.has(i.type):i.type===e}function df(i){return typeof i=="number"?i:((i==null?void 0:i._seconds)||(i==null?void 0:i.seconds)||0)*1e3}function Ih(i,e,t){var a;const n=(a=i.dailyCaps)==null?void 0:a[e];if(typeof n!="number"||n<=0)return 0;const r=df(i.warmingStartedAt);let s=1;if(r){const o=(t-r)/864e5,l=Math.max(1,i.warmingDays||14);s=o>=l?1:Math.max(.2,Math.min(1,.2+.8*(o/l)))}return Math.max(1,Math.floor(n*s))}const Nh=i=>Date.parse(`${i}T12:00:00Z`),fS=i=>new Date(i).toISOString().slice(0,10);function dS(i,e,t=Date.now()){if(!(i!=null&&i.length))return{rows:[],use:1,hasHistory:!1};const n=e.filter(f=>f.status==="active"),r=f=>n.reduce((h,d)=>h+Ih(d,"dms",f)+Ih(d,"replies",f),0),s=i.reduce((f,h)=>f+(h.sent||0),0),a=i.reduce((f,h)=>f+r(Nh(h.day)),0),o=s>0&&a>0,l=o?Math.min(1,s/a):1,c=i.map(f=>({...f}));c[c.length-1].projected=c[c.length-1].sent||0;const u=Nh(i[i.length-1].day)||t;for(let f=1;f<=aS;f++){const h=u+f*864e5;c.push({day:fS(h),projected:Math.round(r(h)*l)}
4127)}return{rows:c,use:l,hasHistory:o}}const Uh={start:9,end:18};function pS(i){if(!i)return new Date().getHours();try{return Number(new Intl.DateTimeFormat("en-US",{hour:"2-digit",hourCycle:"h23",timeZone:i}).format(new Date))}catch{return new Date().getHours()}}function mS(i){var r,s,a;if(i.status!=="active"||i.cooldownUntil&&i.cooldownUntil>Date.now())return"sleep";if(pf(i))return"gym";const e=pS((r=i.workingHours)==null?void 0:r.tz),t=((s=i.workingHours)==null?void 0:s.startHour)??Uh.start,n=((a=i.workingHours)==null?void 0:a.endHour)??Uh.end;return e<t||e>=n?"sleep":"work"}function pf(i){const e=df(i.warmingStartedAt);return e?(Date.now()-e)/864e5<(i.warmingDays||14):!1}function gS(i){const e=((i==null?void 0:i.totalActions)||0)+9*((i==null?void 0:i.replies)||0);return Math.max(1,Math.min(100,Math.round(Math.log2(e+1)*7)))}const xS=[["gym","in the gym","Still inside the 14-day warm-up ramp","orange"],["work","in the office","Active and inside working hours","blue"],["sleep","in the dorm","Paused, cooling down, or outside working hours","gray"]],Hs={gym:["in the gym","orange"],work:["in the office","blue"],sleep:["in the dorm","gray"]},_S={post:"posted",thread:"posted a thread",reply:"replied to",quote:"quoted",like:"liked",retweet:"retweeted",bookmark:"bookmarked",follow:"followed",unfollow:"unfollowed","check-follow-back":"checked follow-back on","send-dm":"DMed",search:"searched"},vS={failed:"couldn't",skipped:"skipped",expired:"never ran"};function yS(i){var s;const e=i.payload||{},t=e.recipientHandle||e.handle||e.authorHandle||String(e.target||"").replace(/^@/,""),n=vS[i.status];if(n){const a=String(i.type||"act").replace(/-/g," ");return t?`${n} ${a} @${t}`:`${n} ${a}`}if(i.type==="check-follow-back"&&((s=i.result)!=null&&s.followsBack)&&t)return`got followed back by @${t} ð`;const r=_S[i.type]||i.type||"acted";return t?`${r} @${t}`:e.query?`${r} ${e.query}`:r}function mf(i){if(!i)return"â";const e=Math.max(0,Math.round((Date.now()-i)/1e3));return e<60?`${e}s ago`:e<3600?`${Math.round(e/60)}m ago`:e<86400?`${Math.round(e/3600)}h ago`:`${Math.round(e/86400)}d ago`}function SS(){const[i,e]=ke.useState(null),[t,n]=ke.useState(null),{data:r}=Xr({queryKey:["accounts"],queryFn:cn.listAccounts}),s=(r==null?void 0:r.accounts)||[],{data:a}=Xr({queryKey:["floor-pool"],queryFn:()=>cn.analyticsPool("30d"),staleTime:5*6e4}),o=ke.useMemo(()=>{const v={};for(const m of(a==null?void 0:a.accounts)||[])v[m.id]=m;return v},[a]),{data:l}=Xr({queryKey:["floor-actions"],queryFn:()=>cn.listActions(hf()),refetchInterval:1e4}),{data:c}=Xr({queryKey:["floor-overview"],queryFn:()=>cn.analyticsOverview("7d"),staleTime:5*6e4}),u=ke.useMemo(()=>{const v={},m=Date.now()-12e4;for(const p of(l==null?void 0:l.actions)||[]){const w=p.executedAt||p.dispatchedAt||0;p.status==="done"&&p.accountId&&w>m&&!v[p.accountId]&&(v[p.accountId]={key:p.id,type:p.type})}return v},[l]),f=ke.useMemo(()=>s.map(v=>({id:v.id,handle:v.handle,state:mS(v),warming:pf(v),level:gS(o[v.id])})),[s,o]),h=ke.useMemo(()=>dS(c==null?void 0:c.series,s),[c,s]),d=ke.useMemo(()=>f.reduce((v,m)=>(v[m.state]=(v[m.state]||0)+1,m.warming&&(v.warming=(v.warming||0)+1),v),{}),[f]),g=ke.useMemo(()=>{if(!t)return null;const v=s.find(p=>p.id===t.id)||null,m=((l==null?void 0:l.actions)||[]).filter(p=>p.accountId===t.id).slice(0,8);return{bot:t,account:v,stat:o[t.id],history:m}},[t,s,l,o]);return N.jsxs(hn,{gap:8,style:{height:"100%",minHeight:0},children:[N.jsxs(xo,{withBorder:!0,p:"xs",radius:"md",style:{flex:"0 0 auto"},children:[N.jsxs(ut,{justify:"space-between",mb:2,children:[N.jsx(Qe,{size:"xs",fw:600,children:"Activity · last 7 days, next 14 projected"}),N.jsx(Qe,{size:"xs",c:"dimmed",children:c!=null&&c.cached?"cached · hourly":"live"})]}),N.jsx(Ml,{h:112,data:h.rows,dataKey:"day",withDots:!1,withYAxis:!1,gridAxis:"none",connectNulls:!1,series:sS,areaProps:{stackId:"actual"},tooltipProps:{wrapperStyle:{zIndex:3}}})]}),N.jsxs(xo,{withBorder:!0,p:0,radius:"md",style:{flex:1,minHeight:0,overflow:"hidden",position:"relative"},children:[N.jsx(rS,{bots:f,doing:u,onHover:e,onSelect:n,selectedId:(t==null?void 0:t.id)||null}),N.jsxs(ut,{gap:6,wrap:"wrap",style:{position:"absolute",top:8,left:8,zIndex:2,pointerEvents:"none"},children:[xS.map(([v,m,p,w])=>N.jsxs(En,{color:w,variant:"light",title:p,style:{pointerEvents:"auto"},children:[d[v]||0," ",m]},v)),(i==null?void 0:i.handle)&&N.jsxs(En,{variant:"filled",color:"dark",children:["@",i.handle," · Lv ",i.level]})]}),g?N.jsx(bS,{...g,onClose:()=>n(null)}):N.jsx(MS,{actions:l==null?void 0:l.actions,accounts:s})]})]})}function MS({actions:i,accounts:e}){const[t,n]=ke.useState(!1),[r,s]=ke.useState(!1),[a,o]=ke.useState("all"),[l,c]=ke.useState(""),u=ke.useRef(null),f=ke.useMemo(()=>Object.fromEntries((e||[]).map(b=>[b.id,b.handle])),[e]),{data:h}=Xr({queryKey:["notifications"],queryFn:()=>cn.listNotifications(),refetchInterval:3e4}),d=Gd({queryKey:["floor-actions-older"],enabled:r,initialPageParam:null,queryFn:({pageParam:b})=>cn.listActions(hf(b)),getNextPageParam:b=>{const T=(b==null?void 0:b.actions)||[];if(T.length<cf)return;const L=T.map(x=>x.scheduledFor).filter(x=>Number.isFinite(x)&&x>0);return L.length?Math.min(...L):void 0},staleTime:1/0}),g=ke.useMemo(()=>{var L;const b=new Map;for(const x of i||[])b.set(x.id,x);for(const x of((L=d.data)==null?void 0:L.pages)||[])for(const A of(x==null?void 0:x.actions)||[])b.has(A.id)||b.set(A.id,A);const T=[...b.values()].map(x=>{var A,k;return{id:x.id,at:x.executedAt||x.dispatchedAt||x.scheduledFor||0,who:f[x.accountId]||"bot",type:x.type,text:yS(x),note:x.status==="failed"?x.error||((A=x.result)==null?void 0:A.reason)||"failed":x.status==="skipped"||x.status==="expired"?((k=x.result)==null?void 0:k.reason)||x.error||x.status:"",tone:uf[x.status]||null}});for(const x of(h==null?void 0:h.items)||[])T.push({id:`n:${x.id}`,at:x.ts||0,who:null,type:x.kind,system:!0,text:x.title,note:x.body||"",tone:lS[x.kind]||"blue"});for(const x of T)x.hay=`${x.who||""} ${x.text} ${x.note} ${x.type||""}`.toLowerCase();
4127return T.sort((x,A)=>A.at-x.at)},[i,d.data,h,f]),v=ke.useMemo(()=>g.filter(b=>ff.has(b.tone)),[g]),m=l.trim().toLowerCase().replace(/^@/,""),p=ke.useMemo(()=>g.filter(b=>uS(b,a)&&(!m||b.hay.includes(m))),[g,a,m]),w=!r||d.hasNextPage,E=()=>{if(!r)return s(!0);d.hasNextPage&&!d.isFetchingNextPage&&d.fetchNextPage()},S=()=>{const b=u.current;!b||b.scrollHeight-b.scrollTop-b.clientHeight>60||E()};return N.jsxs(es,{radius:"md",p:0,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{position:"absolute",top:12,right:12,width:340,zIndex:1,maxHeight:"calc(100% - 24px)",display:"flex",flexDirection:"column",overflow:"hidden",opacity:t?1:.18,transition:"opacity 140ms ease",background:t?"var(--mantine-color-body)":"color-mix(in srgb, var(--mantine-color-body) 55%, transparent)",backdropFilter:t?"blur(8px)":"none",border:"1px solid var(--mantine-color-default-border)",WebkitMaskImage:t?"none":"linear-gradient(to bottom, #000 22%, transparent 88%)",maskImage:t?"none":"linear-gradient(to bottom, #000 22%, transparent 88%)"},children:[N.jsxs(ut,{justify:"space-between",gap:6,wrap:"nowrap",px:10,py:6,children:[N.jsxs(ut,{gap:6,wrap:"nowrap",children:[N.jsx("div",{style:{width:6,height:6,borderRadius:6,background:"var(--mantine-color-green-6)"}}),N.jsx(Qe,{size:"xs",fw:600,children:"Live activity"})]}),N.jsxs(ut,{gap:6,wrap:"nowrap",children:[v.length>0&&N.jsxs(En,{size:"xs",variant:a==="problems"?"filled":"light",color:"red",style:{cursor:"pointer"},onClick:()=>o(b=>b==="problems"?"all":"problems"),children:[v.length," need a look"]}),N.jsx(Qe,{size:"xs",c:"dimmed",children:p.length})]})]}),N.jsxs(ut,{gap:6,wrap:"nowrap",px:8,pb:6,children:[N.jsx(Vf,{size:"xs",flex:1,placeholder:"Search handle, text, errorâ¦",value:l,onChange:b=>c(b.currentTarget.value),leftSection:N.jsx(Gf,{size:12}),rightSection:l?N.jsx(gn,{size:"xs",variant:"subtle",color:"gray",onClick:()=>c(""),"aria-label":"Clear",children:N.jsx(ls,{size:12})}):null}),N.jsx(_d,{size:"xs",w:116,data:cS,value:a,onChange:b=>o(b||"all"),allowDeselect:!1,comboboxProps:{withinPortal:!0,zIndex:400}})]}),N.jsx(Vh,{}),N.jsxs(ga.Autosize,{mah:t?420:260,type:"hover",viewportRef:u,onScrollPositionChange:S,children:[p.length===0?N.jsx(Qe,{size:"xs",c:"dimmed",px:10,py:6,children:g.length===0?"Nothing has happened yet.":a==="problems"&&!m?"Nothing went wrong.":`No match in the ${g.length} loaded.`}):p.map(b=>N.jsxs("div",{style:{padding:"3px 10px",borderLeft:`2px solid ${b.tone?`var(--mantine-color-${b.tone}-6)`:"transparent"}`},children:[N.jsxs(ut,{justify:"space-between",gap:6,wrap:"nowrap",align:"flex-start",children:[N.jsxs(Qe,{size:"xs",style:{minWidth:0},lineClamp:2,children:[b.who&&N.jsxs(Qe,{span:!0,size:"xs",fw:600,children:["@",b.who," "]}),N.jsx(Qe,{span:!0,size:"xs",c:b.who?"dimmed":void 0,fw:b.who?400:600,children:b.text})]}),N.jsx(Qe,{size:"xs",c:"dimmed",style:{whiteSpace:"nowrap"},children:mf(b.at)})]}),b.note&&N.jsx(Qe,{size:"xs",c:b.tone==="red"?"red":"dimmed",lineClamp:2,title:b.note,children:b.note})]},b.id)),N.jsx(Qe,{size:"xs",c:"dimmed",px:10,py:6,ta:"center",onClick:w?E:void 0,style:{cursor:w?"pointer":"default"},children:d.isFetching?"loading olderâ¦":w?"load older":"thatâs everything"})]})]})}function bS({bot:i,account:e,stat:t,history:n,onClose:r}){const s=[["Actions (30d)",(t==null?void 0:t.totalActions)??0],["Replies earned",(t==null?void 0:t.replies)??0],["Sent",(t==null?void 0:t.sent)??0],["Likes",(t==null?void 0:t.likes)??0],["Follows",(t==null?void 0:t.follows)??0],["Errors",(t==null?void 0:t.errors)??0]];return N.jsxs(es,{withBorder:!0,shadow:"md",radius:"md",p:0,style:{position:"absolute",top:12,right:12,width:320,maxHeight:"calc(100% - 24px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[N.jsxs("div",{style:{position:"relative"},children:[N.jsx("div",{style:{height:72,background:e!=null&&e.banner?`center/cover no-repeat url(${e.banner})`:"linear-gradient(120deg,#2f6fed,#7048e8)"}}),N.jsx(gn,{variant:"filled",color:"dark",radius:"xl",size:"sm",onClick:r,"aria-label":"Close",style:{position:"absolute",top:6,right:6,opacity:.75},children:N.jsx(ls,{size:14})}),N.jsx(kf,{src:(e==null?void 0:e.avatar)||void 0,radius:"xl",size:56,style:{position:"absolute",left:12,bottom:-22,border:"3px solid var(--mantine-color-body)"},children:(i.handle||"?").slice(0,1).toUpperCase()})]}),N.jsxs("div",{style:{padding:12,paddingTop:26,display:"flex",flexDirection:"column",minHeight:0},children:[(e==null?void 0:e.displayName)&&N.jsx(Qe,{fw:600,size:"sm",truncate:!0,children:e.displayName}),N.jsxs(ut,{gap:6,wrap:"nowrap",mb:4,children:[N.jsxs(Qe,{size:"sm",c:"dimmed",truncate:!0,children:["@",i.handle]}),i.handle&&N.jsx(Qs,{href:`https://x.com/${i.handle}`,target:"_blank",rel:"noreferrer",c:"dimmed",children:N.jsx(gd,{size:14})})]}),(e==null?void 0:e.description)&&N.jsx(Qe,{size:"xs",c:"dimmed",lineClamp:2,mb:6,children:e.description}),N.jsxs(ut,{gap:6,mb:6,children:[N.jsx(En,{size:"sm",variant:"light",color:(Hs[i.state]||Hs.sleep)[1],children:(Hs[i.state]||Hs.sleep)[0]}),i.warming&&N.jsx(En,{size:"sm",variant:"light",color:"orange",children:"warming"}),e&&N.jsxs(En,{size:"sm",variant:"light",color:"teal",children:["health ",e.healthScore??100]}),(e==null?void 0:e.status)&&e.status!=="active"&&N.jsx(En,{size:"sm",variant:"light",color:"orange",children:e.status})]}),N.jsxs(Qe,{size:"xs",c:"dimmed",children:["Level ",i.level," / 100"]}
4127),N.jsx(Hf,{value:i.level,size:"sm",radius:"xl",mb:"xs",color:i.warming?"orange":"blue"}),N.jsx(xd,{cols:2,spacing:4,verticalSpacing:2,children:s.map(([a,o])=>N.jsxs(ut,{justify:"space-between",gap:4,wrap:"nowrap",children:[N.jsx(Qe,{size:"xs",c:"dimmed",truncate:!0,children:a}),N.jsx(Qe,{size:"xs",fw:600,children:o})]},a))}),N.jsx(Vh,{my:"xs",label:"Recent actions",labelPosition:"left"}),N.jsx(ga.Autosize,{mah:180,children:n.length===0?N.jsx(Qe,{size:"xs",c:"dimmed",children:"Nothing completed in the last batch."}):n.map(a=>{var o;return N.jsxs(ut,{justify:"space-between",gap:6,wrap:"nowrap",py:2,children:[N.jsx(Qe,{size:"xs",truncate:!0,c:uf[a.status]||void 0,title:a.error||((o=a.result)==null?void 0:o.reason)||"",children:a.type}),N.jsx(Qe,{size:"xs",c:"dimmed",style:{whiteSpace:"nowrap"},children:mf(a.executedAt||a.dispatchedAt)})]},a.id)})})]})]})}const ES=new RegExp("(\\[[^\\]\\n]+\\]\\((?:https?:\\/\\/|\\/(?!\\/))[^\\s)]*\\)|`[^`]+`|\\*\\*[^*]+\\*\\*|\\*[^*\\n]+\\*|_[^_\\n]+_|https?:\\/\\/[^\\s<>()[\\]\"']+|(?<![\\w@/])@[A-Za-z0-9_]{2,15}\\b)","g"),TS=/^\[([^\]\n]+)\]\(((?:https?:\/\/|\/(?!\/))[^\s)]*)\)$/,wS=/^https?:\/\/[^\s<>()[\]"']+$/,AS=/^@([A-Za-z0-9_]{2,15})$/,RS=i=>i.replace(/[*`_]/g,"");function CS(i){return String(i).split(ES).filter(Boolean).flatMap(e=>{var r;if(e.startsWith("**")&&e.endsWith("**"))return{t:"b",v:e.slice(2,-2)};if(e.startsWith("`")&&e.endsWith("`"))return{t:"code",v:e.slice(1,-1)};const t=e.match(TS);if(t)return{t:"link",v:RS(t[1]),href:t[2]};if(wS.test(e)){const s=((r=e.match(/[.,;:!?]+$/))==null?void 0:r[0])||"",a=s?e.slice(0,-s.length):e,o={t:"link",v:a.replace(/^https:\/\//,""),href:a};return s?[o,{t:"text",v:s}]:o}const n=e.match(AS);return n?{t:"handle",v:n[1]}:e.length>2&&(e[0]==="*"||e[0]==="_")&&e.at(-1)===e[0]?{t:"i",v:e.slice(1,-1)}:{t:"text",v:e}})}function PS(i){const e=[];let t=null;const n=()=>{t&&e.push(t),t=null};for(const r of String(i||"").split(` 4128`)){const s=r.match(/^\s*[-*â¢]\s+(.*)$/)||r.match(/^\s*\d+[.)]\s+(.*)$/);if(s){const o=/^\s*\d/.test(r);t&&t.ordered!==o&&n(),t||(t={type:"list",ordered:o,items:[]}),t.items.push(s[1]);continue}if(n(),!r.trim())continue;const a=r.match(/^\s*#{1,4}\s+(.*)$/);e.push(a?{type:"h",text:a[1]}:{type:"p",text:r})}return n(),e}const vl={post:25e3,thread:280,reply:280,quote:280,"send-dm":1e4,name:50,description:160,location:30,url:100},DS={post:"Post",thread:"Thread",reply:"Reply",quote:"Quote",like:"Like",retweet:"Retweet",bookmark:"Bookmark",follow:"Follow",unfollow:"Unfollow","send-dm":"DM"},LS={text:"Message",name:"Display name",description:"Bio",location:"Location",url:"Website",composeText:"Tweet",label:"Name"},IS=new Set(["text","description","composeText"]),NS=i=>String(i||"").replace(/^@/,"")||null,Vs=(i,e)=>`${i} ${e}${i===1?"":"s"}`,US=/^[ \t]*-{3,}[ \t]*$/m,Kl=i=>String(i??"").split(US).map(e=>e.trim()),OS=i=>i.join(` 4129 4130--- 4131 4132`);function FS(i){const e=Object.entries(i||{}).filter(([,t])=>t!=null&&t!=="");return e.length?e.map(([t,n])=>{const r=typeof n=="string"?n:JSON.stringify(n);return`${t}: ${r.length>60?`${r.slice(0,60)}â¦`:r}`}).join(" · "):"no arguments"}function Gs(i,e={}){const t=(i==null?void 0:i.args)||{};return((i==null?void 0:i.editable)||[]).filter(n=>typeof t[n]=="string").map(n=>({key:n,label:LS[n]||n,value:t[n],limit:e[n]??vl[n]??null,big:IS.has(n)}))}function gf(i){var n,r,s;const e=(i==null?void 0:i.tool)||"",t=(i==null?void 0:i.args)||{};if(e==="queue_action"){const a=t.type||"",o=NS(t.recipientHandle||t.handle),l=a==="send-dm",c=a==="thread",u=Gs(i,{text:c?null:vl[a]??280}),f=c?Kl(t.text):null;if(c)for(const h of u)h.key==="text"&&(h.perLeg=vl.thread,h.legs=f);return{kind:l?"dm":t.text||t.posts?"tweet":"act",headline:`${DS[a]||a||"Action"}${o?` @${o}`:""}`,meta:[f!=null&&f.length?Vs(f.filter(Boolean).length,"tweet"):null,t.tweetId?`on tweet ${t.tweetId}`:null,t.tweetUrl?`quoting ${t.tweetUrl}`:null,(n=t.mediaIds)!=null&&n.length?Vs(t.mediaIds.length,"image"):null,Number.isFinite(t.scheduledFor)?`scheduled ${new Date(t.scheduledFor).toLocaleString()}`:null].filter(Boolean),fields:u,posts:!u.some(h=>h.perLeg)&&Array.isArray(t.posts)&&t.posts.length?t.posts:null}}if(e==="update_x_profile"){const a=((r=t.accountIds)==null?void 0:r.length)||1;return{kind:"profile",headline:`Edit the live X profile of ${Vs(a,"account")}`,meta:[a>1?"one at a time, a pause between each â this takes minutes":null].filter(
4132Boolean),note:"This is the public profile. Everyone sees it.",fields:Gs(i),images:[t.avatarUrl?{label:"Avatar",url:t.avatarUrl}:null,t.headerUrl?{label:"Header",url:t.headerUrl}:null].filter(Boolean)}}return e==="create_campaign"?{kind:"campaign",headline:`New ${t.type||""} campaign`.trim(),meta:[Vs(((s=t.accountIds)==null?void 0:s.length)||0,"account"),t.approvalMode?"every action held for approval":null,"starts as a draft â sends nothing until you start it"].filter(Boolean),fields:Gs(i)}:e==="campaign_control"||e==="kill_switch"?{kind:"campaign",headline:(i==null?void 0:i.label)||e.replace(/_/g," "),meta:[],note:e==="kill_switch"?"Stops everything, on every account, immediately.":null,fields:[]}:{kind:"plain",headline:(i==null?void 0:i.label)||e.replace(/_/g," ")||"Action",meta:[FS(t)],fields:Gs(i)}}function BS(i,e){var n;const t={};for(const r of i||[]){const s=e==null?void 0:e[r.id];if(!s)continue;const a={};for(const[o,l]of Object.entries(s))typeof l=="string"&&l!==((n=r.args)==null?void 0:n[o])&&(a[o]=l);Object.keys(a).length&&(t[r.id]=a)}return t}function zS(i,e){var n;const t=[];for(const r of i||[])for(const s of gf(r).fields){const a=((n=e==null?void 0:e[r.id])==null?void 0:n[s.key])??s.value;s.perLeg?Kl(a).forEach((o,l)=>{o.length>s.perLeg&&t.push({id:r.id,key:s.key,over:o.length-s.perLeg,where:`tweet ${l+1}`})}):s.limit&&a.length>s.limit&&t.push({id:r.id,key:s.key,over:a.length-s.limit})}return t}const kS=["Set up a DM campaign","Draft and queue a post for tomorrow","Create a list of prospects","Pause everything","How did we do this week?"],pa="xlift:copilot-conversation",Oh="xlift:chat-width",Fh="xlift:chat-open",HS=5*1024*1024,VS=4e3,GS=90;function WS(i){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{const r=String(n.result);e({mime:i.type,data:r.split(",")[1]||"",preview:r})},n.onerror=t,n.readAsDataURL(i)})}function Bh(){let i=localStorage.getItem(pa);return i||(i=`c${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`,localStorage.setItem(pa,i)),i}function _M(){const{pathname:i}=Wf(),[e,t]=ke.useState(Bh),[n,r]=ke.useState([]),[s,a]=ke.useState(""),[o,l]=ke.useState([]),[c,u]=ke.useState(null),[f,h]=ke.useState(!1),[d,g]=ke.useState(!1),[v,m]=ke.useState(!1),[p,w]=ke.useState(null),[E,S]=ke.useState(!1),[b,T]=ke.useState(!1),[L,x]=ke.useState(!1),[A,k]=ke.useState(!1),B=ke.useRef(null),U=ke.useRef(null),te=ke.useRef(n);te.current=n;const ee=ke.useRef(0);ke.useEffect(()=>()=>{var D;return(D=U.current)==null?void 0:D.abort()},[]),ke.useEffect(()=>{var D;(D=B.current)==null||D.scrollTo({top:B.current.scrollHeight,behavior:"smooth"})},[n,c]),ke.useEffect(()=>{let D=!1;return cn.agentConversation(e).then(j=>{var ae;!D&&((ae=j.transcript)!=null&&ae.length)&&r(j.transcript)}).catch(()=>{}),()=>{D=!0}},[e]);function $(){m(!0),cn.agentConversations().then(D=>w(D.conversations||[])).catch(D=>{w([]),Wi(D)})}function ne(D){var j;(j=U.current)==null||j.abort(),localStorage.setItem(pa,D),r([]),l([]),t(D),m(!1)}async function K(D){w(j=>(j||[]).filter(ae=>ae.id!==D));try{await cn.agentDeleteConversation(D)}catch(j){Wi(j)}D===e&&O()}async function X(D){var re;const j=te.current.length;g(!0);let ae=0;for(let H=0;H<GS;H++){if(u(H<2?"Connection dropped â reconnectingâ¦":"Still working on it â hang tightâ¦"),await new Promise(Se=>setTimeout(Se,VS)),D.signal.aborted)return;let y;try{y=await cn.agentConversation(e)}catch{if(++ae>=3){r(Se=>[...Se,{role:"assistant",error:!0,text:"I can't reach the server â looks like the connection is down. Nothing was lost; try again once you're back online."}]);return}continue}if(ae=0,(((re=y.transcript)==null?void 0:re.length)||0)>j){r(y.transcript);return}}r(H=>[...H,{role:"assistant",error:!0,text:"I lost the connection and that turn never came back. Nothing new was sent â ask me again and I'll pick it up."}])}async function ge(D){h(!0),u("Thinkingâ¦");const j=new AbortController;U.current=j;try{await cn.agentChat({conversationId:e,pageContext:i,...D},(ae,re)=>{ae==="status"?u(re.label):ae==="text"?r(H=>[...H,{role:"assistant",text:re.text,suggestions:re.suggestions}]):ae==="confirm"?r(H=>[...H,{role:"confirm",...re,resolved:null}]):ae==="result"?r(H=>H.map(y=>y.id===re.id?{...y,results:re.results}:y)):ae==="ui"&&re.view==="connect-account"?S(!0):ae==="error"&&r(H=>[...H,{role:"assistant",text:re.message,error:!0}])},j.signal)}catch(ae){ae.name==="AbortError"||(ae.code==="stream-dropped"||ed(ae)?await X(j):r(re=>[...re,{role:"assistant",text:ae.message||"Something went wrong.",error:!0}]))}finally{h(!1),g(!1),u(null),U.current=null}}
4132async function _e(D){var ae;const j=Array.from(D||[]).filter(Boolean);for(const re of j){if(!((ae=re.type)!=null&&ae.startsWith("image/"))){Wi(new Error(`${re.name||"That file"} isn't an image`));continue}if(re.size>HS){Wi(new Error(`${re.name||"Image"} is over 5 MB`));continue}try{const H=await WS(re);l(y=>y.length>=4?y:[...y,H])}catch{Wi(new Error("Could not read that image"))}}}const ve=D=>{var j;return Array.from(((j=D.dataTransfer)==null?void 0:j.types)||[]).includes("Files")};function Ee(D){ve(D)&&(D.preventDefault(),ee.current+=1,k(!0))}function We(D){ve(D)&&D.preventDefault()}function Je(D){ve(D)&&(ee.current-=1,ee.current<=0&&(ee.current=0,k(!1)))}function Ue(D){ve(D)&&(D.preventDefault(),ee.current=0,k(!1),_e(D.dataTransfer.files))}function ie(D){const j=(D??s).trim();if(!j&&o.length===0||f)return;const ae=o;a(""),l([]),r(re=>[...re,{role:"user",text:j,images:ae.map(H=>({url:H.preview}))}]),ge({message:j,images:ae.map(re=>({mime:re.mime,data:re.data}))})}function q(D,j,ae){var re;r(H=>H.map((y,Se)=>Se===D?{...y,resolved:j}:y)),ge({confirm:j,confirmId:(re=n[D])==null?void 0:re.id,...ae})}async function F(){var D;x(!0);try{const j=await cn.operatorRestart();(D=U.current)==null||D.abort(),r([]),l([]),T(!1),Zf(`Fresh start: ${j.campaignsPaused||0} campaign${j.campaignsPaused===1?"":"s"} paused, ${j.actionsCancelled||0} unsent action${j.actionsCancelled===1?"":"s"} cancelled.`)}catch(j){Wi(j,"Could not start over")}finally{x(!1)}}function O(){var D;(D=U.current)==null||D.abort(),cn.agentReset(e).catch(()=>{}),localStorage.removeItem(pa),r([]),l([]),t(Bh()),m(!1)}const P=n.length===0,W=ke.useRef(null),[he,pe]=ke.useState(()=>Number(localStorage.getItem(Oh))||400),[R,G]=ke.useState(()=>localStorage.getItem(Fh)!=="0");function I(D){G(D),localStorage.setItem(Fh,D?"1":"0")}function J(D){D.preventDefault();const j=W.current.getBoundingClientRect().right;let ae=he;const re=y=>{ae=Math.min(760,Math.max(300,j-y.clientX)),pe(ae)},H=()=>{localStorage.setItem(Oh,String(ae)),window.removeEventListener("pointermove",re),window.removeEventListener("pointerup",H)};window.addEventListener("pointermove",re),window.addEventListener("pointerup",H)}return N.jsxs(ut,{ref:W,align:"stretch",gap:"md",wrap:"nowrap",style:{height:`calc(100vh - ${Kf+64}px)`},children:[!R&&N.jsx(Pi,{label:"Open chat",children:N.jsx(gn,{variant:"default",size:"lg",style:{order:3,alignSelf:"center"},onClick:()=>I(!0),"aria-label":"Open chat",children:N.jsx(Md,{size:18})})}),R&&N.jsx(Yn,{onPointerDown:J,title:"Drag to resize",style:{order:2,flex:"0 0 7px",cursor:"col-resize",borderRadius:4,background:"var(--xb-line-soft)"}}),R&&N.jsxs(Yn,{style:{order:3,flex:`0 0 ${he}px`,minWidth:0,display:"flex",flexDirection:"column",position:"relative"},onDragEnter:Ee,onDragOver:We,onDragLeave:Je,onDrop:Ue,children:[A&&N.jsx(Yn,{style:{position:"absolute",inset:0,zIndex:5,borderRadius:12,border:"2px dashed var(--mantine-color-blue-5)",background:"var(--mantine-color-blue-light)",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:N.jsxs(ut,{gap:8,c:"blue",children:[N.jsx(lc,{size:22}),N.jsx(Qe,{fw:600,children:"Drop images to attach"})]})}),N.jsxs(ut,{justify:"flex-end",gap:2,pb:4,children:[e==="operator"?N.jsxs(ut,{gap:6,style:{marginRight:"auto"},children:[N.jsx(En,{variant:"light",color:"grape",size:"sm",children:"Operator"}),N.jsx(dr,{size:"compact-xs",variant:"subtle",color:"red",onClick:()=>T(!0),children:"Start over"})]}):N.jsx(Pi,{label:"The Operator â your standing marketing agent",children:N.jsx(gn,{variant:"subtle",color:"grape",onClick:()=>ne("operator"),"aria-label":"Operator",children:N.jsx(qd,{size:17})})}),N.jsx(Pi,{label:"Hide chat",children:N.jsx(gn,{variant:"subtle",color:"gray",onClick:()=>I(!1),"aria-label":"Hide chat",children:N.jsx(nu,{size:17})})}),N.jsx(Pi,{label:"Previous chats",children:N.jsx(gn,{variant:"subtle",color:"gray",onClick:$,"aria-label":"Previous chats",children:N.jsx(Xf,{size:17})})}),N.jsx(Pi,{label:"New chat",children:N.jsx(gn,{variant:"subtle",color:"gray",onClick:O,"aria-label":"New chat",children:N.jsx(ru,{size:17})})})]}),N.jsx(XS,{opened:v,onClose:()=>m(!1),chats:p,currentId:e,onOpenChat:ne,onDelete:K,onNew:O}),N.jsx(qf,{opened:b,onClose:()=>T(!1),title:"Start completely over?",centered:!0,children:N.jsxs(hn,{gap:"sm",children:[N.jsx(Qe,{size:"sm",children:"This stops the whole operation and wipes the Operator's plan:"}),N.jsxs(Di,{size:"sm",spacing:4,children:[N.jsxs(Di.Item,{children:["Every live campaign is ",N.jsx("b",{children:"paused"})]}),N.jsxs(Di.Item,{children:["Everything queued or awaiting approval is ",N.jsx("b",{children:"cancelled"})," â nothing unsent will fire"]}),N.jsxs(Di.Item,{children:["The Operator's plan, mission and this thread are ",N.jsx("b",{children:"cleared"}),"; its schedule is off"]}),N.jsx(Di.Item,{children:"Kill switch reset"})]}),N.jsx(Qe,{size:"sm",c:"dimmed",children:"Your accounts stay connected. History, analytics, lists and leads are kept â paused campaigns can be resumed by hand if you change your mind, but cancelled actions are gone for good."}),N.jsxs(ut,{justify:"flex-end",gap:"xs",mt:4,children:[N.jsx(dr,{variant:"default",onClick:()=>T(!1),disabled:L,children:"Keep everything"}),N.jsx(dr,{color:"red",onClick:F,loading:L,children:"Start over"})]})]})}),P?N.jsxs(hn,{align:"center",justify:"center",gap:"lg",style:{flex:1},children:[N.jsx("img",{src:"/logo.svg",alt:"",style:{width:56,height:56}}),N.jsxs(hn,{align:"center",gap:4,children:[N.jsx(Yf,{order:3,style:{letterSpacing:"-0.02em"},children:e==="operator"?"Give me a website. Iâll run the marketing.":"What should I run for you?"}),N.jsx(Qe,{size:"sm",c:"dimmed",ta:"center",style:{maxWidth:460},children:e==="operator"?"Paste your siteâs URL and tell me the goal. Iâll research the business, show you a plan with real numbers, and once you say go Iâll work it on a schedule â every action that touches X still waits for your approval. Come back anytime to steer.":"Campaigns, posts, lists, accounts, settings â I can change any of it, not just report on it. You approve every change before it happens."})]}),N.jsx(ut,{justify:"center",gap:8,style:{maxWidth:620},children:kS.map(D=>N.jsx(En,{variant:"light",size:"lg",style:{cursor:"pointer",textTransform:"none",fontWeight:400},onClick:()=>ie(D),children:D},D))})]}):N.jsx(ga,{style:{flex:1},viewportRef:B,type:"hover",children:N.jsxs(hn,{gap:"md",pb:"md",children:[n.map((D,j)=>{var ae,re;return D.role==="user"?N.jsx(ut,{justify:"flex-end",children:N.jsxs(es,{px:"md",py:8,radiu
4132s:"lg",style:{maxWidth:"80%",background:"var(--mantine-color-blue-light)"},children:[((ae=D.images)==null?void 0:ae.length)>0&&N.jsx(ut,{gap:6,mb:D.text?8:0,justify:"flex-end",children:D.images.map((H,y)=>N.jsx(vo,{src:H.url,alt:"",w:120,h:120,fit:"cover",radius:"md"},y))}),D.text&&N.jsx(Qe,{size:"sm",style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:Zs(D.text)})]})},j):D.role==="confirm"?N.jsx(qS,{card:D,busy:f,onResolve:(H,y)=>q(j,H,y)},j):N.jsxs(ut,{align:"flex-start",gap:10,wrap:"nowrap",children:[N.jsx("img",{src:"/logo.svg",alt:"",style:{width:24,height:24,marginTop:2,flexShrink:0}}),D.error?N.jsx(jf,{color:"red",variant:"light",py:8,style:{flex:1},children:N.jsx(Qe,{size:"sm",children:D.text})}):N.jsxs(hn,{gap:8,style:{flex:1,minWidth:0},children:[N.jsx(jS,{text:D.text}),((re=D.suggestions)==null?void 0:re.length)>0&&j===n.length-1&&!f&&N.jsx(ut,{gap:6,children:D.suggestions.map(H=>N.jsx(En,{variant:"light",size:"lg",style:{cursor:"pointer",textTransform:"none",fontWeight:400},onClick:()=>ie(H),children:H},H))})]})]},j)}),c&&N.jsxs(ut,{gap:10,wrap:"nowrap",children:[N.jsx(Gh,{size:16}),N.jsx(Qe,{size:"sm",c:"dimmed",children:c}),d&&N.jsx(Qs,{component:"button",type:"button",size:"xs",c:"dimmed",onClick:()=>{var D;return(D=U.current)==null?void 0:D.abort()},children:"stop waiting"})]})]})}),N.jsxs(Yn,{pt:"sm",style:{borderTop:P?"none":"1px solid var(--xb-line-soft)"},children:[o.length>0&&N.jsx(ut,{gap:8,mb:8,children:o.map((D,j)=>N.jsxs(Yn,{style:{position:"relative"},children:[N.jsx(vo,{src:D.preview,alt:"",w:64,h:64,fit:"cover",radius:"md"}),N.jsx(gn,{size:"xs",radius:"xl",variant:"filled",color:"dark",style:{position:"absolute",top:-6,right:-6},onClick:()=>l(ae=>ae.filter((re,H)=>H!==j)),"aria-label":"Remove image",children:N.jsx(ls,{size:12})})]},j))}),N.jsxs(ut,{align:"flex-end",gap:8,wrap:"nowrap",children:[N.jsx(bd,{onChange:D=>_e(D),accept:"image/*",multiple:!0,children:D=>N.jsx(Pi,{label:"Attach image",children:N.jsx(gn,{...D,size:36,radius:"xl",variant:"subtle",color:"gray",disabled:f||o.length>=4,"aria-label":"Attach image",children:N.jsx(lc,{size:18})})})}),N.jsx(yo,{autosize:!0,minRows:1,maxRows:8,style:{flex:1},placeholder:"Ask anything, or tell me what to changeâ¦",value:s,disabled:f,onChange:D=>a(D.currentTarget.value),onPaste:D=>{var ae;const j=Array.from(((ae=D.clipboardData)==null?void 0:ae.files)||[]).filter(re=>re.type.startsWith("image/"));j.length&&(D.preventDefault(),_e(j))},onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),ie())}}),N.jsx(gn,{size:36,radius:"xl",variant:"filled",disabled:f||!s.trim()&&o.length===0,onClick:()=>ie(),"aria-label":"Send",children:N.jsx($f,{size:18})})]}),N.jsx(Qe,{size:"xs",c:"dimmed",mt:6,ta:"center",children:"Lift reads your live data. Anything that changes something asks first."})]}),N.jsx(yd,{opened:E,onClose:()=>S(!1)})]}),N.jsx(Yn,{style:{order:1,flex:1,minWidth:0},children:N.jsx(SS,{})})]})}function XS({opened:i,onClose:e,chats:t,currentId:n,onOpenChat:r,onDelete:s,onNew:a}){const{rel:o}=Sd();return N.jsx(Rn,{opened:i,onClose:e,title:"Previous chats",position:"right",size:360,children:N.jsxs(hn,{gap:4,children:[N.jsx(dr,{variant:"light",size:"xs",leftSection:N.jsx(ru,{size:14}),onClick:a,mb:"xs",children:"New chat"}),t===null&&N.jsx(Gh,{size:"sm",mx:"auto",my:"lg"}),(t==null?void 0:t.length)===0&&N.jsx(Qe,{size:"sm",c:"dimmed",ta:"center",my:"lg",children:"Nothing here yet â your chats will show up as you have them."}),(t||[]).map(l=>N.jsxs(ut,{gap:4,wrap:"nowrap",children:[N.jsxs(Jf,{onClick:()=>r(l.id),style:{flex:1,minWidth:0,padding:"6px 8px",borderRadius:6},bg:l.id===n?"var(--mantine-color-blue-light)":void 0,children:[N.jsx(Qe,{size:"sm",truncate:!0,children:l.title}),N.jsxs(Qe,{size:"xs",c:"dimmed",children:[o(l.updatedAt)," · ",l.messageCount," messages"]})]}),N.jsx(gn,{variant:"subtle",color:"gray",onClick:()=>s(l.id),"aria-label":"Delete chat",children:N.jsx(Ed,{size:15})})]},l.id))]})})}function qS({card:i,busy:e,onResolve:t}){const n=i.resolved!==null&&i.resolved!==void 0,r=Array.isArray(i.actions)&&i.actions.length?i.actions:[{id:i.id,tool:i.tool,label:i.label,args:i.args,danger:i.danger,editable:[]}],s=i.danger||r.some(v=>v.danger),a=r.length>1,[o,l]=ke.useState({}),[c,u]=ke.useState([]),f=(v,m,p)=>l(w=>({...w,[v]:{...w[v],[m]:p}})),h=r.filter(v=>!c.includes(v.id)),d=zS(h,o),g=i.results||[];return N.jsx(xo,{withBorder:!0,radius:"md",p:"sm",style:{borderColor:s?"var(--mantine-color-red-4)":void 0},children:N.jsxs(hn,{gap:10,children:[a&&N.jsxs(Qe,{size:"xs",c:"dimmed",fw:600,children:[r.length," actions â approve together",!n&&", or drop the ones you don't want"]}),r.map((v,m)=>N.jsx(YS,{action:v,editable:!n&&!e,draft:o[v.id],onChange:(p,w)=>f(v.id,p,w),dropped:c.includes(v.id),onDrop:a&&!n&&!e?()=>u(p=>p.includes(v.id)?p.filter(w=>w!==v.id):[...p,v.id]):null,result:g.find(p=>p.id===v.id)},v.id||m)),N.jsx(ut,{justify:"flex-end",gap:6,wrap:"nowrap",children:n?N.jsx(En,{variant:"light",color:i.resolved==="approve"?"teal":"gray",children:i.resolved==="approve"?"Ran":"Cancelled"}):N.jsxs(N.Fragment,{children:[d.length>0&&N.jsx(Qe,{size:"xs",c:"red",style:{flex:1},children:d.length===1?`${d[0].over} characters over the limit`:`${d.length} fields are over the limit`}),N.jsx(dr,{size:"xs",variant:"subtle",color:"gray",disabled:e,leftSection:N.jsx(ls,{size:14}),onClick:()=>t("reject"),children:"Cancel"}),N.jsx(dr,{size:"xs",color:s?"red":void 0,disabled:e||d.length>0||h.length===0,leftSection:N.jsx(Wh,{size:14}),onClick:()=>t("approve",{edits:BS(h,o),skip:c}
4132),children:h.length===0?"Nothing left":h.length>1?`Run ${h.length}`:"Run"})]})})]})})}function YS({action:i,editable:e,draft:t,onChange:n,dropped:r,onDrop:s,result:a}){var c;const o=gf(i),l=o.kind==="tweet"||o.kind==="dm";return N.jsxs(hn,{gap:6,style:{minWidth:0,opacity:r?.4:1},children:[N.jsxs(ut,{gap:6,wrap:"nowrap",justify:"space-between",children:[N.jsxs(ut,{gap:6,wrap:"nowrap",style:{minWidth:0},children:[i.danger&&N.jsx(sc,{size:15,color:"var(--mantine-color-red-6)",style:{flexShrink:0}}),N.jsx(Qe,{size:"sm",fw:600,truncate:!0,children:o.headline})]}),s&&N.jsx(Pi,{label:r?"Put it back":"Leave this one out",children:N.jsx(gn,{size:"sm",variant:"subtle",color:"gray",onClick:s,"aria-label":r?"Put back":"Remove",children:r?N.jsx(nu,{size:14}):N.jsx(ls,{size:14})})})]}),o.meta.length>0&&N.jsx(Qe,{size:"xs",c:"dimmed",style:{wordBreak:"break-word"},children:o.meta.join(" · ")}),o.note&&N.jsx(Qe,{size:"xs",c:"red",children:o.note}),((c=o.images)==null?void 0:c.length)>0&&N.jsx(ut,{gap:8,children:o.images.map(u=>N.jsxs(hn,{gap:2,align:"center",children:[N.jsx(vo,{src:u.url,alt:u.label,w:56,h:56,fit:"cover",radius:"sm"}),N.jsx(Qe,{size:"xs",c:"dimmed",children:u.label})]},u.label))}),o.posts&&N.jsx(hn,{gap:4,children:o.posts.map((u,f)=>N.jsxs(Qe,{size:"sm",style:{whiteSpace:"pre-wrap"},children:[N.jsxs(Qe,{span:!0,size:"xs",c:"dimmed",children:[f+1,"/",o.posts.length," "]}),u]},f))}),o.fields.map(u=>{const f=(t==null?void 0:t[u.key])??u.value,h=u.limit?f.length-u.limit:0;if(u.perLeg){const d=Kl(f);return N.jsx(hn,{gap:6,children:d.map((g,v)=>{const m=g.length-u.perLeg;return N.jsxs(Yn,{children:[e?N.jsx(yo,{autosize:!0,minRows:2,maxRows:10,size:"xs",label:v===0?"Post":`Comment ${v}`,value:g,disabled:r,onChange:p=>n(u.key,OS(d.map((w,E)=>E===v?p.currentTarget.value:w))),error:m>0||void 0}):N.jsxs(es,{withBorder:!0,p:"xs",radius:"md",children:[N.jsx(Qe,{size:"xs",c:"dimmed",mb:2,children:v===0?"Post":`Comment ${v}`}),N.jsx(Qe,{size:"sm",style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:g})]}),(g.length>u.perLeg*.8||m>0)&&N.jsxs(Qe,{size:"xs",c:m>0?"red":"dimmed",ta:"right",children:[g.length,"/",u.perLeg]})]},v)})},u.key)}return N.jsxs(Yn,{children:[e?N.jsx(yo,{autosize:!0,minRows:u.big?2:1,maxRows:10,size:"xs",label:o.fields.length>1||!l?u.label:void 0,value:f,disabled:r,onChange:d=>n(u.key,d.currentTarget.value),error:h>0||void 0}):N.jsx(es,{withBorder:l,p:l?"xs":0,radius:"md",children:N.jsx(Qe,{size:"sm",style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:f})}),u.limit&&(f.length>u.limit*.8||h>0)&&N.jsxs(Qe,{size:"xs",c:h>0?"red":"dimmed",ta:"right",children:[f.length,"/",u.limit]})]},u.key)}),a&&N.jsxs(ut,{gap:4,wrap:"nowrap",children:[a.ok?N.jsx(Wh,{size:13,color:"var(--mantine-color-teal-6)",style:{flexShrink:0}}):N.jsx(sc,{size:13,color:a.skipped?"var(--mantine-color-gray-5)":"var(--mantine-color-red-6)",style:{flexShrink:0}}),N.jsx(Qe,{size:"xs",c:a.ok?"teal":a.skipped?"dimmed":"red",style:{wordBreak:"break-word"},children:a.note})]})]})}const Zs=i=>CS(i).map((e,t)=>e.t==="b"?N.jsx("strong",{children:e.v},t):e.t==="code"?N.jsx(Td,{children:e.v},t):e.t==="i"?N.jsx("em",{children:e.v},t):e.t==="handle"?N.jsx(vd,{handle:e.v,size:"sm",external:!1},t):e.t==="link"?e.href.startsWith("/")?N.jsx(Qs,{component:Qf,to:e.href,size:"sm",children:e.v},t):N.jsx(Qs,{href:e.href,target:"_blank",rel:"noreferrer",size:"sm",children:e.v},t):e.v);function jS({text:i}){return N.jsx(hn,{gap:6,style:{flex:1,minWidth:0,wordBreak:"break-word"},children:PS(i).map((e,t)=>e.type==="list"?N.jsx(Di,{type:e.ordered?"ordered":"unordered",size:"sm",spacing:4,withPadding:!0,children:e.items.map((n,r)=>N.jsx(Di.Item,{children:Zs(n)},r))},t):e.type==="h"?N.jsx(Qe,{size:"sm",fw:700,mt:t?4:0,children:Zs(e.text)},t):N.jsx(Qe,{size:"sm",style:{whiteSpace:"pre-wrap",lineHeight:1.6},children:Zs(e.text)},t))})}export{_M as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.