commit 03fe1df64b1968a499c8843a47aa941b93878cd7 Author: Tucan444 Date: Sat Aug 21 20:45:29 2021 +0200 _ diff --git a/desktop app/Understanding 4D.zip b/desktop app/Understanding 4D.zip new file mode 100644 index 0000000..0e29352 Binary files /dev/null and b/desktop app/Understanding 4D.zip differ diff --git a/images/0.png b/images/0.png new file mode 100644 index 0000000..8a4d69c Binary files /dev/null and b/images/0.png differ diff --git a/images/1.png b/images/1.png new file mode 100644 index 0000000..8d34719 Binary files /dev/null and b/images/1.png differ diff --git a/images/1d.png b/images/1d.png new file mode 100644 index 0000000..43324de Binary files /dev/null and b/images/1d.png differ diff --git a/images/2.png b/images/2.png new file mode 100644 index 0000000..1239852 Binary files /dev/null and b/images/2.png differ diff --git a/images/3.png b/images/3.png new file mode 100644 index 0000000..43d7ba8 Binary files /dev/null and b/images/3.png differ diff --git a/images/3d.png b/images/3d.png new file mode 100644 index 0000000..8d85ef1 Binary files /dev/null and b/images/3d.png differ diff --git a/images/3d.png~ b/images/3d.png~ new file mode 100644 index 0000000..7a57736 Binary files /dev/null and b/images/3d.png~ differ diff --git a/images/4.png b/images/4.png new file mode 100644 index 0000000..9fbd751 Binary files /dev/null and b/images/4.png differ diff --git a/images/4d.png b/images/4d.png new file mode 100644 index 0000000..73b634e Binary files /dev/null and b/images/4d.png differ diff --git a/images/4d.png~ b/images/4d.png~ new file mode 100644 index 0000000..9bc5cea Binary files /dev/null and b/images/4d.png~ differ diff --git a/images/5.png b/images/5.png new file mode 100644 index 0000000..0f5af35 Binary files /dev/null and b/images/5.png differ diff --git a/images/anglesToRotate.png b/images/anglesToRotate.png new file mode 100644 index 0000000..6de2299 Binary files /dev/null and b/images/anglesToRotate.png differ diff --git a/images/basicRotations.png b/images/basicRotations.png new file mode 100644 index 0000000..322205c Binary files /dev/null and b/images/basicRotations.png differ diff --git a/images/colorVisualizationFor2D.png b/images/colorVisualizationFor2D.png new file mode 100644 index 0000000..85441a5 Binary files /dev/null and b/images/colorVisualizationFor2D.png differ diff --git a/images/colorVisualizationFor2D.png~ b/images/colorVisualizationFor2D.png~ new file mode 100644 index 0000000..2167df3 Binary files /dev/null and b/images/colorVisualizationFor2D.png~ differ diff --git a/images/colorVisualizationForW.png b/images/colorVisualizationForW.png new file mode 100644 index 0000000..08ad49a Binary files /dev/null and b/images/colorVisualizationForW.png differ diff --git a/images/colorVisualizationForW.png~ b/images/colorVisualizationForW.png~ new file mode 100644 index 0000000..660e82e Binary files /dev/null and b/images/colorVisualizationForW.png~ differ diff --git a/images/directionalLightAndAmbientLightGradient.png b/images/directionalLightAndAmbientLightGradient.png new file mode 100644 index 0000000..78b124a Binary files /dev/null and b/images/directionalLightAndAmbientLightGradient.png differ diff --git a/images/halfDonutVisualizedIn2D.png b/images/halfDonutVisualizedIn2D.png new file mode 100644 index 0000000..1a8aa13 Binary files /dev/null and b/images/halfDonutVisualizedIn2D.png differ diff --git a/images/heightmap.png b/images/heightmap.png new file mode 100644 index 0000000..ffb9c36 Binary files /dev/null and b/images/heightmap.png differ diff --git a/images/images from desktop app/0.png b/images/images from desktop app/0.png new file mode 100644 index 0000000..ee7b3e0 Binary files /dev/null and b/images/images from desktop app/0.png differ diff --git a/images/images from desktop app/1.png b/images/images from desktop app/1.png new file mode 100644 index 0000000..c13b262 Binary files /dev/null and b/images/images from desktop app/1.png differ diff --git a/images/images from desktop app/2.png b/images/images from desktop app/2.png new file mode 100644 index 0000000..9493f25 Binary files /dev/null and b/images/images from desktop app/2.png differ diff --git a/images/images from desktop app/3.png b/images/images from desktop app/3.png new file mode 100644 index 0000000..23feabb Binary files /dev/null and b/images/images from desktop app/3.png differ diff --git a/images/images from desktop app/3_.png b/images/images from desktop app/3_.png new file mode 100644 index 0000000..82d61d4 Binary files /dev/null and b/images/images from desktop app/3_.png differ diff --git a/images/images from desktop app/4.png b/images/images from desktop app/4.png new file mode 100644 index 0000000..698e039 Binary files /dev/null and b/images/images from desktop app/4.png differ diff --git a/images/images from desktop app/5.png b/images/images from desktop app/5.png new file mode 100644 index 0000000..d4a1574 Binary files /dev/null and b/images/images from desktop app/5.png differ diff --git a/images/images from desktop app/5.png~ b/images/images from desktop app/5.png~ new file mode 100644 index 0000000..2589abe Binary files /dev/null and b/images/images from desktop app/5.png~ differ diff --git a/images/images from desktop app/main0.png b/images/images from desktop app/main0.png new file mode 100644 index 0000000..36a859c Binary files /dev/null and b/images/images from desktop app/main0.png differ diff --git a/images/images from desktop app/main1.png b/images/images from desktop app/main1.png new file mode 100644 index 0000000..7a65d3b Binary files /dev/null and b/images/images from desktop app/main1.png differ diff --git a/images/images from desktop app/main1_.png b/images/images from desktop app/main1_.png new file mode 100644 index 0000000..75b6d8d Binary files /dev/null and b/images/images from desktop app/main1_.png differ diff --git a/images/known and unknown rotations.png b/images/known and unknown rotations.png new file mode 100644 index 0000000..1a951de Binary files /dev/null and b/images/known and unknown rotations.png differ diff --git a/images/knownRotations2D.png b/images/knownRotations2D.png new file mode 100644 index 0000000..c1adca4 Binary files /dev/null and b/images/knownRotations2D.png differ diff --git a/images/main.png b/images/main.png new file mode 100644 index 0000000..74b9518 Binary files /dev/null and b/images/main.png differ diff --git a/images/newRotations.png b/images/newRotations.png new file mode 100644 index 0000000..33e56fb Binary files /dev/null and b/images/newRotations.png differ diff --git a/images/projected3Ddonut.png b/images/projected3Ddonut.png new file mode 100644 index 0000000..9d28934 Binary files /dev/null and b/images/projected3Ddonut.png differ diff --git a/images/projectingTwiceFrom3D.png b/images/projectingTwiceFrom3D.png new file mode 100644 index 0000000..f0999af Binary files /dev/null and b/images/projectingTwiceFrom3D.png differ diff --git a/images/projectingTwiceFrom4D.png b/images/projectingTwiceFrom4D.png new file mode 100644 index 0000000..509323a Binary files /dev/null and b/images/projectingTwiceFrom4D.png differ diff --git a/images/unknownRotationOnDonut.png b/images/unknownRotationOnDonut.png new file mode 100644 index 0000000..f10da67 Binary files /dev/null and b/images/unknownRotationOnDonut.png differ diff --git a/images/unknownRotationsUsedForCreatingObjects.png b/images/unknownRotationsUsedForCreatingObjects.png new file mode 100644 index 0000000..17196e3 Binary files /dev/null and b/images/unknownRotationsUsedForCreatingObjects.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..f5afc54 --- /dev/null +++ b/index.html @@ -0,0 +1,315 @@ + + + + + + + + + Understanding 4D + + +
+ +
+ +

Understanding 4D

+ +
+ 0. Introduction
+ +

+ Hello, I am Tucan.
+ In this course I will be explaining some ways of how to + think about 4D and then explain rotations of a 4D object that kinda looks like a donut. There will be a lot of interactive stuff so look forward to that.
+ Intuition is all you'll need. +

+
+ +
+

+ Also please download + this application. + (source code)
+ It contains several scenes that will be useful in our explanation.
+ You can continue without the app if you want to.
+ There will be screenshots of the scenes, but they won't be interactive. +

+
+ +
+ 1. What are we going to see? + +

+ Before we look at 4D and try understanding it, we need to know what are we going to be seeing and how.
+ To answer that, first let's look at what person in 1D would see. +

+ + + +

+ Person in 1D would see 1 piece of information or 0D.
+ Now let's look what happens in 2D. (use slider to move the points around) +

+ + + +

+ As we saw above person in 2D would see a line or section of 1D.
+ Let's continue to 3D. +

+ + + +

+ In 3D we see section of 2D. As shown on the image, by projecting onto 2D surface we get rid of z coordinates.
+ Now let's look what would a person in 4D see. +

+ + + +

+ Every time we had person in some dimension what he saw was section of lower dimension.
+ For example we live in 3D but see 2D. Similarly, a person in 4D would see 3D.
+ But we can't see 3D space like person in 4D.
+ For us, we need to project again, 3D => 2D.
+ Then we can see 2D section that we end up with.
+ Let me give you example of projecting twice. 3D => 2D => 1D +

+ + + +

+ Now, let's move onto our case 4D => 3D => 2D. + We'll ignore 4D person for less confusion. +

+ + + +

+ By projecting twice we get something that we can see.
+

+
+ +
+ 2. Visualizing w axis using color + +

+ Before we do w axis let's try visualizing z axis with color in 2D.
+ To do that we can use heightmaps. In heightmaps color is used to indicate height.
+ Below we have 3D surface on the left and its heightmap on the right.
+

+ +
+ + + +
+ +

+ Using only black and white can be problematic with negative values.
+ By using more colors we can get more information from looking at heightmaps.
+ Let's use blue and green. +

+ + + +

+ We can also use this to visualize the w axis. +

+ + + +
+ +
+ 3. Creating 4D object + +

+ Now it's going to start getting exciting.
+ 4D object that we're going to create is in some ways similar to donut.
+ That's why we will look at how to create a donut first.
+ We can create a donut by rotating circle around a line.
+ Below is how it would look in 2D visualized by color.
+ Note that object below is only half donut. (sigle color per circle used for simplicity)
+

+ + + +

+ As we saw above 2D person would see a circle that's getting squashed and its color changes.
+ We're going to create our 4D object similarly but use spheres instead and rotate into the 4th dimension.
+ Before that let's look at what we need to do basic rotations.
+ All we need for basic rotation are 2 variables forming a plane.
+ Its nicely demonstrated on the image below. +

+ + + +

+ Now we can start creating our 4D object.
+ Were going to do something similar to making a donut from circle.
+ But instead of circles were going to use spheres, and rotate into 4D using rotation with x and w.
+ Explore 3D scene that's illustrating half of the rotation. (signle color per sphere used for simplicity) +

+ + + +

+ Now let's go back to normal donut.
+ What would a person in 2D see when we project the donut.
+ We count that the donut was created using method above and not manipulated yet. +

+ + + +

+ When person that's in 2D saw that projected donut,
+ it looked something like rectangle with rounded corners.
+ Because we created our 4D object using similar method we can use this.
+ If this scales nicely, we should see something like cuboid (stretched cube) with rounded corners.
+ + Please open the desktop app mentioned at the begging.
+ Then click on the button shown below to run projection of 4D object. (in app) +

+ + + + +

+ As we saw, it looked like cuboid with rounded corners. +

+
+ +
+ 4. Exploring 4D object + +

+ There are a lot of confusing things that can happen when we rotate higher dimensional objects.
+ So to get a little less confused we're going to look at rotations and their behavior first.
+ Below is table with dimensions and rotations that become possible in that dimension. +

+ + + +

+ Now let's split rotations into known and unknown.
+ Known rotations will be those that exist in our dimension.
+ And unknown rotations will be those that are in higher dimensions.
+ The number of unknown rotations will always be infinite like the number of higher dimensions.
+ For example, if we're in 2D we have 1 known rotation. +

+ + + +

+ Using known rotations on higher dimensional objects doesn't change the behavior of known rotations.
+ For example, if we're in 2D and use known rotation on 3D donut it would rotate like we would expect. +

+ + + +

+ Also in the first scene that we used app to run were only known rotations inplace.
+ That's why you haven't seen any unusual motion.
+ To create higher dimensional objects in some dimension we used unknown rotations.
+ Let's look again at where we used them. +

+ + + +

+ Now we will use these unknown rotations to rotate the objects.
+ We're going to start with normal donut.
+ For person in 2D it looks as if the points are cycling through the object. +

+ + + +

+ Next we're going to do the same with our 4D object.
+ Click the button shown below. (in app) +

+ + + + +

+ Another thing we can do is use reverse rendering.
+ Here, that means seeing whats furthest away first.
+ This way we can see more useful information.
+ Let's start with rendering normal 3D donut with reverse.
+ Click the button shown below. (in app) +

+ + + + +

+ Using reverse we could see the backside and partially see front side as well when they overlapped.
+ Next were going to use reverse with our 4D object.
+ Click the button shown below. (in app) +

+ + + + +

+ Next we'll change lighting.
+ Instead of normal lighting we can use ambient light gradients (alg).
+ With them we can get better sense of distance.
+ Image below is showing difference between directional lighting and alg. +

+ + + +

+ Actually alg that's used in the app is a little different to improve performance.
+ But it still looks similar enough.
+ Now we'll try alg with 3D donut.
+ Click the button shown below. (in app) +

+ + + + + +

+ Let's continue with our 4D object.
+ Click the button shown below. (in app) +

+ + + + +

+ There's one more thing we will do in this explanation.
+ We never combined known and unknown rotations together with our 4D object.
+ Because of that we never got to see all states of our 4D object.
+ To access all rotated states of 4D object we need 3 angles.
+ Below image illustrates this. +

+ + + +

+ Now, let's try it with our 4D object.
+ Click the button shown below. (in app) +

+ + + + + + +

+ And with that, here ends the explanation.

+ Github +

+
+ + + + \ No newline at end of file diff --git a/libraries/jquery-3.6.0.min.js b/libraries/jquery-3.6.0.min.js new file mode 100644 index 0000000..200b54e --- /dev/null +++ b/libraries/jquery-3.6.0.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 this.constrains[1]) { + this.y = this.constrains[1]; + } else { + this.y = y; + } + } + + collidepoint = function (x, y) { + let differences = [this.x - x, this.y - y]; + let distance = Math.sqrt(Math.pow(differences[0], 2) + Math.pow(differences[1], 2)); + + return (distance <= this.r); + } + + get_progress = function() { + let progress = this.y - this.constrains[0]; + progress /= this.constrains[1] - this.constrains[0]; + + return progress; + } + + blit = function(ctx, color_index) { + ctx.beginPath(); + + ctx.lineWidth = 1; + ctx.fillStyle = this.colors[color_index]; + + ctx.arc(this.x, this.y, this.r, 0, this.TAU); + + ctx.fill(); + } +} + +console.log("a"); +$(document).ready(function(){ + console.log("b"); + let c = $(".c")[0]; + let ctx = c.getContext("2d"); + let TAU = Math.PI * 2; + let canvas_size = [1100, 360]; + let view_width = 120; + let thin_line_width = 6; + let normal_line_width = 20; + let alpha = 0; + let mousedown = false; + let on_slider = false; + + let player_pos = [canvas_size[0] - 360, canvas_size[1] /2]; + let projection_size = [100, 120]; + + let slider_padding_top_bottom = 40; + let slider_angle = TAU * 1.2; + + let creamy_white = "#c3c3c3"; + let creamy_gray_light = "#a3a3a3" + let creamy_gray = "#999999"; + let creamy_gray_dark = "#777777"; + let green = "#6de256"; + + let sliderMode = 0; + + let sliderPoint = new VerticalSliderPoint(50, slider_padding_top_bottom, 16, + [creamy_gray, creamy_gray_light, creamy_white], + [slider_padding_top_bottom, canvas_size[1] - slider_padding_top_bottom]); + + let points = [new RotatingPoint2D(60, 0, 0, 60, 20, [255, 100, 100]), + new RotatingPoint2D(Math.cos((Math.PI / 3) * 2) * 80, Math.sin((Math.PI / 3) * 2) * 80, (Math.PI / 3) * 2, 80, 20, [255, 100, 100]), + new RotatingPoint2D(Math.cos((Math.PI / 3) * 4) * 110, Math.sin((Math.PI / 3) * 4) * 110, (Math.PI / 3) * 4, 110, 20, [255, 100, 100])]; + + for (let i = 0; i < points.length; i++) { + points[i].shade(100, 100, 400); + points[i].find_d(player_pos); + points[i].draw_line_to_player(ctx, player_pos); + } + + points.sort((a, b) => (a.d < b.d) ? 1 : -1); + + draw_projected_view(); + + draw_static_objects(); + + sliderPoint.blit(ctx, 0); + + for(let i = 0; i (a.d < b.d) ? 1 : -1); + + draw_projected_view(); + + draw_static_objects(); + + sliderPoint.blit(ctx, sliderMode); + + for(let i = 0; i + + + + + + 4D donut creation + + + + + +
+ + + + + + +
+ + + + + + + \ No newline at end of file diff --git a/spline scenes/4_d_donut_creation/js/main.js b/spline scenes/4_d_donut_creation/js/main.js new file mode 100644 index 0000000..0924e08 --- /dev/null +++ b/spline scenes/4_d_donut_creation/js/main.js @@ -0,0 +1,4 @@ + + const app = new SpeRuntime.Application(); + app.start('./scene.json'); + \ No newline at end of file diff --git a/spline scenes/4_d_donut_creation/js/spline.runtime.min.js b/spline scenes/4_d_donut_creation/js/spline.runtime.min.js new file mode 100644 index 0000000..8169d98 --- /dev/null +++ b/spline scenes/4_d_donut_creation/js/spline.runtime.min.js @@ -0,0 +1,27 @@ +var SpeRuntime=function(e,t){"use strict";class r extends t.Raycaster{setFromCamera(e,t){"OrthographicCamera"===t.cameraType?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):"PerspectiveCamera"===t.cameraType?(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):console.error("Raycaster: Unsupported camera type.")}createRaycastLineHelper(){const e=new t.LineBasicMaterial({color:16711680,linewidth:10}),r=new t.Vector3(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new t.Vector3(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=(new t.Vector3).lerpVectors(r,i,.5);i.multiplyScalar(0);const s=new t.BufferGeometry;return s.setAttribute("position",new t.BufferAttribute([r.x,r.y,r.z,n.x,n.y,n.z,i.x,i.y,i.z],3)),new t.Line(s,e)}}function i(e,t,r){r.x=e.x*t.x,r.y=e.y,r.z=e.x*t.y}function n(e){return new t.Vector2(e.y,-e.x)}class s extends t.BufferGeometry{constructor(e,r,s,o,a,l,c,h,u,d,p,f,m=!1){super(),this.type="RoundedCylinderBufferGeometry",e=void 0!==e?e:1,r=void 0!==r?r:1,s=s||1,o=Math.floor(o)||8,a=Math.floor(a)||1,l=void 0!==l&&l,c=void 0!==c?c:0,h=void 0!==h?h:2*Math.PI,l&&(u=0,d=0);const g=[],v=[],y=[],A=[];let w=0;const x=s/2,b=new t.Vector3,S=new t.Vector3;m&&0==e&&(e=u),m&&0==r&&(r=d);const E=new t.Vector2(e,x),C=new t.Vector2(r,-x);let T=null,O=null,D=null,M=null,_=E.clone().sub(C),N=0,L=0,B=0;f>0&&(N=Math.min(e,r)*(1-f),L=e-N,B=r-N);const I=E.clone();I.x-=N;const P=Math.PI-_.angle(),R=_.angle(),F=Math.tan(R/2),U=Math.tan(P/2),z=F+U,k=f?z:U,G=f?z:F;if(u=Math.min(u,(e-L)/k,_.length()/z),d=Math.min(d,(r-B)/G,_.length()/z),u>0){const e=u/F;T=E.clone().sub(new t.Vector2(e,u)),f&&(D=T.clone(),D.x-=N-z*u),E.sub(_.clone().setLength(e))}if(d>0){const e=d/U;O=C.clone().sub(new t.Vector2(e,-d)),C.add(_.clone().setLength(e)),f&&(M=O.clone(),M.x-=N-z*d,I.sub(_.clone().setLength(e)))}_=E.clone().sub(C);const j=_.length()<.5,V=[];for(let p=0;p<=o;p++){const m=[],g=p/o,x=g*h+c,E=new t.Vector2(Math.sin(x),Math.cos(x));M&&O?(H(m,g,E,P,d,M,-1,!0),H(m,g,E,R,d,O,-1,!1)):O?(J(m,E,O.x,0,-1),H(m,g,E,R,d,O,-1,!1)):l||J(m,E,r,B,-1);if(i(n(_).normalize(),E,b),!j)for(let e=0;e<=a;e++){const t=e/a;i(_.clone().multiplyScalar(t).add(C),E,S),v.push(S.x,S.y,S.z),y.push(b.x,b.y,b.z),A.push(g,.5+S.y/s),m.push(w++)}if(D&&T?(H(m,g,E,P,u,T,1,!1),H(m,g,E,R,u,D,1,!0)):T?(H(m,g,E,P,u,T,1,!1),J(m,E,T.x,0,1)):l||J(m,E,e,L,1),f&&!j){i(n(_).multiplyScalar(-1).normalize(),E,b);for(let e=0;e<=a;e++){const t=e/a;i(_.clone().multiplyScalar(-t).add(I),E,S),v.push(S.x,S.y,S.z),y.push(b.x,b.y,b.z),A.push(g,.5+S.y/s),m.push(w++)}}f&&!l&&m.push(m[0]),V.push(m)}for(let e=0;eg.push(e,t,r):(e,t,r)=>g.push(e,r,t);i(new t.Vector2((e+r+L+B)/4,0),a,c),v.push(c.x,c.y,c.z),y.push(l.x,0,l.y),A.push(.5,.5);const u=w++;for(const e of s){const t=v.slice(3*e,3*e+3);v.push(...t),y.push(l.x,0,l.y);const r=A.slice(2*e,2*e+2);A.push(...r),w++}for(let e=u+1;e0?1:-1,p.push(M.x,M.y,M.z),f.push(a/v),f.push(1-t/y),O+=1}}for(let e=0;e0?(e,t,r)=>u.push(e,t,r):(e,t,r)=>u.push(e,r,t);for(let e=0;e<=c;e++){const t=[],r=o*(1-e/c),i=Math.cos(r),u=Math.sin(r);let y=0;for(let r=0;r<=e;r++){const r=Math.cos(y),c=Math.sin(y);h.x=i*r,h.y=u,h.z=i*c;const v=g.clone().addScaledVector(h,l);d.push(n*v.x,s*v.y,a*v.z),p.push(n*h.x,s*h.y,a*h.z),f.push(0,0),t.push(m++),y+=o/e}v.push(t)}const A=v.length-1;for(let e=0;e0&&(y("z","y","x",-1,-1,1,i,r,e,a,0),y("z","y","x",1,-1,-1,i,r,e,a,1),y("z","y","x",-1,1,-1,i,r,e,a,1),y("z","y","x",1,1,1,i,r,e,a,0),y("x","y","z",-1,-1,-1,e,r,i,n,0),y("x","y","z",1,-1,1,e,r,i,n,1),y("x","y","z",-1,1,1,e,r,i,n,0),y("x","y","z",1,1,-1,e,r,i,n,1),y("y","x","z",-1,-1,1,r,e,i,s,0),y("y","x","z",1,-1,-1,r,e,i,s,1),y("y","x","z",1,1,1,r,e,i,s,1),y("y","x","z",-1,1,-1,r,e,i,s,0),A(1,1,1),A(-1,1,1),A(1,-1,1),A(-1,-1,1),A(1,1,-1),A(-1,1,-1),A(1,-1,-1),A(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new t.Float32BufferAttribute(d,3)),this.setAttribute("normal",new t.Float32BufferAttribute(p,3)),this.setAttribute("uv",new t.Float32BufferAttribute(f,2))}}const l=1e-12;class c{constructor(e){this.position=new t.Vector2,this.startPosition=new t.Vector2,this.uuid=t.MathUtils.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new c(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}}class h extends c{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new h(this.parent).copy(this)}}class u extends c{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new h(this),new h(this))}getOppositeControl(e){const t=this.controls.indexOf(e);return 0===t?this.controls[1]:1===t?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let r=0,i=this.controls.length;rMath.PI&&(u*=-1),h=x(c,a)?(a+c)*(i/u-.5)*8/3/(o-l):(o+l)*(i/u-.5)*8/3/(c-a),n.set(t.x-h*a,t.y+h*o),s.set(r.x+h*c,r.y-h*l),[n,s]}function O(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function D(e,t=12,r=!1){const i=[];for(let n=0,s=e.length;n0&&(i[n-1]+=e),o+=e}void 0!==s.curveAfter&&(o+=M(s.curveAfter,t)),i.push(o)}return e.length>0&&r&&void 0!==e[0].roundedCurveCorner&&(i[e.length-1]+=.5*M(e[0].roundedCurveCorner,t)),i}function M(e,r=12){return e&&e instanceof t.EllipseCurve?2*r:e&&(e instanceof t.LineCurve||e instanceof t.LineCurve3)?1:e&&e instanceof t.SplineCurve?r*e.points.length:r}const _=new t.Vector2,N=new t.Vector2,L=new t.Vector2,B=new t.Vector2,I=new t.Vector2,P=new t.Vector2;class R extends t.Shape{constructor(e=100,r=100){super(),this.points=[],this.shapeHoles=[],this.eventDispatcher=new t.EventDispatcher,this.plane=new t.Plane(new t.Vector3(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=t.MathUtils.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,r=this.points.length;t0)for(let t=0,r=this.shapeHoles.length;t=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let r=0,i=this.shapeHoles.length;r=0)return t+n;t+=i.points.length}return-1}getAllPoints(){const e=[].concat(...this.shapeHoles.map((e=>e.points)));return[...this.points,...e]}applySize(e,t){0===e&&(e=.001),0===t&&(t=.001),this.applyScale(e/this.width,t/this.height),this._width=e,this._height=t}applyScale(e,t){const r=_.set(e,t);for(let e=0,t=this.points.length;e=0&&this.points.splice(t,1),this.needsUpdate=!0}update(e=!0){for(let e=0,t=this.shapeHoles.length;e1&&(e.getX(a-1)!==e.getX(0)||e.getY(a-1)!==e.getY(0)||e.getZ(a-1)!==e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++)}(e,i?this.roundedCurves:this.curves,r,this.autoClose),n.reduce(((e,t)=>e+t),0)+1}computeCurveDivisions(e=12){this.curveDivisions=D(this.points,e,!1),this.roundedCurveDivisions=D(this.points,e,!0)}extractFilteredShapePointsToBuffer(e,r,i=12){return 2*function(e,r,i,n=12,s=!0){const o=A.set(0,0,0);let a=0;const l=[];for(let s=0;s1&&(e.getX(a-1)!==e.getX(0)||e.getY(a-1)!==e.getY(0)||e.getZ(a-1)!==e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++),l}(e,this.curves,r,i,this.autoClose).reduce(((e,t)=>e+t),0)}extractShapePointsToFlatArray(e,r=12){return this.subdivision=r,void 0===this.curveDivisions&&this.computeCurveDivisions(r),function(e,r,i=12,n=!0){let s,o=0;for(let n=0;n1)||x(e[o-1],e[1],l)&&x(e[o-2],e[0],l)||(e.push(e[0],e[1]),o++),e}(e,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let r=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);const i=t?this.roundedCurveDivisions:this.curveDivisions;let n=0;t&&void 0!==this.points[0].roundedCurveCorner&&(n=.5*M(this.points[0].roundedCurveCorner,this.subdivision));let s=e-n;s<0&&(s+=i.reduce(((e,t)=>e+t),0));for(let e=0,t=i.length;e=this.points.length-1?0:e+1],s=this.curveDivisions,o=s[e];if(O(i,n)){const e=i.position.distanceTo(n.position);return i.position.distanceTo(_.set(r.x,r.y))/e}let a=0;for(let t=0;t2){let e=0;for(let r=0,i=this.points.length;r0){const l=i.curveBefore,c=i.curveAfter;if(void 0===l||void 0===c)continue;const h=i.roundedCurveBefore,u=i.roundedCurveAfter,d=l.getLength(),p=c.getLength(),f=Math.min(a,.499*d),m=Math.min(a,.499*p),g=Math.min(f,m),v=1-g/d,y=g/p,A=l.getPointAt(v,_),w=c.getPointAt(y,N);let x;if(this._subSplitCurve(l,h,v,A,void 0),this._subSplitCurve(c,u,y,void 0,w),this.useCubicForRoundedCorners){const e=E(A,i.position,w)/2,r=Math.tan(e)*A.distanceTo(i.position),[a,l]=C(A,w,r,L,B),c=(n=a,s=l,o=i.position,n.distanceTo(o)e.clone())),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e}toJSON(){return{points:this.points.reduce(((e,t)=>e.concat(t.toJSON())),[]),shapeHoles:this.shapeHoles.map((e=>e.toJSON())),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){var r;this.points=[],this.pointIDs=0;const i=e.points.length/7;for(let r=0;r{const t=new R;return t.fromJSON(e),t})):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e){const r=(e,r)=>{r instanceof t.CubicBezierCurve&&r.v3.equals(e.position)&&e.controls[0].position.copy(r.v2)};return this.points=(e=>{const i=[];let n,s;for(n=0,s=e.length;n0?e[n-1]:null;let a;s instanceof t.CubicBezierCurve?(a=this.createPoint(s.v0),a.controls[1].position.copy(s.v1)):s instanceof t.LineCurve&&(a=this.createPoint(s.v1)),void 0!==a&&(null!==o&&r(a,o),i.push(a))}const o=e[e.length-1];let a=!1;return o instanceof t.CubicBezierCurve?o.v3.equals(i[0].position)&&(i[0].controls[0].position.copy(o.v2),a=!0):o instanceof t.LineCurve&&o.v2.equals(i[0].position)&&(a=!0),this.isClosed=a,i})(e.curves),e instanceof t.Shape&&(this.shapeHoles=e.holes.map((e=>{const t=new R;return t.fromShape(e),t}))),this.update(),this}}const F=2*Math.PI;function U({x:e,y:t},r,i,n,s){return{x:e*r+n,y:t*i+s}}function z(e,t){const r=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:4/3*Math.tan(t/4),i=Math.cos(e),n=Math.sin(e),s=Math.cos(e+t),o=Math.sin(e+t);return[{x:i-n*r,y:n+i*r},{x:s+o*r,y:o-s*r},{x:s,y:o}]}function k(e,t,r,i){const n=e*i-t*r<0?-1:1,s=Math.min(1,Math.max(-1,e*r+t*i));return n*Math.acos(s)}function G({px:e,py:t,cx:r,cy:i,rx:n,ry:s,largeArcFlag:o,sweepFlag:a}){const l=[];if(0===n||0===s)return[];const c=(e-r)/2,h=(t-i)/2;if(0===c&&0===h)return[];n=Math.abs(n),s=Math.abs(s);const u=Math.pow(c,2)/Math.pow(n,2)+Math.pow(h,2)/Math.pow(s,2);u>1&&(n*=Math.sqrt(u),s*=Math.sqrt(u));const d=function(e,t,r,i,n,s,o,a,l,c){const h=Math.pow(n,2),u=Math.pow(s,2),d=Math.pow(o,2),p=Math.pow(a,2);let f=h*u-h*p-u*d;f<0&&(f=0),f/=h*p+u*d,f=Math.sqrt(f)*(l===c?-1:1);const m=f*n/s*a,g=f*-s/n*o,v=m+(e+r)/2,y=g+(t+i)/2,A=(o-m)/n,w=(a-g)/s,x=(-o-m)/n,b=(-a-g)/s,S=k(1,0,A,w);let E=k(A,w,x,b);return!c&&E>0&&(E-=F),c&&E<0&&(E+=F),{centerx:v,centery:y,ang1:S,ang2:E}}(e,t,r,i,n,s,c,h,o,a);let{ang1:p,ang2:f}=d;const{centerx:m,centery:g}=d;let v=Math.abs(f)/(F/4);Math.abs(1-v)<1e-7&&(v=1);const y=Math.max(Math.ceil(v),1);f/=y;for(let e=0;e{const{x:t,y:r}=U(e[0],n,s,m,g),{x:i,y:o}=U(e[1],n,s,m,g),{x:a,y:l}=U(e[2],n,s,m,g);return{x1:t,y1:r,x2:i,y2:o,x:a,y:l}}))}var j,V;function H(e,t){if(!e)throw t||"Assertion Failed!"}!function(e){e[e.ODD=0]="ODD",e[e.NONZERO=1]="NONZERO",e[e.POSITIVE=2]="POSITIVE",e[e.NEGATIVE=3]="NEGATIVE",e[e.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"}(j||(j={})),function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(V||(V={}));var J=function(){function e(){}return e.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},e.vertLeq=function(e,t){return e.s0?n0?(r.t-i.t)*n+(r.t-t.t)*s:0},e.transEval=function(t,r,i){H(e.transLeq(t,r)&&e.transLeq(r,i));var n=r.t-t.t,s=i.t-r.t;return n+s>0?n0?(r.s-i.s)*n+(r.s-t.s)*s:0},e.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},e.interpolate=function(e,t,r,i){return(e=e<0?0:e)<=(r=r<0?0:r)?0===r?(t+i)/2:t+e/(e+r)*(i-t):i+r/(e+r)*(t-i)},e.intersect=function(t,r,i,n,s){var o,a,l;e.vertLeq(t,r)||(l=t,t=r,r=l),e.vertLeq(i,n)||(l=i,i=n,n=l),e.vertLeq(t,i)||(l=t,t=i,i=l,l=r,r=n,n=l),e.vertLeq(i,r)?e.vertLeq(r,n)?((o=e.edgeEval(t,i,r))+(a=e.edgeEval(i,r,n))<0&&(o=-o,a=-a),s.s=e.interpolate(o,i.s,a,r.s)):((o=e.edgeSign(t,i,r))+(a=-e.edgeSign(t,n,r))<0&&(o=-o,a=-a),s.s=e.interpolate(o,i.s,a,n.s)):s.s=(i.s+r.s)/2,e.transLeq(t,r)||(l=t,t=r,r=l),e.transLeq(i,n)||(l=i,i=n,n=l),e.transLeq(t,i)||(l=t,t=i,i=l,l=r,r=n,n=l),e.transLeq(i,r)?e.transLeq(r,n)?((o=e.transEval(t,i,r))+(a=e.transEval(i,r,n))<0&&(o=-o,a=-a),s.t=e.interpolate(o,i.t,a,r.t)):((o=e.transSign(t,i,r))+(a=-e.transSign(t,n,r))<0&&(o=-o,a=-a),s.t=e.interpolate(o,i.t,a,n.t)):s.t=(i.t+r.t)/2},e}(),Q=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Y=function(){function e(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),e}(),W=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},X=function(){function e(){var e=new W,t=new Q,r=new Y(0),i=new Y(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=i,i.next=i,i.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=i}return e.prototype.makeEdge_=function(e){var t=new Y(0),r=new Y(1);e.Sym.sidethis.size||this.leq(s[t].key,s[r].key)){n[e].handle=t,s[t].node=e;break}n[e].handle=r,s[r].node=e,e=i}},e.prototype.floatUp_=function(e){var t,r,i,n=this.nodes,s=this.handles;for(t=n[e].handle;;){if(r=n[i=e>>1].handle,0===i||this.leq(s[r].key,s[t].key)){n[e].handle=t,s[t].node=e;break}n[e].handle=r,s[r].node=e,e=i}},e.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(e){var t,r;if(2*(t=++this.size)>this.max){var i,n;for(this.max*=2,n=this.nodes.length,this.nodes.length=this.max+1,i=n;i0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),i},e.prototype.delete=function(e){var t,r=this.nodes,i=this.handles;H(e>=1&&e<=this.max&&null!==i[e].key),r[t=i[e].node].handle=r[this.size].handle,i[r[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(i[r[t>>1].handle].key,i[r[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),i[e].key=null,i[e].node=this.freeList,this.freeList=e},e}(),$=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},ee=function(){this.key=null,this.next=null,this.prev=null},te=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new ee,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(e){return this.insertBefore(this.head,e)},e.prototype.search=function(e){var t=this.head;do{t=t.next}while(null!==t.key&&!this.leq(this.frame,e,t.key));return t},e.prototype.insertBefore=function(e,t){do{e=e.prev}while(null!==e.key&&!this.leq(this.frame,e.key,t));var r=new ee;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},e.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},e}(),re=function(){function e(){}return e.regionBelow=function(e){return e.nodeUp.prev.key},e.regionAbove=function(e){return e.nodeUp.next.key},e.debugEvent=function(e){},e.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.edgeLeq=function(e,t,r){var i=e.event,n=t.eUp,s=r.eUp;return n.Dst===i?s.Dst===i?J.vertLeq(n.Org,s.Org)?J.edgeSign(s.Dst,n.Org,s.Org)<=0:J.edgeSign(n.Dst,s.Org,n.Org)>=0:J.edgeSign(s.Dst,i,s.Org)<=0:s.Dst===i?J.edgeSign(n.Dst,i,n.Org)>=0:J.edgeEval(n.Dst,i,n.Org)>=J.edgeEval(s.Dst,i,s.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&H(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,r){H(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},e.topLeftRegion=function(t,r){var i,n=r.eUp.Org;do{r=e.regionAbove(r)}while(r.eUp.Org===n);if(r.fixUpperEdge){if(null===(i=t.mesh.connect(e.regionBelow(r).eUp.Sym,r.eUp.Lnext)))return null;e.fixUpperEdge(t,r,i),r=e.regionAbove(r)}return r},e.topRightRegion=function(t){var r=t.eUp.Dst;do{t=e.regionAbove(t)}while(t.eUp.Dst===r);return t},e.addRegionBelow=function(e,t,r){var i=new $;return i.eUp=r,i.nodeUp=e.dict.insertBefore(t.nodeUp,i),i.fixUpperEdge=!1,i.sentinel=!1,i.dirty=!1,r.activeRegion=i,i},e.isWindingInside=function(e,t){switch(e.windingRule){case j.ODD:return 0!=(1&t);case j.NONZERO:return 0!==t;case j.POSITIVE:return t>0;case j.NEGATIVE:return t<0;case j.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(t,r){r.windingNumber=e.regionAbove(r).windingNumber+r.eUp.winding,r.inside=e.isWindingInside(t,r.windingNumber)},e.finishRegion=function(t,r){var i=r.eUp,n=i.Lface;n.inside=r.inside,n.anEdge=i,e.deleteRegion(t,r)},e.finishLeftRegions=function(t,r,i){for(var n,s=null,o=r,a=r.eUp;o!==i;){if(o.fixUpperEdge=!1,(n=(s=e.regionBelow(o)).eUp).Org!=a.Org){if(!s.fixUpperEdge){e.finishRegion(t,o);break}n=t.mesh.connect(a.Lprev,n.Sym),e.fixUpperEdge(t,s,n)}a.Onext!==n&&(t.mesh.splice(n.Oprev,n),t.mesh.splice(a,n)),e.finishRegion(t,o),a=s.eUp,o=s}return a},e.addRightEdges=function(t,r,i,n,s,o){var a,l,c,h,u=!0;c=i;do{H(J.vertLeq(c.Org,c.Dst)),e.addRegionBelow(t,r,c.Sym),c=c.Onext}while(c!==n);for(null===s&&(s=e.regionBelow(r).eUp.Rprev),l=r,h=s;(c=(a=e.regionBelow(l)).eUp.Sym).Org===h.Org;)c.Onext!==h&&(t.mesh.splice(c.Oprev,c),t.mesh.splice(h.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=e.isWindingInside(t,a.windingNumber),l.dirty=!0,!u&&e.checkForRightSplice(t,l)&&(e.addWinding(c,h),e.deleteRegion(t,l),t.mesh.delete(h)),u=!1,l=a,h=c;l.dirty=!0,H(l.windingNumber-c.winding===a.windingNumber),o&&e.walkDirtyRegions(t,l)},e.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},e.vertexWeights=function(e,t,r){var i=J.vertL1dist(t,e),n=J.vertL1dist(r,e),s=.5*n/(i+n),o=.5*i/(i+n);e.coords[0]+=s*t.coords[0]+o*r.coords[0],e.coords[1]+=s*t.coords[1]+o*r.coords[1],e.coords[2]+=s*t.coords[2]+o*r.coords[2]},e.getIntersectData=function(t,r,i,n,s,o){r.coords[0]=r.coords[1]=r.coords[2]=0,r.idx=-1,e.vertexWeights(r,i,n),e.vertexWeights(r,s,o)},e.checkForRightSplice=function(t,r){var i=e.regionBelow(r),n=r.eUp,s=i.eUp;if(J.vertLeq(n.Org,s.Org)){if(J.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;J.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(t.pq.delete(n.Org.pqHandle),e.spliceMergeVertices(t,s.Oprev,n)):(t.mesh.splitEdge(s.Sym),t.mesh.splice(n,s.Oprev),r.dirty=i.dirty=!0)}else{if(J.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;e.regionAbove(r).dirty=r.dirty=!0,t.mesh.splitEdge(n.Sym),t.mesh.splice(s.Oprev,n)}return!0},e.checkForLeftSplice=function(t,r){var i,n=e.regionBelow(r),s=r.eUp,o=n.eUp;if(H(!J.vertEq(s.Dst,o.Dst)),J.vertLeq(s.Dst,o.Dst)){if(J.edgeSign(s.Dst,o.Dst,s.Org)<0)return!1;e.regionAbove(r).dirty=r.dirty=!0,i=t.mesh.splitEdge(s),t.mesh.splice(o.Sym,i),i.Lface.inside=r.inside}else{if(J.edgeSign(o.Dst,s.Dst,o.Org)>0)return!1;r.dirty=n.dirty=!0,i=t.mesh.splitEdge(o),t.mesh.splice(s.Lnext,o.Sym),i.Rface.inside=r.inside}return!0},e.checkForIntersect=function(t,r){var i,n,s=e.regionBelow(r),o=r.eUp,a=s.eUp,l=o.Org,c=a.Org,h=o.Dst,u=a.Dst,d=new W;if(H(!J.vertEq(u,h)),H(J.edgeSign(h,t.event,l)<=0),H(J.edgeSign(u,t.event,c)>=0),H(l!==t.event&&c!==t.event),H(!r.fixUpperEdge&&!s.fixUpperEdge),l===c)return!1;if(Math.min(l.t,h.t)>Math.max(c.t,u.t))return!1;if(J.vertLeq(l,c)){if(J.edgeSign(u,l,c)>0)return!1}else if(J.edgeSign(h,c,l)<0)return!1;return e.debugEvent(t),J.intersect(h,l,u,c,d),H(Math.min(l.t,h.t)<=d.t),H(d.t<=Math.max(c.t,u.t)),H(Math.min(u.s,h.s)<=d.s),H(d.s<=Math.max(c.s,l.s)),J.vertLeq(d,t.event)&&(d.s=t.event.s,d.t=t.event.t),i=J.vertLeq(l,c)?l:c,J.vertLeq(i,d)&&(d.s=i.s,d.t=i.t),J.vertEq(d,l)||J.vertEq(d,c)?(e.checkForRightSplice(t,r),!1):!J.vertEq(h,t.event)&&J.edgeSign(h,t.event,d)>=0||!J.vertEq(u,t.event)&&J.edgeSign(u,t.event,d)<=0?u===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(a.Sym,o),r=e.topLeftRegion(t,r),o=e.regionBelow(r).eUp,e.finishLeftRegions(t,e.regionBelow(r),s),e.addRightEdges(t,r,o.Oprev,o,o,!0),!0):h===t.event?(t.mesh.splitEdge(a.Sym),t.mesh.splice(o.Lnext,a.Oprev),s=r,r=e.topRightRegion(r),n=e.regionBelow(r).eUp.Rprev,s.eUp=a.Oprev,a=e.finishLeftRegions(t,s,null),e.addRightEdges(t,r,a.Onext,o.Rprev,n,!0),!0):(J.edgeSign(h,t.event,d)>=0&&(e.regionAbove(r).dirty=r.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),J.edgeSign(u,t.event,d)<=0&&(r.dirty=s.dirty=!0,t.mesh.splitEdge(a.Sym),a.Org.s=t.event.s,a.Org.t=t.event.t),!1):(t.mesh.splitEdge(o.Sym),t.mesh.splitEdge(a.Sym),t.mesh.splice(a.Oprev,o),o.Org.s=d.s,o.Org.t=d.t,o.Org.pqHandle=t.pq.insert(o.Org),e.getIntersectData(t,o.Org,l,h,c,u),e.regionAbove(r).dirty=r.dirty=s.dirty=!0,!1)},e.walkDirtyRegions=function(t,r){for(var i,n,s=e.regionBelow(r);;){for(;s.dirty;)r=s,s=e.regionBelow(s);if(!r.dirty&&(s=r,null===(r=e.regionAbove(r))||!r.dirty))return;if(r.dirty=!1,i=r.eUp,n=s.eUp,i.Dst!==n.Dst&&e.checkForLeftSplice(t,r)&&(s.fixUpperEdge?(e.deleteRegion(t,s),t.mesh.delete(n),n=(s=e.regionBelow(r)).eUp):r.fixUpperEdge&&(e.deleteRegion(t,r),t.mesh.delete(i),i=(r=e.regionAbove(s)).eUp)),i.Org!==n.Org)if(i.Dst===n.Dst||r.fixUpperEdge||s.fixUpperEdge||i.Dst!==t.event&&n.Dst!==t.event)e.checkForRightSplice(t,r);else if(e.checkForIntersect(t,r))return;i.Org===n.Org&&i.Dst===n.Dst&&(e.addWinding(n,i),e.deleteRegion(t,r),t.mesh.delete(i),r=e.regionAbove(s))}},e.connectRightVertex=function(t,r,i){var n,s=i.Onext,o=e.regionBelow(r),a=r.eUp,l=o.eUp,c=!1;a.Dst!==l.Dst&&e.checkForIntersect(t,r),J.vertEq(a.Org,t.event)&&(t.mesh.splice(s.Oprev,a),r=e.topLeftRegion(t,r),s=e.regionBelow(r).eUp,e.finishLeftRegions(t,e.regionBelow(r),o),c=!0),J.vertEq(l.Org,t.event)&&(t.mesh.splice(i,l.Oprev),i=e.finishLeftRegions(t,o,null),c=!0),c?e.addRightEdges(t,r,i.Onext,s,s,!0):(n=J.vertLeq(l.Org,a.Org)?l.Oprev:a,n=t.mesh.connect(i.Lprev,n),e.addRightEdges(t,r,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,r))},e.connectLeftDegenerate=function(t,r,i){var n,s,o,a,l;return n=r.eUp,J.vertEq(n.Org,i)?(H(!1),void e.spliceMergeVertices(t,n,i.anEdge)):J.vertEq(n.Dst,i)?(H(!1),r=e.topRightRegion(r),s=a=(o=(l=e.regionBelow(r)).eUp.Sym).Onext,l.fixUpperEdge&&(H(s!==o),e.deleteRegion(t,l),t.mesh.delete(o),o=s.Oprev),t.mesh.splice(i.anEdge,o),J.edgeGoesLeft(s)||(s=null),void e.addRightEdges(t,r,o.Onext,a,s,!0)):(t.mesh.splitEdge(n.Sym),r.fixUpperEdge&&(t.mesh.delete(n.Onext),r.fixUpperEdge=!1),t.mesh.splice(i.anEdge,n),void e.sweepEvent(t,i))},e.connectLeftVertex=function(t,r){var i,n,s,o,a,l,c=new $;if(c.eUp=r.anEdge.Sym,i=t.dict.search(c).key,n=e.regionBelow(i))if(o=i.eUp,a=n.eUp,0!==J.edgeSign(o.Dst,r,o.Org))if(s=J.vertLeq(a.Dst,o.Dst)?i:n,i.inside||s.fixUpperEdge){if(s===i)l=t.mesh.connect(r.anEdge.Sym,o.Lnext);else l=t.mesh.connect(a.Dnext,r.anEdge).Sym;s.fixUpperEdge?e.fixUpperEdge(t,s,l):e.computeWinding(t,e.addRegionBelow(t,i,l)),e.sweepEvent(t,r)}else e.addRightEdges(t,i,r.anEdge,r.anEdge,null,!0);else e.connectLeftDegenerate(t,i,r)},e.sweepEvent=function(t,r){t.event=r,e.debugEvent(t);for(var i=r.anEdge;null===i.activeRegion;)if((i=i.Onext)===r.anEdge)return void e.connectLeftVertex(t,r);var n=e.topLeftRegion(t,i.activeRegion);H(null!==n);var s=e.regionBelow(n),o=s.eUp,a=e.finishLeftRegions(t,s,null);a.Onext===o?e.connectRightVertex(t,n,a):e.addRightEdges(t,n,a.Onext,o,o,!0)},e.addSentinel=function(e,t,r,i){var n=new $,s=e.mesh.makeEdge();s.Org.s=r,s.Org.t=i,s.Dst.s=t,s.Dst.t=i,e.event=s.Dst,n.eUp=s,n.windingNumber=0,n.inside=!1,n.fixUpperEdge=!1,n.sentinel=!0,n.dirty=!1,n.nodeUp=e.dict.insert(n)},e.initEdgeDict=function(t){t.dict=new te(t,e.edgeLeq);var r=t.bmax[0]-t.bmin[0],i=t.bmax[1]-t.bmin[1],n=t.bmin[0]-r,s=t.bmax[0]+r,o=t.bmin[1]-i,a=t.bmax[1]+i;e.addSentinel(t,n,s,o),e.addSentinel(t,n,s,a)},e.doneEdgeDict=function(t){for(var r,i=0;null!==(r=t.dict.min().key);)r.sentinel||(H(r.fixUpperEdge),H(1==++i)),H(0===r.windingNumber),e.deleteRegion(t,r)},e.removeDegenerateEdges=function(t){var r,i,n,s=t.mesh.eHead;for(r=s.next;r!==s;r=i)i=r.next,n=r.Lnext,J.vertEq(r.Org,r.Dst)&&r.Lnext.Lnext!==r&&(e.spliceMergeVertices(t,n,r),t.mesh.delete(r),n=(r=n).Lnext),n.Lnext===r&&(n!==r&&(n!==i&&n!==i.Sym||(i=i.next),t.mesh.delete(n)),r!==i&&r!==i.Sym||(i=i.next),t.mesh.delete(r))},e.initPriorityQ=function(e){var t,r,i,n=0;for(r=(i=e.mesh.vHead).next;r!==i;r=r.next)n++;for(n+=8,t=e.pq=new Z(n,J.vertLeq),r=(i=e.mesh.vHead).next;r!==i;r=r.next)r.pqHandle=t.insert(r);return r===i&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,r){var i,n,s;for(i=r.fHead.next;i!==r.fHead;i=n)n=i.next,H((s=i.anEdge).Lnext!==s),s.Lnext.Lnext===s&&(e.addWinding(s.Onext,s),t.mesh.delete(s));return!0},e.computeInterior=function(t,r){var i,n;if(void 0===r&&(r=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(i=t.pq.extractMin());){for(;null!==(n=t.pq.min())&&J.vertEq(n,i);)n=t.pq.extractMin(),e.spliceMergeVertices(t,i.anEdge,n.anEdge);e.sweepEvent(t,i)}return t.event=t.dict.min().key.eUp.Org,e.debugEvent(t),e.doneEdgeDict(t),e.donePriorityQ(t),!!e.removeDegenerateFaces(t,t.mesh)&&(r&&t.mesh.check(),!0)},e}(),ie=function(){function e(){this.mesh=new X,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=j.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},e.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},e.prototype.computeNormal_=function(e){var t,r,i,n,s,o,a=[0,0,0],l=[0,0,0],c=[0,0,0],h=[0,0,0],u=[0,0,0],d=[null,null,null],p=[null,null,null],f=this.mesh.vHead;t=f.next;for(var m=0;m<3;++m)n=t.coords[m],l[m]=n,p[m]=t,a[m]=n,d[m]=t;for(t=f.next;t!==f;t=t.next)for(var g=0;g<3;++g)(n=t.coords[g])a[g]&&(a[g]=n,d[g]=t);var v=0;if(a[1]-l[1]>a[0]-l[0]&&(v=1),a[2]-l[2]>a[v]-l[v]&&(v=2),l[v]>=a[v])return e[0]=0,e[1]=0,void(e[2]=1);for(o=0,r=p[v],i=d[v],c[0]=r.coords[0]-i.coords[0],c[1]=r.coords[1]-i.coords[1],c[2]=r.coords[2]-i.coords[2],t=f.next;t!==f;t=t.next)h[0]=t.coords[0]-i.coords[0],h[1]=t.coords[1]-i.coords[1],h[2]=t.coords[2]-i.coords[2],u[0]=c[1]*h[2]-c[2]*h[1],u[1]=c[2]*h[0]-c[0]*h[2],u[2]=c[0]*h[1]-c[1]*h[0],(s=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>o&&(o=s,e[0]=u[0],e[1]=u[1],e[2]=u[2]);o<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(c)]=1)},e.prototype.checkOrientation_=function(){for(var e,t,r=this.mesh.fHead,i=this.mesh.vHead,n=0,s=r.next;s!==r;s=s.next)if(!((t=s.anEdge).winding<=0))do{n+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext}while(t!==s.anEdge);if(n<0){for(e=i.next;e!==i;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var e,t,r=this.mesh.vHead,i=[0,0,0],n=!1;i[0]=this.normal[0],i[1]=this.normal[1],i[2]=this.normal[2],i[0]||i[1]||i[2]||(this.computeNormal_(i),n=!0),e=this.sUnit,t=this.tUnit;var s=this.longAxis_(i);e[s]=0,e[(s+1)%3]=1,e[(s+2)%3]=0,t[s]=0,t[(s+1)%3]=0,t[(s+2)%3]=i[s]>0?1:-1;for(var o=r.next;o!==r;o=o.next)o.s=this.dot_(o.coords,e),o.t=this.dot_(o.coords,t);n&&this.checkOrientation_();for(var a=!0,l=r.next;l!==r;l=l.next)a?(this.bmin[0]=this.bmax[0]=l.s,this.bmin[1]=this.bmax[1]=l.t,a=!1):(l.sthis.bmax[0]&&(this.bmax[0]=l.s),l.tthis.bmax[1]&&(this.bmax[1]=l.t))},e.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.prototype.tessellateMonoRegion_=function(e,t){var r,i;if((r=t.anEdge).Lnext===r||r.Lnext.Lnext===r)throw"Mono region invalid";for(;J.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;J.vertLeq(r.Org,r.Dst);r=r.Lnext);i=r.Lprev;for(;r.Lnext!==i;)if(J.vertLeq(r.Dst,i.Org)){for(;i.Lnext!==r&&(J.edgeGoesLeft(i.Lnext)||J.edgeSign(i.Org,i.Dst,i.Lnext.Dst)<=0);)i=e.connect(i.Lnext,i).Sym;i=i.Lprev}else{for(;i.Lnext!==r&&(J.edgeGoesRight(r.Lprev)||J.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)r=e.connect(r,r.Lprev).Sym;r=r.Lnext}if(i.Lnext===r)throw"Mono region invalid";for(;i.Lnext.Lnext!==r;)i=e.connect(i.Lnext,i).Sym;return!0},e.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},e.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},e.prototype.setWindingNumber_=function(e,t,r){for(var i,n=e.eHead.next;n!==e.eHead;n=i)i=n.next,n.Rface.inside!==n.Lface.inside?n.winding=n.Lface.inside?t:-t:r?e.delete(n):n.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,r,i){var n,s,o=0,a=0;r>3&&e.mergeConvexFaces(r);for(var l=e.vHead.next;l!==e.vHead;l=l.next)l.n=-1;for(var c=e.fHead.next;c!==e.fHead;c=c.next)if(c.n=-1,c.inside){n=c.anEdge,s=0;do{-1===(l=n.Org).n&&(l.n=a,a++),s++,n=n.Lnext}while(n!==c.anEdge);if(s>r)throw"Face vertex greater that support polygon";c.n=o,++o}this.elementCount=o,t===V.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*i,this.vertexIndices=[],this.vertexIndices.length=a;for(l=e.vHead.next;l!==e.vHead;l=l.next)if(-1!==l.n){var h=l.n*i;this.vertices[h+0]=l.coords[0],this.vertices[h+1]=l.coords[1],i>2&&(this.vertices[h+2]=l.coords[2]),this.vertexIndices[l.n]=l.idx}var u=0;for(c=e.fHead.next;c!==e.fHead;c=c.next)if(c.inside){n=c.anEdge,s=0;do{l=n.Org;this.elements[u++]=l.n,s++,n=n.Lnext}while(n!==c.anEdge);for(var d=s;d2&&(this.vertices[a++]=r.Org.coords[2]),this.vertexIndices[l++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,s++,r=r.Lnext}while(r!==i);this.elements[c++]=n,this.elements[c++]=s,n+=s}},e.prototype.addContour=function(e,t){null===this.mesh&&(this.mesh=new X),e<2&&(e=2),e>3&&(e=3);for(var r=null,i=0;i2?t[i+2]:0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(e,t,r,i,n,s){if(void 0===e&&(e=j.ODD),void 0===t&&(t=V.POLYGONS),void 0===s&&(s=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,n&&(this.normal[0]=n[0],this.normal[1]=n[1],this.normal[2]=n[2]),this.windingRule=e,i<2&&(i=2),i>3&&(i=3),!this.mesh)return!1;this.projectPolygon_(),re.computeInterior(this,s);var o=this.mesh;return t===V.BOUNDARY_CONTOURS?this.setWindingNumber_(o,1,!0):this.tessellateInterior_(o),s&&o.check(),t===V.BOUNDARY_CONTOURS?this.outputContours_(o,i):this.outputPolymesh_(o,t,r,i),!0},e}();function ne(e){var t=e.windingRule,r=void 0===t?j.ODD:t,i=e.elementType,n=void 0===i?V.POLYGONS:i,s=e.polySize,o=void 0===s?3:s,a=e.vertexSize,l=void 0===a?2:a,c=e.normal,h=void 0===c?[0,0,1]:c,u=e.contours,d=void 0===u?[]:u,p=e.strict,f=void 0===p||p,m=e.debug,g=void 0!==m&&m;if(!d&&f)throw new Error("Contours can't be empty");if(d){var v=new ie;e.edgeCreateCallback&&(v.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(v.vertexIdCallback=e.vertexIdCallback);for(var y=0;ye.extractShapePointsToFlatArray([],this._curveSegments)));let r,i,n,s=!0,o=!0;for(let t=0,r=e.length/2;tt&&(t=a),ln&&(n=l)}const s=t-e,o=n-i;for(let t=0,n=r.vertexCount;tthis._maxDrawCount}}class oe{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);const r=e*oe.eSize;this.buffer=new ArrayBuffer(r);const i=Float32Array.BYTES_PER_ELEMENT;let n=0;this.positions=new Float32Array(this.buffer,n*i,3*e),n+=3*e,this.normals=new Float32Array(this.buffer,n*i,3*e),n+=3*e,this.uvs=new Float32Array(this.buffer,n*i,2*e)}realloc(e,t=!1){if(ethis.capacity){let e=this.capacity;for(;t>e;)e*=2;this.realloc(e)}const r=this.size;return this.size=t,r}reserve(e){const t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} → ${this.size}`),this.realloc(this.size,!0)}}oe.eSize=8*Float32Array.BYTES_PER_ELEMENT;const ae=(e,t)=>([r,i])=>(i=r?e:e+t)<=i);class le extends t.BufferGeometry{constructor(e,r,i=0,n=12,s=3){super(),this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=r,i<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(i,r/2-1e-12),this._bevelSegments=Math.floor(s));const o=this._shape.extractShapePointsToFlatArray([],n),a=this._shape.shapeHoles.map((e=>e.extractShapePointsToFlatArray([],n))),l=ne({windingRule:j.ODD,elementType:V.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o,...a]});if(!l)throw new Error("error generating geometry");let c=1/0,h=-1/0,u=1/0,d=-1/0;for(let e=0,t=l.vertexCount;eh&&(h=r),id&&(d=i)}this._minX=c,this._minY=u,this._width=h-c,this._height=d-u;const p=2*l.vertexCount*(2+this._bevelSegments);this._buffer=new oe(p);const f=[];for(let e=0,t=l.elementCount;e0;const b=l.vertexIndices[c];if(Array.isArray(b))o.continuous[e]=!1;else{const[t,r]=this._shape.getCurveIndexFromVertexId(b-1,!0);if(r>0&&r<1)o.continuous[e]=!0;else{let i=1===r?t+1:t-1;i=(i+d)%d;const n=1===r?0:1,s=this._shape.roundedCurves[t].getTangent(r),a=this._shape.roundedCurves[i].getTangent(n);o.continuous[e]=s.dot(a)>.95}}[h,c,u]=[c,u,u+1],u>=s&&(u-=i)}while(u!==r+1);const p=[];p.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*r,2*s),vertexCount:i,vertexIndices:new Array(i).fill(!0).map(((e,t)=>[t,t])),elements:[0,i],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*r,2*s)});for(let e=1;e<=this._bevelSegments;e++){const t=e/this._bevelSegments*Math.PI/2,r=(1-Math.cos(t))*this._bevelSize,s=[],a=[],c=[],h=[];let u=0;for(let e=0;et&&(i-=2*Math.PI);const a=i-t;if(o.continuous[e]){const i=t+a/2,n=Math.cos(i)*r,o=Math.sin(i)*r;s[2*u+0]=p+n,s[2*u+1]=f+o,h[u]=e,u++}else{const i=Math.max(1,Math.floor(n/4*Math.abs(a)/Math.PI));for(let n=0;n<=i;n++){const o=t+a*(n/i),l=Math.cos(o)*r,c=Math.sin(o)*r;s[2*u+0]=p+l,s[2*u+1]=f+c,h[u]=e,u++}}}else s[2*u+0]=p+m,s[2*u+1]=f+g,h[u]=e,a[e]=u,u++,s[2*u+0]=p,s[2*u+1]=f,h[u]=e,u++,s[2*u+0]=p+v,s[2*u+1]=f+y,h[u]=e,c[e]=u,u++}const d=ne({windingRule:j.POSITIVE,elementType:V.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s],edgeCreateCallback:e=>{const t=e.Org.idx,r=h[t],i=h[(t+1)%h.length];e.idx=[r,i],e.Sym.idx=[i,r]},vertexIdCallback:e=>{const t=e.Lprev.idx;return[t?t[1]:0,e.idx[0]]}});if(!d)throw new Error(`error generating bevel geometry for ${e}'th loop`);if(!d.vertexCount)break;for(let e=0;e{let i=0;const n=e.boundary.vertexIndices.length;for(;id){const i=e/d;let a=0;for(let l=1;l(a+1)*i&&(a++,v=this.buildBevelVert(o,r,(u+a)%s,a/(d-1)),f.push(A.topN,g.topP,v.topP),f.push(g.bottomP,A.bottomN,v.bottomP),A=v)}else{const i=d/e;let a=0;for(let l=1;l(a+1)*i&&(a++,g=this.buildBevelVert(o,t,(h+a)%n,a/(e-1)),f.push(y.topN,g.topP,A.topN),f.push(g.bottomP,y.bottomN,A.bottomN),y=g)}h=(h+e)%n,u=(u+d)%s,l=(l+1)%a}while(l!==d)}{const e=p[0];for(let t=0,r=e.boundary.vertexCount;t1?j.POSITIVE:j.ODD,elementType:V.POLYGONS,vertexSize:2,strict:!0,contours:[e.insetPoints,...a]});if(!t)throw new Error("Error generating geometry for surface");for(let e=0;e<3*t.elementCount;e+=3){const r=this.buildSurfaceVert(t,t.elements[e+0]),i=this.buildSurfaceVert(t,t.elements[e+1]),n=this.buildSurfaceVert(t,t.elements[e+2]);f.push(r.top,i.top,n.top),f.push(n.bottom,i.bottom,r.bottom)}}this.vertexCache={}}this._buffer.shrink();const m=new t.BufferAttribute(Uint32Array.from(f),1),g=new t.BufferAttribute(this._buffer.positions,3),v=new t.BufferAttribute(this._buffer.normals,3),y=new t.BufferAttribute(this._buffer.uvs,2);g.needsUpdate=!0,v.needsUpdate=!0,y.needsUpdate=!0,m.needsUpdate=!0,this.setAttribute("position",g),this.setAttribute("normal",v),this.setAttribute("uv",y),this.setIndex(m)}buildSurfaceVert(e,t){const r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];const i=e.vertices[2*t+0],n=e.vertices[2*t+1],s=(i-this._minX)/this._width,o=(n-this._minY)/this._height,a=this._buffer.get(2),l=3*a,c=2*a,h={top:a+0,bottom:a+1};return this._buffer.positions[l+0]=i,this._buffer.positions[l+1]=n,this._buffer.positions[l+2]=this._depth,this._buffer.normals[l+0]=0,this._buffer.normals[l+1]=0,this._buffer.normals[l+2]=1,this._buffer.uvs[c+0]=s,this._buffer.uvs[c+1]=o,this._buffer.positions[l+3]=i,this._buffer.positions[l+4]=n,this._buffer.positions[l+5]=0,this._buffer.normals[l+3]=0,this._buffer.normals[l+4]=0,this._buffer.normals[l+5]=-1,this._buffer.uvs[c+2]=s,this._buffer.uvs[c+3]=o,this.vertexCache[r]=h,h}buildBevelVert(e,t,r,i=1){const n=`${t.bevelI}:${r}`;if(n in this.vertexCache)return this.vertexCache[n];const[s,o]=t.boundary.vertexIndices[r];let a,l,c,h;s!==o?(l=s,a=o,h=!1,c=e.continuous[l]&&e.continuous[a]):(a=s,l=(a-1+e.count)%e.count,h=e.concave[a]&&t.bevelI>0,c=e.continuous[a]||h);const u=Math.cos(t.angle),d=Math.sin(t.angle),p=2*r,f=2*a,m=2*l,g=t.boundary.vertices[p+0],v=t.boundary.vertices[p+1],y=(1-d)*this._bevelSize,A=(g-this._minX)/this._width,w=(v-this._minY)/this._height;let x=e.normals[f+0],b=e.normals[f+1];const S=e.normals[m+0],E=e.normals[m+1];if(h){x+=(S-x)*(1-i),b+=(E-b)*(1-i);const e=Math.sqrt(x*x+b*b);x/=e,b/=e}let C=this._buffer.get(c?2:4),T=3*C,O=2*C;const D={i:r,fi:a,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1};return this._buffer.positions[T+0]=g,this._buffer.positions[T+1]=v,this._buffer.positions[T+2]=this._depth-y,this._buffer.normals[T+0]=x*u,this._buffer.normals[T+1]=b*u,this._buffer.normals[T+2]=d,this._buffer.uvs[O+0]=A,this._buffer.uvs[O+1]=w,this._buffer.positions[T+3]=g,this._buffer.positions[T+4]=v,this._buffer.positions[T+5]=y,this._buffer.normals[T+3]=x*u,this._buffer.normals[T+4]=b*u,this._buffer.normals[T+5]=-d,this._buffer.uvs[O+2]=w,this._buffer.uvs[O+3]=A,c||(C+=2,T+=6,O+=4,D.topP=C+0,D.bottomP=C+1,this._buffer.positions[T+0]=g,this._buffer.positions[T+1]=v,this._buffer.positions[T+2]=this._depth-y,this._buffer.normals[T+0]=S*u,this._buffer.normals[T+1]=E*u,this._buffer.normals[T+2]=d,this._buffer.uvs[O+0]=A,this._buffer.uvs[O+1]=w,this._buffer.positions[T+3]=g,this._buffer.positions[T+4]=v,this._buffer.positions[T+5]=y,this._buffer.normals[T+3]=S*u,this._buffer.normals[T+4]=E*u,this._buffer.normals[T+5]=-d,this._buffer.uvs[O+2]=w,this._buffer.uvs[O+3]=A),this.vertexCache[n]=D,D}}const ce=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n,s,o,a;const l=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,depth:0,subdivisions:40,roundness:0,extrudeDepth:0,surfaceMaxCount:100,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters),c=Math.abs(l.width),h=Math.abs(null!==(i=l.height)&&void 0!==i?i:l.width);let u=null!==(n=e.shape)&&void 0!==n?n:null==t?void 0:t.shape;const d=null!==(s=null==u?void 0:u.roundness)&&void 0!==s?s:l.roundness;void 0!==u&&(u instanceof R?u.width===c&&u.height===h||u.applySize(c,h):u=new R(c,h).fromJSON(u),void 0!==(null===(o=e.parameters)||void 0===o?void 0:o.roundness)&&(null===(a=e.parameters)||void 0===a?void 0:a.roundness)>0&&u.update(!1));const p=null!=u?u:new R(c,h);return{parameters:Object.assign(l,{width:c,height:h,roundness:d}),shape:p}}static build(e){const{extrudeDepth:t,extrudeBevelSize:r,extrudeBevelSegments:i,subdivisions:n,roundness:s,surfaceMaxCount:o}=e.parameters;let a;return e.shape.roundness=s,a=t<=0?new se(e.shape,n,o):new le(e.shape,t,r,n,i),Object.assign(a,{userData:Object.assign(Object.assign({},e),{type:"VectorGeometry"})})}},he=2*Math.PI;function ue(e,t,r,i,n,s){const o=-t/r;for(let t=0;t<=r;t++){const r=o*t,s=Math.sin(r)*i,a=Math.cos(r)*n;e.addPoint(de(s,a))}return t0?fe(e,i,n,s):e.addPoint(de(0,0)):(e.removePoint(e.points[e.points.length-1]),s>0&&me(e,i,n,s)),1}function de(e,r){return new u(t.MathUtils.generateUUID(),new t.Vector2(e,r))}function pe(e,t,r,i,n,s){const o=de(e,t);return o.controls[0].position.set(r,i),o.controls[1].position.set(n,s),o}function fe(e,t,r,i){ge(e,t,r,i).forEach((t=>e.addPoint(t)))}function me(e,t,r,i){const n=ge(e,t,r,i),s=new R;n.forEach((e=>s.addPoint(e))),s.isClosed=!0,e.shapeHoles.push(s)}function ge(e,r,i,n){const s=n*r/100,o=s*(Math.abs(i)/Math.abs(r)),a=new t.Vector2(s/r,o/i),l=e.points.map((e=>e.clone())).reverse();return l.forEach((e=>{e.position.multiply(a);const t=e.controls[0].position.clone().multiply(a),r=e.controls[1].position.clone().multiply(a);e.controls[0].position.copy(r),e.controls[1].position.copy(t)})),l}class ve extends t.BufferGeometry{constructor(e,r,i,n,s,o,a,l,c,h,u,d){super();const p=[],f=[],m=[],g=[],v=[],y=[],A=[],w=new t.Vector3,x=new t.Vector3,b=new t.Vector3,S=new t.Vector3;let E,C,T,O,D,M,_,N;const L=new t.Vector3,B=new t.Vector3,I=new t.Vector3,P=new t.Vector3,R=new t.Vector3,F=new t.Vector3,U=new t.Vector3,z=s-l,k=i-2*l+.001,G=k/o,j=Math.ceil(a*o),V=k/j,H=-k/2,J=2*Math.PI/h,Q=Math.PI/2/d,Y=Math.min((1-u/100)*l,l-.1),W=l-Y,X=e&&1==o;function K(t,r){const i=Math.PI/2;M=r*V,N=2*Math.PI*(M%G)/G+i,M+=H,_=Math.sin(N)*z,D=Math.cos(N)*z,e?t.set(D,_,M):t.set(D,M,_)}X&&(d=0),K(b,-1),K(S,0),L.copy(b);const q=b.distanceTo(S),Z=q*j+2*W,$=Z-W;for(let t=0;t<=j;t++){K(w,t),U.subVectors(w,L).normalize(),L.copy(w),R.copy(w).setComponent(+e+1,0).normalize(),F.crossVectors(U,R).normalize();const r=0==t?3*Math.PI/2:Q,i=0==t?0:$;for(let e=0,n=0;e<=h;e++,n=e*J){if(B.addVectors(b.copy(R).multiplyScalar(l*Math.cos(n)),S.copy(F).multiplyScalar(l*Math.sin(n))),P.copy(B).normalize(),0==t||t==j){S.copy(P).multiplyScalar(Y),x.addVectors(w,S);for(let n=0,s=r;n0)for(let e=0;e0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let e=0,t=this.faces.length;e=0;e--){const t=s[e];this.faces.splice(t,1);for(let e=0,r=this.faceVertexUvs.length;e0,a=t.vertexNormals.length>0,l=1!==t.color.r||1!==t.color.g||1!==t.color.b,p=t.vertexColors.length>0;let f=0;if(f=c(f,0,0),f=c(f,1,i),f=c(f,2,n),f=c(f,3,s),f=c(f,4,o),f=c(f,5,a),f=c(f,6,l),f=c(f,7,p),r.push(f),r.push(t.a,t.b,t.c),r.push(t.materialIndex),s){const t=this.faceVertexUvs[0][e];r.push(d(t[0]),d(t[1]),d(t[2]))}if(o&&r.push(h(t.normal)),a){const e=t.vertexNormals;r.push(h(e[0]),h(e[1]),h(e[2]))}if(l&&r.push(u(t.color)),p){const e=t.vertexColors;r.push(u(e[0]),u(e[1]),u(e[2]))}}function c(e,t,r){return r?e|1<0&&(e.data.colors=s),a.length>0&&(e.data.uvs=[a]),e.data.faces=r,e}clone(){return(new xe).copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;const t=e.vertices;for(let e=0,r=t.length;e0){const i=new Float32Array(3*e.normals.length);r.setAttribute("normal",new t.BufferAttribute(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){const i=new Float32Array(3*e.colors.length);r.setAttribute("color",new t.BufferAttribute(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){const i=new Float32Array(2*e.uvs.length);r.setAttribute("uv",new t.BufferAttribute(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){const i=new Float32Array(2*e.uvs2.length);r.setAttribute("uv2",new t.BufferAttribute(i,2).copyVector2sArray(e.uvs2))}r.groups=e.groups;for(const i in e.morphTargets){const n=[],s=e.morphTargets[i];for(let e=0,r=s.length;e0){const i=new t.Float32BufferAttribute(4*e.skinIndices.length,4);r.setAttribute("skinIndex",i.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){const i=new t.Float32BufferAttribute(4*e.skinWeights.length,4);r.setAttribute("skinWeight",i.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(r.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(r.boundingBox=e.boundingBox.clone()),r}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let r=new t.BufferGeometry;const i=e.geometry;if(e.isPoints||e.isLine){const e=new t.Float32BufferAttribute(3*i.vertices.length,3),n=new t.Float32BufferAttribute(3*i.colors.length,3);if(r.setAttribute("position",e.copyVector3sArray(i.vertices)),r.setAttribute("color",n.copyColorsArray(i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){const e=new t.Float32BufferAttribute(i.lineDistances.length,1);r.setAttribute("lineDistance",e.copyArray(i.lineDistances))}null!==i.boundingSphere&&(r.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(r.boundingBox=i.boundingBox.clone())}else e.isMesh&&(r=i.toBufferGeometry());return r}}xe.prototype.isGeometry=!0;class be{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const t=[];let r,i,n;const s=e.faces;for(i=0;i0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length;let c;if(l>0){c=[];for(let e=0;e0){d=[];for(let e=0;e0&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let e=0;e0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){const r=new t.Vector3;let i,n,s,o,a;const l=e.vertices,c=e.faces,h=e.faceVertexUvs[0],u=void 0!==h&&h.length>0,d=[],p=new Map;!function(e,t,r,i){let n,s,o;for(n=0,s=e.length;n3&&(b=3/(8*i)),S=1-i*Number(b),E=b,i<=2&&2==i&&(S=3/4,E=1/8),D=O.clone().multiplyScalar(S),r.set(0,0,0),o=0;o0){if(void 0===c||(null==l?void 0:l.subdivisions)>o){void 0===c&&(c=a);a=new Ne(o).modify(c).toBufferGeometry()}}else void 0!==c&&(a=c),c=void 0;return void 0!==c&&Object.assign(a,{originalGeometry:c}),delete e.geometry,Object.assign(a,{userData:Object.assign(Object.assign({},e),{type:"NonParametricGeometry"})})}static loadFromUrl(e,r,i){new t.BufferGeometryLoader(i).load(e,(e=>{const t=this.normalizeInputs({geometry:e});e.boundingBox.getSize(Le);const i=100/Le.x;Object.assign(t.parameters,{width:100,height:Le.y*i,depth:Le.z*i}),r(this.build(t))}))}};function Ie(e,t,r){r.x=e.x*t.x,r.y=e.y,r.z=e.x*t.y}function Pe(e,t,r,i,n,s){const o=t.clone().sub(e),a=r.clone().sub(e),l=o.angleTo(a);if(o.normalize(),a.normalize(),i===n){const t=o.add(a).normalize();s.copy(e).addScaledVector(t,i/Math.sin(l/2))}else{const t=o.angleTo(a);s.copy(e),s.addScaledVector(o,n/Math.sin(t)),s.addScaledVector(a,i/Math.sin(t))}}function Re(e,t,r){const i=e.clone().sub(t),n=r.clone().sub(t);return i.projectOnVector(n),i.add(t)}class Fe extends t.BufferGeometry{constructor(e=.5,r=1,i=4,n=1,s=!1,o=0,a=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0;const p=r/2,f=Math.PI/i,m=e*Math.cos(Math.PI/i),g=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,A=new t.Vector3(0,-p,0),w=new t.Vector3(0,p,0),x=new t.Vector2(e,-p),b=new t.Vector2(m,-p),S=new t.Vector2(0,w.y).sub(b),E=new t.Vector2(0,w.y).sub(x),C=new t.Vector2(S.y,-S.x).normalize(),T=new t.Vector2(E.y,-E.x).normalize(),O=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;let D;o=Math.min(o,O);{const e=new t.Vector3(C.x,C.y,0),r=new t.Vector3(Math.cos(g)*e.x,e.y,Math.sin(g)*e.x);D=e.angleTo(r)}const M=o/Math.tan((Math.PI-S.angle())/2),_=o/Math.tan((Math.PI-D)/2),N=new t.Vector3;if(!s){c.push(A.x,A.y,A.z),h.push(0,-1,0),u.push(0,0);const e=d++,r=[],n=x.clone(),s=M/Math.cos(Math.PI/i);n.x-=s;for(let e=0;e0){{const e=r.clone().add(n).multiplyScalar(.5),t=w.clone().sub(e).normalize(),i=A.clone().sub(e).normalize().add(t).normalize().multiplyScalar(-1);L(e,m.clone().sub(p),i,S.angle())}let f,g;{const e=new t.Vector3;Ie(T,N,e);let r=m.clone().add(s).multiplyScalar(.5);r=Re(r,n,w);const i=m.clone().sub(s);[f,g]=L(r,i,e,D,s.y)}{const e=f,r=e.clone().setY(0).normalize(),i=new t.Vector3(0,-1,0),n=r.clone().cross(i);B(e,r,i,n)}{const r=S.angle(),n=Math.PI-r,s=w.clone();s.y-=o/Math.sin(r-Math.PI/2);const p=new t.Vector3,f=[];for(let t=0;te+t),0);return{shape:new R,parameters:Object.assign(o,{surfaceMaxCount:(null!==(n=o.surfaceMaxCount)&&void 0!==n?n:l>0)?1e3:100,width:Math.abs(o.width),height:Math.abs(null!==(s=o.height)&&void 0!==s?s:o.width)}),ui:a}}static build(e){const t=e.shape,{width:r,height:i,cornerRadius:n,cornerType:s,extrudeDepth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=e.parameters,h={x:.5*r,y:.5*i},u={x:-h.x,y:-h.y},d={x:h.x,y:h.y};function p(e,t,n){return t>r&&n>i?Math.min(e*r/t,e*i/n):t>r?e*r/t:n>i?e*i/n:e}const f=[];f[0]=0===n[0]?0:p(n[0],n[0]+n[3],n[0]+n[1]),f[1]=0===n[1]?0:p(n[1],n[1]+n[2],n[1]+n[0]),f[2]=0===n[2]?0:p(n[2],n[2]+n[1],n[2]+n[3]),f[3]=0===n[3]?0:p(n[3],n[3]+n[0],n[3]+n[2]);const m=u.x,g=d.x,v=d.y,y=u.y;t.addPoint(t.createPoint(m,v)),t.addPoint(t.createPoint(g,v)),t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(m,y)),t.isClosed=!0;let A=!0;for(let e=0,r=t.points.length;e0&&f[e]!==f[e-1]&&(A=!1);A&&(t.roundness=f[0]),t.useCubicForRoundedCorners=1!==s,t.update();const w=ce.create({shape:t,parameters:{surfaceMaxCount:c,extrudeDepth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(w,{userData:Object.assign(Object.assign({},e),{type:"RectangleGeometry"})})}};function ze(e,...t){let r=0;for(const e of t)r+=e.length;const i=new e(r);let n=0;for(const e of t)i.set(e,n),n+=e.length;return i}class ke{static computeTangents(e){e.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}static mergeBufferGeometries(e,r=!1){const i=null!==e[0].index,n=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),o={},a={},l=e[0].morphTargetsRelative,c=new t.BufferGeometry;let h=0;for(let t=0;t[])))}const p=Math.log10(1/r),f=Math.pow(10,p);for(let t=0;t=i);)++n;if(n-t>16&&e.subarray&&f)return f.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&c)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s}function g(e,t){return e?m(b,e,t):""}function v(e,t,r,i){if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n}function y(e,t,r){return v(e,b,t,r)}function A(e){for(var t=0,r=0;r=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++r)),i<=127?++t:t+=i<=2047?2:i<=65535?3:4}return t}var w,x,b,S,E,C,T,O,D,M="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function _(e,t){for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&E[i];)++i;if((r=i<<1)-e>32&&M)return M.decode(b.subarray(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=S[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s}function N(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return S[t>>1]=0,t-i}function L(e){return 2*e.length}function B(e,t){for(var r=0,i="";!(r>=t/4);){var n=C[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i}function I(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),C[t>>2]=o,(t+=4)+4>n)break}return C[t>>2]=0,t-i}function P(e){for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t}function R(e,t){x.set(e,t)}function F(t){w=t,e.HEAP8=x=new Int8Array(t),e.HEAP16=S=new Int16Array(t),e.HEAP32=C=new Int32Array(t),e.HEAPU8=b=new Uint8Array(t),e.HEAPU16=E=new Uint16Array(t),e.HEAPU32=T=new Uint32Array(t),e.HEAPF32=O=new Float32Array(t),e.HEAPF64=D=new Float64Array(t)}e.INITIAL_MEMORY;var U,z=[],k=[],G=[],j=[];k.push({func:function(){Xt()}});var V=0,H=null;function J(t){V++,e.monitorRunDependencies&&e.monitorRunDependencies(V)}function Q(t){if(V--,e.monitorRunDependencies&&e.monitorRunDependencies(V),0==V&&H){var r=H;H=null,r()}}function Y(t){e.onAbort&&e.onAbort(t),u(t+=""),d=!0,t="abort("+t+"). Build with -s ASSERTIONS=1 for more info.";var i=new WebAssembly.RuntimeError(t);throw r(i),i}function W(e){return t=e,r="data:application/octet-stream;base64,",String.prototype.startsWith?t.startsWith(r):0===t.indexOf(r);var t,r}e.preloadedImages={},e.preloadedAudios={};var X,K,q,Z="process.wasm";function $(e){try{if(e==Z&&l)return new Uint8Array(l);throw"both async and sync fetching of the wasm failed"}catch(e){Y(e)}}function ee(t){for(;t.length>0;){var r=t.shift();if("function"!=typeof r){var i=r.func;"number"==typeof i?void 0===r.arg?U.get(i)():U.get(i)(r.arg):i(void 0===r.arg?null:r.arg)}else r(e)}}W(Z)||(X=Z,Z=e.locateFile?e.locateFile(X,a):a+X);var te=0,re=4,ie=8,ne=12,se=13,oe=16;function ae(e){this.excPtr=e,this.ptr=e-oe,this.set_type=function(e){C[this.ptr+ie>>2]=e},this.get_type=function(){return C[this.ptr+ie>>2]},this.set_destructor=function(e){C[this.ptr+te>>2]=e},this.get_destructor=function(){return C[this.ptr+te>>2]},this.set_refcount=function(e){C[this.ptr+re>>2]=e},this.set_caught=function(e){e=e?1:0,x[this.ptr+ne>>0]=e},this.get_caught=function(){return 0!=x[this.ptr+ne>>0]},this.set_rethrown=function(e){e=e?1:0,x[this.ptr+se>>0]=e},this.get_rethrown=function(){return 0!=x[this.ptr+se>>0]},this.init=function(e,t){this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=C[this.ptr+re>>2];C[this.ptr+re>>2]=e+1},this.release_ref=function(){var e=C[this.ptr+re>>2];return C[this.ptr+re>>2]=e-1,1===e}}var le={};function ce(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function he(e){return this.fromWireType(T[e>>2])}var ue={},de={},pe={};function fe(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function me(e,t){return e=fe(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function ge(e,t){var r=me(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var ve=void 0;function ye(e){throw new ve(e)}function Ae(e,t,r){function i(t){var i=r(t);i.length!==e.length&&ye("Mismatched type converter count");for(var n=0;n>2)+i]);return r}function mt(e,t,r,i,n){var s=t.length;s<2&&Ce("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,a=!1,l=1;l0?", ":"")+u),d+=(c?"var rv = ":"")+"invoker(fn"+(u.length>0?", ":"")+u+");\n",a)d+="runDestructors(destructors);\n";else for(l=o?1:2;l4&&0==--yt[e].refcount&&(yt[e]=void 0,vt.push(e))}function wt(){for(var e=0,t=5;t>1])};case 2:return function(e){var t=r?C:T;return this.fromWireType(t[e>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function Et(e,t){var r=de[e];return void 0===r&&Ce(t+" has unknown type "+dt(e)),r}function Ct(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function Tt(e,t){switch(t){case 2:return function(e){return this.fromWireType(O[e>>2])};case 3:return function(e){return this.fromWireType(D[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Ot(e,t,r){switch(t){case 0:return r?function(e){return x[e]}:function(e){return b[e]};case 1:return r?function(e){return S[e>>1]}:function(e){return E[e>>1]};case 2:return r?function(e){return C[e>>2]}:function(e){return T[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Dt(e){try{return c.grow(e-w.byteLength+65535>>>16),F(c.buffer),1}catch(e){}}var Mt={};function _t(){if(!_t.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:o||"./this.program"};for(var t in Mt)e[t]=Mt[t];var r=[];for(var t in e)r.push(t+"="+e[t]);_t.strings=r}return _t.strings}var Nt={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,t){for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:function(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=Nt.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:function(e){var t=Nt.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:function(e){if("/"===e)return"/";var t=(e=(e=Nt.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},extname:function(e){return Nt.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return Nt.normalize(e.join("/"))},join2:function(e,t){return Nt.normalize(e+"/"+t)}},Lt={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Rt.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t="/"===i.charAt(0)}return(t?"/":"")+(e=Nt.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||"."},relative:function(e,t){function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=Lt.resolve(e).substr(1),t=Lt.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a0&&(h(m(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(u(m(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(u(m(e.output,0)),e.output=[])}}};function It(e){for(var t=function(e,t){return t||(t=16),Math.ceil(e/t)*t}(e,16384),r=Kt(t);e=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=Rt.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Rt.isDir(e.mode)?t.size=4096:Rt.isFile(e.mode)?t.size=e.usedBytes:Rt.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&Pt.resizeFileStorage(e,t.size)},lookup:function(e,t){throw Rt.genericErrors[44]},mknod:function(e,t,r,i){return Pt.createNode(e,t,r,i)},rename:function(e,t,r){if(Rt.isDir(e.mode)){var i;try{i=Rt.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new Rt.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=Rt.lookupNode(e,t);for(var i in r.contents)throw new Rt.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var i=Pt.createNode(e,t,41471,0);return i.link=r,i},readlink:function(e){if(!Rt.isLink(e.mode))throw new Rt.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||i+r8)throw new Rt.ErrnoError(32);for(var n=Nt.normalizeArray(e.split("/").filter((function(e){return!!e})),!1),s=Rt.root,o="/",a=0;a40)throw new Rt.ErrnoError(32)}}return{path:o,node:s}},getPath:function(e){for(var t;;){if(Rt.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:function(e,t){for(var r=0,i=0;i>>0)%Rt.nameTable.length},hashAddNode:function(e){var t=Rt.hashName(e.parent.id,e.name);e.name_next=Rt.nameTable[t],Rt.nameTable[t]=e},hashRemoveNode:function(e){var t=Rt.hashName(e.parent.id,e.name);if(Rt.nameTable[t]===e)Rt.nameTable[t]=e.name_next;else for(var r=Rt.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:function(e,t){var r=Rt.mayLookup(e);if(r)throw new Rt.ErrnoError(r,e);for(var i=Rt.hashName(e.id,t),n=Rt.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return Rt.lookup(e,t)},createNode:function(e,t,r,i){var n=new Rt.FSNode(e,t,r,i);return Rt.hashAddNode(n),n},destroyNode:function(e){Rt.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:function(e){var t=Rt.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:function(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:function(e,t){return Rt.ignorePermissions||(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:2},mayLookup:function(e){var t=Rt.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:function(e,t){try{return Rt.lookupNode(e,t),20}catch(e){}return Rt.nodePermissions(e,"wx")},mayDelete:function(e,t,r){var i;try{i=Rt.lookupNode(e,t)}catch(e){return e.errno}var n=Rt.nodePermissions(e,"wx");if(n)return n;if(r){if(!Rt.isDir(i.mode))return 54;if(Rt.isRoot(i)||Rt.getPath(i)===Rt.cwd())return 10}else if(Rt.isDir(i.mode))return 31;return 0},mayOpen:function(e,t){return e?Rt.isLink(e.mode)?32:Rt.isDir(e.mode)&&("r"!==Rt.flagsToPermissionString(t)||512&t)?31:Rt.nodePermissions(e,Rt.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd:function(e,t){e=e||0,t=t||Rt.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!Rt.streams[r])return r;throw new Rt.ErrnoError(33)},getStream:function(e){return Rt.streams[e]},createStream:function(e,t,r){Rt.FSStream||(Rt.FSStream=function(){},Rt.FSStream.prototype={object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}});var i=new Rt.FSStream;for(var n in e)i[n]=e[n];e=i;var s=Rt.nextfd(t,r);return e.fd=s,Rt.streams[s]=e,e},closeStream:function(e){Rt.streams[e]=null},chrdev_stream_ops:{open:function(e){var t=Rt.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new Rt.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,t){return e<<8|t},registerDevice:function(e,t){Rt.devices[e]={stream_ops:t}},getDevice:function(e){return Rt.devices[e]},getMounts:function(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs:function(e,t){"function"==typeof e&&(t=e,e=!1),Rt.syncFSRequests++,Rt.syncFSRequests>1&&u("warning: "+Rt.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=Rt.getMounts(Rt.root.mount),i=0;function n(e){return Rt.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((function(t){if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount:function(e,t,r){var i,n="/"===r,s=!r;if(n&&Rt.root)throw new Rt.ErrnoError(10);if(!n&&!s){var o=Rt.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,Rt.isMountpoint(i))throw new Rt.ErrnoError(10);if(!Rt.isDir(i.mode))throw new Rt.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},l=e.mount(a);return l.mount=a,a.root=l,n?Rt.root=l:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),l},unmount:function(e){var t=Rt.lookupPath(e,{follow_mount:!1});if(!Rt.isMountpoint(t.node))throw new Rt.ErrnoError(28);var r=t.node,i=r.mounted,n=Rt.getMounts(i);Object.keys(Rt.nameTable).forEach((function(e){for(var t=Rt.nameTable[e];t;){var r=t.name_next;-1!==n.indexOf(t.mount)&&Rt.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:function(e,t){return e.node_ops.lookup(e,t)},mknod:function(e,t,r){var i=Rt.lookupPath(e,{parent:!0}).node,n=Nt.basename(e);if(!n||"."===n||".."===n)throw new Rt.ErrnoError(28);var s=Rt.mayCreate(i,n);if(s)throw new Rt.ErrnoError(s);if(!i.node_ops.mknod)throw new Rt.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:function(e,t){return t=void 0!==t?t:438,t&=4095,t|=32768,Rt.mknod(e,t,0)},mkdir:function(e,t){return t=void 0!==t?t:511,t&=1023,t|=16384,Rt.mknod(e,t,0)},mkdirTree:function(e,t){for(var r=e.split("/"),i="",n=0;nthis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((function(e){var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=function(e,t){if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),"undefined"!=typeof Uint8Array&&(n.responseType="arraybuffer"),n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):Qt(n.responseText||"",!0)}(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,h("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o={isDevice:!1,url:r},a=Rt.createFile(e,t,o,i,n);o.contents?a.contents=o.contents:o.url&&(a.contents=null,a.url=o.url),Object.defineProperties(a,{usedBytes:{get:function(){return this.contents.length}}});var l={};return Object.keys(a.stream_ops).forEach((function(e){var t=a.stream_ops[e];l[e]=function(){return Rt.forceLoadFile(a),t.apply(null,arguments)}})),l.read=function(e,t,r,i,n){Rt.forceLoadFile(a);var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var l=0;l>2]=i.dev,C[r+4>>2]=0,C[r+8>>2]=i.ino,C[r+12>>2]=i.mode,C[r+16>>2]=i.nlink,C[r+20>>2]=i.uid,C[r+24>>2]=i.gid,C[r+28>>2]=i.rdev,C[r+32>>2]=0,q=[i.size>>>0,(K=i.size,+Math.abs(K)>=1?K>0?(0|Math.min(+Math.floor(K/4294967296),4294967295))>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],C[r+40>>2]=q[0],C[r+44>>2]=q[1],C[r+48>>2]=4096,C[r+52>>2]=i.blocks,C[r+56>>2]=i.atime.getTime()/1e3|0,C[r+60>>2]=0,C[r+64>>2]=i.mtime.getTime()/1e3|0,C[r+68>>2]=0,C[r+72>>2]=i.ctime.getTime()/1e3|0,C[r+76>>2]=0,q=[i.ino>>>0,(K=i.ino,+Math.abs(K)>=1?K>0?(0|Math.min(+Math.floor(K/4294967296),4294967295))>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],C[r+80>>2]=q[0],C[r+84>>2]=q[1],0},doMsync:function(e,t,r,i,n){var s=b.slice(e,e+r);Rt.msync(t,s,n,r,i)},doMkdir:function(e,t){return"/"===(e=Nt.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),Rt.mkdir(e,t,0),0},doMknod:function(e,t,r){switch(61440&t){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return Rt.mknod(e,t,r),0},doReadlink:function(e,t,r){if(r<=0)return-28;var i=Rt.readlink(e),n=Math.min(r,A(i)),s=x[t+n];return y(i,t,r+1),x[t+n]=s,n},doAccess:function(e,t){if(-8&t)return-28;var r;if(!(r=Rt.lookupPath(e,{follow:!0}).node))return-44;var i="";return 4&t&&(i+="r"),2&t&&(i+="w"),1&t&&(i+="x"),i&&Rt.nodePermissions(r,i)?-2:0},doDup:function(e,t,r){var i=Rt.getStream(r);return i&&Rt.close(i),Rt.open(e,t,0,r,r).fd},doReadv:function(e,t,r,i){for(var n=0,s=0;s>2],a=C[t+(8*s+4)>>2],l=Rt.read(e,x,o,a,i);if(l<0)return-1;if(n+=l,l>2],a=C[t+(8*s+4)>>2],l=Rt.write(e,x,o,a,i);if(l<0)return-1;n+=l}return n},varargs:void 0,get:function(){return Ft.varargs+=4,C[Ft.varargs-4>>2]},getStr:function(e){return g(e)},getStreamFromFD:function(e){var t=Rt.getStream(e);if(!t)throw new Rt.ErrnoError(8);return t},get64:function(e,t){return e}};function Ut(e){return e%4==0&&(e%100!=0||e%400==0)}function zt(e,t){for(var r=0,i=0;i<=t;r+=e[i++]);return r}var kt=[31,29,31,30,31,30,31,31,30,31,30,31],Gt=[31,28,31,30,31,30,31,31,30,31,30,31];function jt(e,t){for(var r=new Date(e.getTime());t>0;){var i=Ut(r.getFullYear()),n=r.getMonth(),s=(i?kt:Gt)[n];if(!(t>s-r.getDate()))return r.setDate(r.getDate()+t),r;t-=s-r.getDate()+1,r.setDate(1),n<11?r.setMonth(n+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r}ve=e.InternalError=ge(Error,"InternalError"),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);be=e}(),Ee=e.BindingError=ge(Error,"BindingError"),ke.prototype.isAliasOf=Oe,ke.prototype.clone=Be,ke.prototype.delete=Ie,ke.prototype.isDeleted=Pe,ke.prototype.deleteLater=ze,at.prototype.getPointee=Ke,at.prototype.destructor=qe,at.prototype.argPackAdvance=8,at.prototype.readValueFromPointer=he,at.prototype.deleteObject=Ze,at.prototype.fromWireType=ot,e.getInheritedInstanceCount=et,e.getLiveInheritedInstances=tt,e.flushPendingDeletes=Ue,e.setDelayFunction=rt,ut=e.UnboundTypeError=ge(Error,"UnboundTypeError"),e.count_emval_handles=wt,e.get_first_emval=xt;var Vt=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Rt.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},Ht=365,Jt=146;function Qt(e,t,r){var i=r>0?r:A(e)+1,n=new Array(i),s=v(e,n,0,n.length);return t&&(n.length=s),n}Object.defineProperties(Vt.prototype,{read:{get:function(){return(this.mode&Ht)===Ht},set:function(e){e?this.mode|=Ht:this.mode&=-366}},write:{get:function(){return(this.mode&Jt)===Jt},set:function(e){e?this.mode|=Jt:this.mode&=-147}},isFolder:{get:function(){return Rt.isDir(this.mode)}},isDevice:{get:function(){return Rt.isChrdev(this.mode)}}}),Rt.FSNode=Vt,Rt.staticInit();var Yt,Wt={h:function(e){return Kt(e+oe)+oe},j:function(e,t,r){throw new ae(e).init(t,r),e},n:function(e){var t=le[e];delete le[e];var r=t.elements,i=r.length,n=r.map((function(e){return e.getterReturnType})).concat(r.map((function(e){return e.setterArgumentType}))),s=t.rawConstructor,o=t.rawDestructor;Ae([e],n,(function(e){return r.forEach((function(t,r){var n=e[r],s=t.getter,o=t.getterContext,a=e[r+i],l=t.setter,c=t.setterContext;t.read=function(e){return n.fromWireType(s(o,e))},t.write=function(e,t){var r=[];l(c,e,a.toWireType(r,t)),ce(r)}})),[{name:t.name,fromWireType:function(e){for(var t=new Array(i),n=0;n>s])},destructorFunction:null})},g:function(e,t,r,i,n,s,o,a,l,c,h,u,d){h=Se(h),s=ht(n,s),a&&(a=ht(o,a)),c&&(c=ht(l,c)),d=ht(u,d);var p=fe(h);He(p,(function(){pt("Cannot construct "+h+" due to unbound types",[i])})),Ae([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:ke.prototype;var o=me(p,(function(){if(Object.getPrototypeOf(this)!==l)throw new Ee("Use 'new' to construct "+h);if(void 0===u.constructor_body)throw new Ee(h+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ee("Tried to invoke ctor of "+h+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(u.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),l=Object.create(n,{constructor:{value:o}});o.prototype=l;var u=new Je(h,o,l,d,r,s,a,c),f=new at(h,u,!0,!1,!1),m=new at(h+"*",u,!1,!1,!1),g=new at(h+" const*",u,!1,!0,!1);return je[e]={pointerType:m,constPointerType:g},lt(p,o),[f,m,g]}))},f:function(e,t,r,i,n,s){p(t>0);var o=ft(t,r);n=ht(i,n);var a=[s],l=[];Ae([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ee("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=function(){pt("Cannot construct "+e.name+" due to unbound types",o)},Ae([],o,(function(i){return e.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&Ce(r+" called with "+arguments.length+" arguments, expected "+(t-1)),l.length=0,a.length=t;for(var e=1;e>>a}}var l=-1!=t.indexOf("unsigned");Te(e,{name:t,fromWireType:o,toWireType:function(e,r){if("number"!=typeof r&&"boolean"!=typeof r)throw new TypeError('Cannot convert "'+Ct(r)+'" to '+this.name);if(rn)throw new TypeError('Passing a number "'+Ct(r)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+i+", "+n+"]!");return l?r>>>0:0|r},argPackAdvance:8,readValueFromPointer:Ot(t,s,0!==i),destructorFunction:null})},d:function(e,t,r){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=T,r=t[e>>=2],n=t[e+1];return new i(w,n,r)}Te(e,{name:r=Se(r),fromWireType:n,argPackAdvance:8,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},u:function(e,t){var r="std::string"===(t=Se(t));Te(e,{name:t,fromWireType:function(e){var t,i=T[e>>2];if(r)for(var n=e+4,s=0;s<=i;++s){var o=e+4+s;if(s==i||0==b[o]){var a=g(n,o-n);void 0===t?t=a:(t+=String.fromCharCode(0),t+=a),n=o+1}}else{var l=new Array(i);for(s=0;s>2]=n,r&&i)y(t,s+4,n+1);else if(i)for(var o=0;o255&&(qt(s),Ce("String has UTF-16 code units that do not fit in 8 bits")),b[s+4+o]=a}else for(o=0;o>2],o=s(),l=e+4,c=0;c<=n;++c){var h=e+4+c*t;if(c==n||0==o[h>>a]){var u=i(l,h-l);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),l=h+t}}return qt(e),r},toWireType:function(e,i){"string"!=typeof i&&Ce("Cannot pass non-string to C++ string type "+r);var s=o(i),l=Kt(4+s+t);return T[l>>2]=s>>a,n(i,l+4,s+t),null!==e&&e.push(qt,l),l},argPackAdvance:8,readValueFromPointer:he,destructorFunction:function(e){qt(e)}})},m:function(e,t,r,i,n,s){le[e]={name:Se(t),rawConstructor:ht(r,i),rawDestructor:ht(n,s),elements:[]}},c:function(e,t,r,i,n,s,o,a,l){le[e].elements.push({getterReturnType:t,getter:ht(r,i),getterContext:n,setterArgumentType:s,setter:ht(o,a),setterContext:l})},p:function(e,t,r,i,n,s){we[e]={name:Se(t),rawConstructor:ht(r,i),rawDestructor:ht(n,s),fields:[]}},l:function(e,t,r,i,n,s,o,a,l,c){we[e].fields.push({fieldName:Se(t),getterReturnType:r,getter:ht(i,n),getterContext:s,setterArgumentType:o,setter:ht(a,l),setterContext:c})},D:function(e,t){Te(e,{isVoid:!0,name:t=Se(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},C:At,B:function(e){e>4&&(yt[e].refcount+=1)},k:function(e,t){return bt((e=Et(e,"_emval_take_value")).readValueFromPointer(t))},t:function(){Y()},A:function(e,t,r){b.copyWithin(e,t,t+r)},i:function(e){e>>>=0;var t=b.length,r=2147483648;if(e>r)return!1;for(var i,n,s=1;s<=4;s*=2){var o=t*(1+.2/s);if(o=Math.min(o,e+100663296),Dt(Math.min(r,((i=Math.max(16777216,e,o))%(n=65536)>0&&(i+=n-i%n),i))))return!0}return!1},K:function(e,t){try{var r=0;return _t().forEach((function(i,n){var s=t+r;C[e+4*n>>2]=s,function(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(x[t>>0]=0)}(i,s),r+=i.length+1})),0}catch(e){return void 0!==Rt&&e instanceof Rt.ErrnoError||Y(e),e.errno}},J:function(e,t){try{var r=_t();C[e>>2]=r.length;var i=0;return r.forEach((function(e){i+=e.length+1})),C[t>>2]=i,0}catch(e){return void 0!==Rt&&e instanceof Rt.ErrnoError||Y(e),e.errno}},I:function(e){try{var t=Ft.getStreamFromFD(e);return Rt.close(t),0}catch(e){return void 0!==Rt&&e instanceof Rt.ErrnoError||Y(e),e.errno}},H:function(e,t,r,i){try{var n=Ft.getStreamFromFD(e),s=Ft.doReadv(n,t,r);return C[i>>2]=s,0}catch(e){return void 0!==Rt&&e instanceof Rt.ErrnoError||Y(e),e.errno}},z:function(e,t,r,i,n){try{var s=Ft.getStreamFromFD(e),o=4294967296*r+(t>>>0),a=9007199254740992;return o<=-a||o>=a?-61:(Rt.llseek(s,o,i),q=[s.position>>>0,(K=s.position,+Math.abs(K)>=1?K>0?(0|Math.min(+Math.floor(K/4294967296),4294967295))>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],C[n>>2]=q[0],C[n+4>>2]=q[1],s.getdents&&0===o&&0===i&&(s.getdents=null),0)}catch(e){return void 0!==Rt&&e instanceof Rt.ErrnoError||Y(e),e.errno}},G:function(e,t,r,i){try{var n=Ft.getStreamFromFD(e),s=Ft.doWritev(n,t,r);return C[i>>2]=s,0}catch(e){return void 0!==Rt&&e instanceof Rt.ErrnoError||Y(e),e.errno}},y:function(e){},x:function(e,t,r,i){return function(e,t,r,i){var n=C[i+40>>2],s={tm_sec:C[i>>2],tm_min:C[i+4>>2],tm_hour:C[i+8>>2],tm_mday:C[i+12>>2],tm_mon:C[i+16>>2],tm_year:C[i+20>>2],tm_wday:C[i+24>>2],tm_yday:C[i+28>>2],tm_isdst:C[i+32>>2],tm_gmtoff:C[i+36>>2],tm_zone:n?g(n):""},o=g(r),a={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var l in a)o=o.replace(new RegExp(l,"g"),a[l]);var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],h=["January","February","March","April","May","June","July","August","September","October","November","December"];function u(e,t,r){for(var i="number"==typeof e?e.toString():e||"";i.length0?1:0}var i;return 0===(i=r(e.getFullYear()-t.getFullYear()))&&0===(i=r(e.getMonth()-t.getMonth()))&&(i=r(e.getDate()-t.getDate())),i}function f(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function m(e){var t=jt(new Date(e.tm_year+1900,0,1),e.tm_yday),r=new Date(t.getFullYear(),0,4),i=new Date(t.getFullYear()+1,0,4),n=f(r),s=f(i);return p(n,t)<=0?p(s,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var v={"%a":function(e){return c[e.tm_wday].substring(0,3)},"%A":function(e){return c[e.tm_wday]},"%b":function(e){return h[e.tm_mon].substring(0,3)},"%B":function(e){return h[e.tm_mon]},"%C":function(e){return d((e.tm_year+1900)/100|0,2)},"%d":function(e){return d(e.tm_mday,2)},"%e":function(e){return u(e.tm_mday,2," ")},"%g":function(e){return m(e).toString().substring(2)},"%G":function(e){return m(e)},"%H":function(e){return d(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),d(t,2)},"%j":function(e){return d(e.tm_mday+zt(Ut(e.tm_year+1900)?kt:Gt,e.tm_mon-1),3)},"%m":function(e){return d(e.tm_mon+1,2)},"%M":function(e){return d(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return d(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=new Date(e.tm_year+1900,0,1),r=0===t.getDay()?t:jt(t,7-t.getDay()),i=new Date(e.tm_year+1900,e.tm_mon,e.tm_mday);if(p(r,i)<0){var n=zt(Ut(i.getFullYear())?kt:Gt,i.getMonth()-1)-31,s=31-r.getDate()+n+i.getDate();return d(Math.ceil(s/7),2)}return 0===p(r,t)?"01":"00"},"%V":function(e){var t,r=new Date(e.tm_year+1900,0,4),i=new Date(e.tm_year+1901,0,4),n=f(r),s=f(i),o=jt(new Date(e.tm_year+1900,0,1),e.tm_yday);return p(o,n)<0?"53":p(s,o)<=0?"01":(t=n.getFullYear()=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(r?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var l in v)o.indexOf(l)>=0&&(o=o.replace(new RegExp(l,"g"),v[l](s)));var y=Qt(o,!1);return y.length>t?0:(R(y,e),y.length-1)}(e,t,r,i)}},Xt=(function(){var t={a:Wt};function i(t,r){var i=t.exports;e.asm=i,F((c=e.asm.L).buffer),U=e.asm.N,Q()}function n(e){i(e.instance)}function s(e){return(l||"function"!=typeof fetch?Promise.resolve().then((function(){return $(Z)})):fetch(Z,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+Z+"'";return e.arrayBuffer()})).catch((function(){return $(Z)}))).then((function(e){return WebAssembly.instantiate(e,t)})).then(e,(function(e){u("failed to asynchronously prepare wasm: "+e),Y(e)}))}if(J(),e.instantiateWasm)try{return e.instantiateWasm(t,i)}catch(e){return u("Module.instantiateWasm callback failed with error: "+e),!1}(l||"function"!=typeof WebAssembly.instantiateStreaming||W(Z)||"function"!=typeof fetch?s(n):fetch(Z,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(n,(function(e){return u("wasm streaming compile failed: "+e),u("falling back to ArrayBuffer instantiation"),s(n)}))}))).catch(r)}(),e.___wasm_call_ctors=function(){return(Xt=e.___wasm_call_ctors=e.asm.M).apply(null,arguments)}),Kt=e._malloc=function(){return(Kt=e._malloc=e.asm.O).apply(null,arguments)},qt=e._free=function(){return(qt=e._free=e.asm.P).apply(null,arguments)},Zt=e.___getTypeName=function(){return(Zt=e.___getTypeName=e.asm.Q).apply(null,arguments)},$t=(e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.R).apply(null,arguments)},e.stackSave=function(){return($t=e.stackSave=e.asm.S).apply(null,arguments)}),er=e.stackRestore=function(){return(er=e.stackRestore=e.asm.T).apply(null,arguments)},tr=e.stackAlloc=function(){return(tr=e.stackAlloc=e.asm.U).apply(null,arguments)};function rr(r){function i(){Yt||(Yt=!0,e.calledRun=!0,d||(e.noFSInit||Rt.init.initialized||Rt.init(),Bt.init(),ee(k),Rt.ignorePermissions=!1,ee(G),t(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),j.unshift(t);var t;ee(j)}()))}V>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),z.unshift(t);var t;ee(z)}(),V>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),i()}),1)):i()))}if(e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.V).apply(null,arguments)},e.dynCall_viijii=function(){return(e.dynCall_viijii=e.asm.W).apply(null,arguments)},e.dynCall_iiiiiijj=function(){return(e.dynCall_iiiiiijj=e.asm.X).apply(null,arguments)},e.dynCall_iiiiij=function(){return(e.dynCall_iiiiij=e.asm.Y).apply(null,arguments)},e.dynCall_iiiiijj=function(){return(e.dynCall_iiiiijj=e.asm.Z).apply(null,arguments)},e.ccall=function(t,r,i,n,s){var o={string:function(e){var t=0;if(null!=e&&0!==e){var r=1+(e.length<<2);y(e,t=tr(r),r)}return t},array:function(e){var t=tr(e.length);return R(e,t),t}},a=function(t){var r=e["_"+t];return p(r,"Cannot call unknown function "+t+", make sure it is exported"),r}(t),l=[],c=0;if(n)for(var h=0;h0;)e.preInit.pop()();return rr(),e.ready});const He=ke.mergeVertices;let Je;Ve().then((e=>Je=e),(()=>{}));const Qe=new t.Vector3,Ye=new t.Matrix4;new t.BoxGeometry(200,200,200).userData.type="CubeGeometry";const We=((je=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i;const n=null!==(r=e.geometry)&&void 0!==r?r:null==t?void 0:t.geometry,{width:s,height:o,depth:a}=n.userData.parameters,l=Object.assign(Object.assign({},null!==(i=null==t?void 0:t.parameters)&&void 0!==i?i:{width:s,height:o,depth:a,subdivisions:1}),e.parameters);return{parameters:Object.assign(Object.assign({},l),{width:Math.abs(l.width),height:Math.abs(l.height),depth:Math.abs(l.depth)}),geometry:n,subdivPointer:null==t?void 0:t.subdivPointer,smoothShading:null==t?void 0:t.smoothShading}}static build(e){var t;let r=e.geometry,i=e.geometry.originalGeometry;const{width:n,height:s,depth:o,subdivisions:a}=e.parameters,l=r.userData.parameters;if(Qe.set(l.width,l.height,l.depth),n!==Qe.x||s!==Qe.y||o!==Qe.z){const e=[n/Qe.x,s/Qe.y,o/Qe.z];Ye.makeScale(e[0],e[1],e[2]);const a=null!==(t=null==i?void 0:i.boundingSphere)&&void 0!==t?t:r.boundingSphere;a.center.applyMatrix4(Ye),r.boundingSphere=null,null==r||r.applyMatrix4(Ye),r.boundingSphere=a,i&&(i.boundingSphere=null,i.applyMatrix4(Ye),i.boundingSphere=a)}let c,h;return void 0!==i?(h=r,c=i):c=r,void 0===e.subdivPointer&&(this.allocate(c),console.log("allocated new subdiv instance at: ",this.activeSubdivPtr),null==c||c.dispose(),c=this.buildLevel(!0,e.smoothShading),c.computeBoundingSphere(),e.subdivPointer=this.activeSubdivPtr),a>0?(a===(null==l?void 0:l.subdivisions)&&void 0!==i||(e.subdivPointer!==this.activeSubdivPtr&&(this.activeSubdivPtr=e.subdivPointer),null==h||h.dispose(),Je.set_destination_refinement_level(e.subdivPointer,a),h=this.buildLevel(!1,e.smoothShading),h.boundingSphere=c.boundingSphere),r=h,i=c,delete i.userData.parameters):(r=c,null==h||h.dispose(),i=void 0),Object.assign(r,{originalGeometry:i,subdivPointer:this.activeSubdivPtr,userData:{parameters:e.parameters,type:"SubdivGeometry"}})}static allocate(e){let t,r,i;const n=[],s=[];if("SubdivGeometry"!==e.userData.type){const n=He(e,1.5);t=n.attributes.position.array;const s=n.getIndex().array,o=s.length;switch(e.userData.type){case"TorusGeometry":case"CubeGeometry":r=new Array(o/3*2),i=new Array(o/6).fill(4);for(let e=0,t=0;e>2,8+(n>>2)),o=s.subarray(4,8);let a=0;const l=Je.HEAPU32[s[a]>>2],c=Je.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;const h=Je.HEAPU32[s[a]>>2],u=Je.HEAPF32.subarray(h>>2,(h>>2)+o[a]);a++;const d=Je.HEAPU32[s[a]>>2],p=Je.HEAPU32.subarray(d>>2,(d>>2)+o[a]);a++;const f=Je.HEAPU32[s[a]>>2],m=Je.HEAPU32.subarray(f>>2,(f>>2)+o[a]);if(a++,void 0===i){const r=new t.BufferGeometry;if(e&&r.setAttribute("faceMap",new t.BufferAttribute(p.slice(),1)),r.setIndex(new t.Uint32BufferAttribute(m,1)),r.setAttribute("position",new t.Float32BufferAttribute(c,3)),r.setAttribute("normal",new t.Float32BufferAttribute(u,3)),e){const e=new Float32Array(u.length/3*4).fill(0);r.setAttribute("color",new t.BufferAttribute(e,4))}return Je.free_mesh_data(n),r.userData.type="SubdivGeometry",r}i.getAttribute("position").copyArray(c),i.getAttribute("normal").copyArray(u),i.attributes.position.needsUpdate=!0,i.attributes.normal.needsUpdate=!0,Je.free_mesh_data(n)}static buildControlCageWireframe(e,r){const i=Je.get_wireframe_data_for_base_level(this.activeSubdivPtr),n=Je.HEAPU32.subarray(i>>2,4+(i>>2)),s=n.subarray(2,4);let o=0;const a=Je.HEAPU32[n[o]>>2],l=Je.HEAPF32.subarray(a>>2,(a>>2)+s[o]);o++;const c=Je.HEAPU32[n[o]>>2],h=Je.HEAPU32.subarray(c>>2,(c>>2)+s[o]);if(void 0===e){const e=new t.BufferGeometry;e.setAttribute("position",new t.Float32BufferAttribute(l,3));const n=new Float32Array(l.length);for(let e=0,t=l.length;e0?(o=this.buildLevel(!1,r),n=o,s=i,delete s.userData.parameters):(n=i,s=void 0),Object.assign(n,{originalGeometry:s,subdivPointer:this.activeSubdivPtr,userData:{parameters:e,type:"SubdivGeometry"}})}}).checkpoints=[],je.checkpointCurrentIndex=-1,je.maxCheckpoints=30,je),Xe=(new t.Sphere,new t.Matrix4,new t.Ray,new t.Vector3,new t.Vector3,new t.Vector3,new t.Vector3,{ConeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n;const s=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,radialSegments:32,heightSegments:32,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},e.parameters);return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(null!==(i=s.height)&&void 0!==i?i:s.width),depth:Math.abs(null!==(n=s.depth)&&void 0!==n?n:s.width)})}}static build(e){const{width:r,depth:i,height:n,radialSegments:o,heightSegments:a,openEnded:l,thetaStart:c,thetaLength:h,cornerRadiusTop:u,cornerRadiusBottom:d,cornerSegments:p}=e.parameters;let f;return f=u>0||d>0||h<360?new s(0,r/2,n,o,a,l,c,h*Math.PI/180,u,d,p,0,!0):new t.ConeBufferGeometry(r/2,n,o,a,l),f.scale(1,1,i/r),Object.assign(f,{userData:Object.assign(Object.assign({},e),{type:"ConeGeometry"})})}},CubeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n;const s=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},e.parameters);return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(null!==(i=s.height)&&void 0!==i?i:s.width),depth:Math.abs(null!==(n=s.depth)&&void 0!==n?n:s.width)})}}static build(e){const{width:r,height:i,depth:n,widthSegments:s,heightSegments:o,depthSegments:l,cornerRadius:c,cornerSegments:h}=e.parameters;let u;return u=0==c?new t.BoxBufferGeometry(r,i,n,s,o,l):new a(r,i,n,s,o,l,c,h),Object.assign(u,{userData:Object.assign(Object.assign({},e),{type:"CubeGeometry"})})}},CylinderGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n,s,o;const a=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},e.parameters),l=a.width/2;let c=null!==(i=a.radiusTop)&&void 0!==i?i:l,h=null!==(n=a.radiusBottom)&&void 0!==n?n:l;return c===h?(c=l,h=l):c>h?(c=l,h=h*l/c):(c=c*l/h,h=l),{parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(null!==(s=a.height)&&void 0!==s?s:a.width),depth:Math.abs(null!==(o=a.depth)&&void 0!==o?o:a.width),radiusTop:c,radiusBottom:h})}}static build(e){const{width:r,depth:i,height:n,radialSegments:o,heightSegments:a,openEnded:l,thetaStart:c,thetaLength:h,radiusTop:u,radiusBottom:d,cornerRadius:p,cornerSegments:f,hollow:m}=e.parameters;let g;return g=p||m?new s(u,d,n,o,a,l,c,h*Math.PI/180,p,p,f,m):new t.CylinderBufferGeometry(u,d,n,o,a,l,c,h*Math.PI/180),g.scale(1,1,i/r),Object.assign(g,{userData:Object.assign(Object.assign({},e),{type:"CylinderGeometry"})})}},DodecahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n;const s=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,detail:0},e.parameters);return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(null!==(i=s.height)&&void 0!==i?i:s.width),depth:Math.abs(null!==(n=s.depth)&&void 0!==n?n:s.width)})}}static build(e){const{width:r,height:i,depth:n,detail:s}=e.parameters,o=new t.DodecahedronBufferGeometry(.5*r,s);return o.scale(1,i/r,n/r),Object.assign(o,{userData:Object.assign(Object.assign({},e),{type:"DodecahedronGeometry"})})}},EllipseGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i;const n=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,depth:0,spikes:128,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},e.parameters);return{shape:new R,parameters:Object.assign(n,{width:Math.abs(n.width),height:Math.abs(null!==(i=n.height)&&void 0!==i?i:n.width)})}}static build(e){const{width:t,height:r,spikes:i,angle:n,innerRadius:s,extrudeDepth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=e.parameters,h=e.shape,u=function(e,t,r,i,n,s){if(i>=he)return n>30||n%4==0?(function(e,t,r,i=0,n=0,s=0){const o=.5522847498,a=t*o,l=r*o;e.addPoint(pe(n-t,s,n-t,s-l,n-t,s+l)),e.addPoint(pe(n,s+r,n-a,s+r,n+a,s+r)),e.addPoint(pe(n+t,s,n+t,s+l,n+t,s-l)),e.addPoint(pe(n,s-r,n+a,s-r,n-a,s-r)),i>0&&me(e,t,r,i)}(e,t,r,s),Math.round(n/4)):ue(e,i,n,t,r,s);const o={x:0,y:r},a=i+.5*Math.PI,l={x:Math.cos(a)*t,y:Math.sin(a)*r},c=G({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:t,ry:r,largeArcFlag:i>Math.PI,sweepFlag:!0});return n>30||n%c.length==0?function(e,t,r,i,n,s,o,a){const l=Math.round(n/i.length);e.addPoint(de(t,r));for(let t=0,r=i.length;t0?fe(e,s,o,a):e.addPoint(de(0,0));return l}(e,o.x,o.y,c,n,t,r,s):ue(e,i,n,t,r,s)}(h,.5*t,.5*r,n*Math.PI/180,i,s);h.isClosed=!0,h.update();const d=ce.create({shape:h,parameters:{subdivisions:u,surfaceMaxCount:c,extrudeDepth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(d,{userData:Object.assign(Object.assign({},e),{type:"EllipseGeometry"})})}},HelixGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n;const s=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),o=Math.abs(s.width),a=Math.abs(null!==(i=s.height)&&void 0!==i?i:o),l=Math.abs(null!==(n=s.depth)&&void 0!==n?n:o),c=Math.abs(Math.min(o,l))/2;return{parameters:Object.assign(s,{width:o,height:a,depth:l,radius:c,segments:Math.round(s.segments),pathSegments:Math.round(s.pathSegments),cornerSegments:Math.round(s.cornerSegments)})}}static build(e){const{width:t,height:r,depth:i,radius:n,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:u}=e.parameters,d=new ve(!1,t,r,i,n,s,o,a,l,c,h,u);return Object.assign(d,{userData:Object.assign(Object.assign({},e),{type:"HelixGeometry"})})}},IcosahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n;const s=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,detail:0},e.parameters);return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(null!==(i=s.height)&&void 0!==i?i:s.width),depth:Math.abs(null!==(n=s.depth)&&void 0!==n?n:s.width)})}}static build(e){const{width:r,height:i,depth:n,detail:s}=e.parameters,o=new t.IcosahedronBufferGeometry(.5*r,s);return o.scale(1,i/r,n/r),Object.assign(o,{userData:Object.assign(Object.assign({},e),{type:"IcosahedronGeometry"})})}},LatheGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n;const s=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},e.parameters);return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(null!==(i=s.height)&&void 0!==i?i:s.width),depth:Math.abs(null!==(n=s.depth)&&void 0!==n?n:s.width)})}}static build(e){const{points:r,segments:i,verticalSegments:n}=e.parameters,s=new t.Shape;s.moveTo(r[0].x,r[0].y),s.bezierCurveTo(r[1].x,r[1].y,r[2].x,r[2].y,r[3].x,r[3].y);const o=new t.LatheBufferGeometry(s.extractPoints(n).shape,i);return o.rotateZ(Math.PI),Object.assign(o,{userData:Object.assign(Object.assign({},e),{type:"LatheGeometry"})})}},NonParametricGeometry:Be,PolygonGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r,i,n;const s=Object.assign({},null!==(r=null==t?void 0:t.parameters)&&void 0!==r?r:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:new R,parameters:Object.assign(s,{surfaceMaxCount:(null!==(i=s.surfaceMaxCount)&&void 0!==i?i:s.cornerRadius>0)?1e3:100,width:Math.abs(s.width),height:Math.abs(null!==(n=s.height)&&void 0!==n?n:s.width)})}}static build(e){const{width:t,height:r,spikes:i,cornerRadius:n,extrudeDepth:s,extrudeBevelSize:o,extrudeBevelSegments:a,surfaceMaxCount:l}=e.parameters,c=e.shape,h=.5*t,u=.5*r,d=2*Math.PI/i;for(let e=0;e0)?1e3:100,width:Math.abs(s.width),height:Math.abs(null!==(n=s.height)&&void 0!==n?n:s.width)})}}static build(e){const{width:t,height:r,innerRadiusPercent:i,spikes:n,cornerRadius:s,angle:o,extrudeDepth:a,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:h}=e.parameters,u=e.shape,d=.5*t,p=.5*r;let f=o*Math.PI/360/n,m=Math.PI/2*3*-1;const g=d*i/100,v=p*i/100;if(3==n&&50==i){f=2*Math.PI/n;for(let e=0;e0)?1e3:100,width:Math.abs(s.width),height:Math.abs(null!==(n=s.height)&&void 0!==n?n:s.width*(s.isRect?1:Math.sqrt(3)/2))})}}static build(e){const{width:t=100,height:r,cornerRadius:i,extrudeDepth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,surfaceMaxCount:l}=e.parameters,c=e.shape,h=.5*t,u=.5*r;a?(c.addPoint(c.createPoint(-h,u)),c.addPoint(c.createPoint(h,-u)),c.addPoint(c.createPoint(-h,-u))):(c.addPoint(c.createPoint(0,u)),c.addPoint(c.createPoint(h,-u)),c.addPoint(c.createPoint(-h,-u))),c.isClosed=!0;for(let e=0,t=c.points.length;eXe[e.type].create(e),qe=e=>"isEntity"in e,Ze=e=>"isAbstractMesh"in e,$e=e=>"objectHelper"in e,et=new t.Box3,tt=new t.Vector3,rt=new t.Vector3,it=new t.Matrix4;const nt=(e,r,i,n)=>{var s,o;if(Ze(e)){const t=e.geometry.userData.parameters,r=e.geometry.getAttribute("position");"SubdivGeometry"===e.geometry.userData.type?tt.copy((null!==(s=e.geometry.originalGeometry)&&void 0!==s?s:e.geometry).boundingSphere.center):(!function(e,t,r=0,i=t.count){let n=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let e=r;ea&&(a=r),i>l&&(l=i),h>c&&(c=h)}e.min.set(n,s,o),e.max.set(a,l,c)}(et,r,e.geometry.drawRange.start,e.geometry.drawRange.count<1/0?e.geometry.drawRange.count:r.count),et.getCenter(tt)),e.forceComputeSize?et.getSize(rt).multiplyScalar(.5):rt.set(t.width,t.height,null!==(o=t.depth)&&void 0!==o?o:0).multiplyScalar(.5)}else if($e(e)&&!0===n){const t=e.geometryHelper.getAttribute("position");et.setFromArray(t.array),et.getCenter(tt),et.getSize(rt).multiplyScalar(.5)}else tt.setScalar(0),rt.setScalar(0);it.copy(r).multiply(e.matrixWorld),0===rt.x&&0===rt.y&&0===rt.z?i.push(new t.Vector3(tt.x,tt.y,tt.z).applyMatrix4(it)):i.push(new t.Vector3(-rt.x,rt.y,rt.z).add(tt).applyMatrix4(it),new t.Vector3(-rt.x,-rt.y,rt.z).add(tt).applyMatrix4(it),new t.Vector3(rt.x,-rt.y,rt.z).add(tt).applyMatrix4(it),new t.Vector3(rt.x,rt.y,rt.z).add(tt).applyMatrix4(it),new t.Vector3(-rt.x,rt.y,-rt.z).add(tt).applyMatrix4(it),new t.Vector3(-rt.x,-rt.y,-rt.z).add(tt).applyMatrix4(it),new t.Vector3(rt.x,-rt.y,-rt.z).add(tt).applyMatrix4(it),new t.Vector3(rt.x,rt.y,-rt.z).add(tt).applyMatrix4(it))};class st extends t.Box3{constructor(e,r){super(e,r),this.transform=new t.Matrix4,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}setFromObjectSize(e,r=!1){e.updateWorldMatrix(!1,!1),this.makeEmpty(),this.transform=e.matrixWorld;const i=(new t.Matrix4).copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,r)}expandByObjectSize(e,t,r=!1){const i=[];return!0===r?e.traverseEntity((r=>nt(r,t,i,"enableHelper"in e&&e.enableHelper))):nt(e,t,i,"enableHelper"in e&&e.enableHelper),this.setFromPoints(i)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.transform),e}getPositionToCenter(e){return e=super.getCenter(e)}computeVertices(){this.getSize(rt).multiplyScalar(.5),this.getCenter(tt),it.copy(this.transform).setPosition(tt),this.vertices=[new t.Vector3(-rt.x,rt.y,rt.z).applyMatrix4(it),new t.Vector3(-rt.x,-rt.y,rt.z).applyMatrix4(it),new t.Vector3(rt.x,-rt.y,rt.z).applyMatrix4(it),new t.Vector3(rt.x,rt.y,rt.z).applyMatrix4(it),new t.Vector3(-rt.x,rt.y,-rt.z).applyMatrix4(it),new t.Vector3(-rt.x,-rt.y,-rt.z).applyMatrix4(it),new t.Vector3(rt.x,-rt.y,-rt.z).applyMatrix4(it),new t.Vector3(rt.x,rt.y,-rt.z).applyMatrix4(it)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new t.Line3(this.vertices[0],this.vertices[3]),new t.Line3(this.vertices[1],this.vertices[2]),new t.Line3(this.vertices[5],this.vertices[6]),new t.Line3(this.vertices[4],this.vertices[7]),new t.Line3(this.vertices[0],this.vertices[1]),new t.Line3(this.vertices[3],this.vertices[2]),new t.Line3(this.vertices[7],this.vertices[6]),new t.Line3(this.vertices[4],this.vertices[5]),new t.Line3(this.vertices[0],this.vertices[4]),new t.Line3(this.vertices[1],this.vertices[5]),new t.Line3(this.vertices[2],this.vertices[6]),new t.Line3(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map((e=>e.getCenter(new t.Vector3)))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[(new t.Vector3).copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),(new t.Vector3).copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),(new t.Vector3).copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),(new t.Vector3).copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),(new t.Vector3).copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),(new t.Vector3).copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}}var ot,at;!function(e){e.POSITION="position",e.LIGHTING="light",e.COLOR="color",e.GRADIENT="gradient",e.NORMAL="normal",e.DEPTH="depth",e.TEXTURE="texture",e.NOISE="noise",e.FRESNEL="fresnel",e.RAINBOW="rainbow",e.POINTS="points",e.MATCAP="matcap",e.LINES="lines",e.DISPLACE="displace"}(ot||(ot={})),function(e){e.POSITION="position",e.LIGHTING="light",e.COLOR="color"}(at||(at={}));class lt{constructor(e,t,r){if(this.next=void 0,this.uniforms={},this.textures={},this.defines={},this.backLayer=void 0,this.isBack=!1,this.id=e,t){this.type=t.type;for(const e in t)"type"!==e&&"calpha"!==e&&(this.uniforms[`f${this.id}_${e}`]=t[e]);for(const e in r)this.defines[e]=r[e]}}copy(e){this.id=e.id,this.type=e.type,this.defines=Object.assign({},e.defines);for(const t in e.uniforms)this.uniforms[t]?this.uniforms[t].copy(e.uniforms[t]):this.uniforms[t]=e.uniforms[t].clone();return this}clone(){return new lt(this.id).copy(this)}fromJSON(e,t){this.id=e.id,this.defines=Object.assign({},e.defines);for(const r in e.uniforms)this.uniforms[r]=t.getNode(e.uniforms[r]);return this}toJSON(e){const t={};for(const r in this.uniforms)t[r]=this.uniforms[r].toJSON(e).uuid;return{id:this.id,type:this.type,defines:JSON.parse(JSON.stringify(this.defines)),uniforms:t,next:null==this.next?void 0:this.next.toJSON(e)}}copyUniforms(e){for(const t in this.uniforms){const r=this.getName(t);void 0!==r&&this.uniforms[t].copy(e.uniforms[`f${e.id}_${r}`])}return this}hasValueByKey(e){return void 0!==this.uniforms[e]}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){const r=`f${this.id}_${e}`;this.hasValueByKey(r)&&void 0!==t&&(this.uniforms[r].value=t)}getValue(e){const t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t].value}getValues(){const e={type:this.type};for(const t in this.uniforms){const r=this.getName(t);if(void 0===r)continue;const i=this.uniforms[`f${this.id}_${r}`].value;void 0!==i&&(e[r]=i.clone?i.clone():i)}return e}getName(e){const t=/f\d+_(.*)/.exec(e);if(t&&t.length>1)return t[1];console.log(`Layer.getName: error ${e}`)}getNames(){const e=[];for(const t in this.uniforms){const r=this.getName(t);r&&e.push(r)}return e}isEqual(e){for(const r in e.uniforms){const i=e.getName(r);if(!i)return!1;const n=this.getValue(i),s=e.uniforms[r].value;if(s.value instanceof t.Texture){if(n.image!==s.image)return!1}else if(Array.isArray(s)){const e=n;for(let t=0,r=e.length;t(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=i,t.output=r)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return"sampler2D"===t||"samplerCube"===t?t:this.type}getJSONNode(e){if((null==e?void 0:e.materials)&&void 0!==(null==e?void 0:e.materials[this.uuid]))return e.materials[this.uuid]}getHash(){let e,t,r="{";for(e in this)t=this[e],t instanceof ut&&(r+='"'+e+'":'+t.getHash()+",");if(this.hashProperties)for(let i=0;ie))),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return(new this.constructor).copy(this)}createJSONNode(e){const t=void 0===e||"string"==typeof e;if("string"!=typeof this.type)throw new Error("Node does not allow serialization.");const r={};return r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}toJSON(e){var t;return null!==(t=this.getJSONNode(e))&&void 0!==t?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}}class dt extends ut{constructor(e,t){super(e),this.scope="",t=null!=t?t:{},this.shared=void 0===t.shared||t.shared,this.unique=void 0!==t.unique&&t.unique}build(e,r,i,n){if(r=null!=r?r:this.getType(e),this.getShared(e,r)){const s=this.getUnique(e,r);s&&void 0===this.uuid&&(this.uuid=t.MathUtils.generateUUID()),i=e.getUUID(null!=i?i:this.getUUID(),!s);const o=e.getNodeData(i),a=o.output||this.getType(e);if(e.analyzing)return(o.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,o,r),this.generate(e,r,i)):super.build(e,r,i);if(s)return o.name=o.name||super.build(e,r,i),o.name;if(!this.getLabel()&&(!this.getShared(e,a)||e.context.ignoreCache||1===o.deps))return super.build(e,r,i);i=this.getUUID(!1);let l=this.getTemp(e,i);if(l)return e.format(l,a,r);{l=super.generate(e,r,i,o.output,n);const t=this.generate(e,a,i);return e.addNodeCode(l+" = "+t+";"),e.format(l,a,r)}}return super.build(e,r,i)}getShared(e,t){return"sampler2D"!==t&&"samplerCube"!==t&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return"string"==typeof this.scope&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;const r=e.getVars()[t];return r?r.name:void 0}generate(e,t,r,i,n){return this.getShared(e,t)||console.error("TempNode is not shared"),r=null!=r?r:this.uuid,e.getTempVar(r,null!=i?i:this.getType(e),n,this.getLabel()).name}}class pt extends dt{constructor(e,t){(t=null!=t?t:{}).shared=void 0!==t.shared&&t.shared,super(e,t),this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(e){const t=super.createJSONNode(e);return!0===this.readonly&&(t.readonly=this.readonly),t}fromJSON(e,t){return super.fromJSON(e,t),void 0!==e.readonly&&this.setReadonly(e.readonly),this}generate(e,t,r,i,n,s){r=e.getUUID(null!=r?r:this.getUUID()),i=null!=i?i:this.getType(e);const o=e.getNodeData(r);return this.getReadonly()&&void 0!==this.generateReadonly?this.generateReadonly(e,t,r,i,n,s):e.isShader("vertex")?(o.vertex||(o.vertex=e.createVertexUniform(i,this,n,s,this.getLabel())),e.format(o.vertex.name,i,t)):(o.fragment||(o.fragment=e.createFragmentUniform(i,this,n,s,this.getLabel())),e.format(o.fragment.name,i,t))}copy(e){return super.copy(e),this.readonly=e.readonly,this}}const ft={elements:["x","y","z","w"],addShortcuts:function(){function e(e,t,r){return r?{get:function(){return this[e][t][r]},set:function(i){this[e][t][r]=i}}:{get:function(){return this[e][t]},set:function(r){this[e][t]=r}}}return function(t,r,i){const n={};for(let t=0;te.clone())),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value.map((e=>({x:e.x,y:e.y,z:e.z,w:e.w})))),t.nodeType=this.nodeType,t}fromJSON(e,r){return super.fromJSON(e,r),e.value&&(this.value=e.value.map((e=>new t.Vector4(e.x,e.y,e.z,e.w))),this.size=this.value.length),this}}class bt extends pt{constructor(e=1,t){super("f[]"),this.nodeType="FloatArray",this.size=e,this.value=Array.isArray(t)?t:"number"==typeof t?new Array(e).fill(t):new Array(e).fill(0)}copy(e){return super.copy(e),this.size=e.size,this.value=[...e.value],this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.size=this.size,t.value=[...this.value]),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=[...e.value]),e.size?this.size=e.size:e.value&&(this.size=this.value.length),this}}const St=new class{constructor(){this.nodes={},this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=void 0===r||r,this.keywords[e]={callback:t,cache:r}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return void 0!==this.nodes[e]}containsKeyword(e){return void 0!==this.keywords[e]}};class Et extends dt{constructor(e){super("v2",{shared:!1}),this.nodeType="UV",this.index=null!=e?e:0}generate(e,t){e.requires.uv[this.index]=!0;const r=this.index>0?this.index+1:"",i=e.isShader("vertex")?"uv"+r:"vUv"+r;return e.format(i,this.getType(e),t)}copy(e){return super.copy(e),this.index=e.index,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.index=this.index),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.index&&(this.index=e.index),this}}St.addKeyword("uv",(function(){return new Et})),St.addKeyword("uv2",(function(){return new Et(1)}));const Ct=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,Tt=/[a-z_0-9]+/gi;class Ot extends dt{constructor(e,t,r,i,n){super(n),this.src="",this.nodeType="Function",this.useKeywords=!0,this.includes=[],this.extensions={},this.keywords={},this.isMethod=void 0===n,this.isInterface=!1,this.parse(e,t,r,i)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,r,i,n){let s,o=0,a=this.src;if(this.includes)for(let t=0;tt.getNode(e)))),this}}const Dt=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i;class Mt extends dt{constructor(e="",t){super(),this.src="",this.useDefine=!1,this.nodeType="Const",this.parse(e||Mt.PI,void 0,void 0,void 0,t)}getType(e){return e.getTypeByFormat(this.type)}parse(e,t,r,i,n){this.src=e||"";let s,o,a="";const l=Dt.exec(e);this.useDefine=null!=n?n:"#"===this.src.charAt(0),l&&l.length>1?(o=l[1],s=l[2],a=l[3]):(s=this.src,o="f"),this.name=s,this.type=o,this.value=a}build(e,t){if("source"===t){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,r,i,n){return e.format(this.name,this.getType(e),t)}copy(e){return super.copy(e),this.parse(e.src,void 0,void 0,void 0,e.useDefine),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.src=this.src,t.useDefine=this.useDefine,t.value=this.value,t.name=this.name),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.src&&(this.src=e.src),e.value&&(this.value=e.value),e.name&&(this.name=e.name),void 0!==e.useDefine&&(this.useDefine=e.useDefine),this}}Mt.PI="PI",Mt.PI2="PI2",Mt.RECIPROCAL_PI="RECIPROCAL_PI",Mt.RECIPROCAL_PI2="RECIPROCAL_PI2",Mt.LOG2="LOG2",Mt.EPSILON="EPSILON";class _t extends Ot{constructor(e="",t,r,i,n){super(e,n,i,r,t),this.nodeType="Expression"}}class Nt extends dt{constructor(e=new ut,t){super("v4"),this.nodeType="ColorSpace",this.factor=new ut,this.input=e,this.method=null!=t?t:Nt.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case t.LinearEncoding:return["Linear"];case t.sRGBEncoding:return["sRGB"];case t.RGBEEncoding:return["RGBE"];case t.RGBM7Encoding:return["RGBM",new gt(7).setReadonly(!0)];case t.RGBM16Encoding:return["RGBM",new gt(16).setReadonly(!0)];case t.RGBDEncoding:return["RGBD",new gt(256).setReadonly(!0)];case t.GammaEncoding:return["Gamma",new _t("float( GAMMA_FACTOR )","f")];default:return[]}}generate(e,t){const r=this.input.build(e,"v4"),i=this.getType(e),n=Nt.Nodes[this.method],s=e.include(n);if(s===Nt.LINEAR_TO_LINEAR)return e.format(r,i,t);if(2===n.inputs.length){const n=this.factor.build(e,"f");return e.format(s+"( "+r+", "+n+" )",i,t)}return e.format(s+"( "+r+" )",i,t)}fromEncoding(e){const t=Nt.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){const t=Nt.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}copy(e){return super.copy(e),this.input.copy(e.input),this.method=e.method,this.factor.copy(e.factor),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.input=this.input.toJSON(e).uuid,t.factor=this.factor.toJSON(e).uuid,t.method=this.method),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.input&&(this.input=t.getNode(e.input)),e.factor&&(this.factor=t.getNode(e.factor)),e.method&&(this.method=e.method),this}}Nt.Nodes={LinearToLinear:new Ot(["vec4 LinearToLinear( in vec4 value ) {","\treturn value;","}"].join("\n")),GammaToLinear:new Ot(["vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {","\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );","}"].join("\n")),LinearToGamma:new Ot(["vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {","\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );","}"].join("\n")),sRGBToLinear:new Ot(["vec4 sRGBToLinear( in vec4 value ) {","\treturn 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.w );","}"].join("\n")),LinearTosRGB:new Ot(["vec4 LinearTosRGB( in vec4 value ) {","\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join("\n")),RGBEToLinear:new Ot(["vec4 RGBEToLinear( in vec4 value ) {","\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );","}"].join("\n")),LinearToRGBE:new Ot(["vec4 LinearToRGBE( in vec4 value ) {","\tfloat maxComponent = max( max( value.r, value.g ), value.b );","\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );","\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );","}"].join("\n")),RGBMToLinear:new Ot(["vec3 RGBMToLinear( in vec4 value, in float maxRange ) {","\treturn vec4( value.xyz * value.w * maxRange, 1.0 );","}"].join("\n")),LinearToRGBM:new Ot(["vec3 LinearToRGBM( in vec4 value, in float maxRange ) {","\tfloat maxRGB = max( value.x, max( value.g, value.b ) );","\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );","\tM = ceil( M * 255.0 ) / 255.0;","\treturn vec4( value.rgb / ( M * maxRange ), M );","}"].join("\n")),RGBDToLinear:new Ot(["vec3 RGBDToLinear( in vec4 value, in float maxRange ) {","\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );","}"].join("\n")),LinearToRGBD:new Ot(["vec3 LinearToRGBD( in vec4 value, in float maxRange ) {","\tfloat maxRGB = max( value.x, max( value.g, value.b ) );","\tfloat D = max( maxRange / maxRGB, 1.0 );","\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );","\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );","}"].join("\n")),cLogLuvM:new Mt("const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );"),LinearToLogLuv:new Ot(["vec4 LinearToLogLuv( in vec4 value ) {","\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;","\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));","\tvec4 vResult;","\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;","\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;","\tvResult.w = fract(Le);","\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;","\treturn vResult;","}"].join("\n"),[new Mt("const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );")]),cLogLuvInverseM:new Mt("const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );"),LogLuvToLinear:new Ot(["vec4 LogLuvToLinear( in vec4 value ) {","\tfloat Le = value.z * 255.0 + value.w;","\tvec3 Xp_Y_XYZp;","\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);","\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;","\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;","\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;","\treturn vec4( max(vRGB, 0.0), 1.0 );","}"].join("\n"),[new Mt("const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );")])},Nt.LINEAR_TO_LINEAR="LinearToLinear",Nt.GAMMA_TO_LINEAR="GammaToLinear",Nt.LINEAR_TO_GAMMA="LinearToGamma",Nt.SRGB_TO_LINEAR="sRGBToLinear",Nt.LINEAR_TO_SRGB="LinearTosRGB",Nt.RGBE_TO_LINEAR="RGBEToLinear",Nt.LINEAR_TO_RGBE="LinearToRGBE",Nt.RGBM_TO_LINEAR="RGBMToLinear",Nt.LINEAR_TO_RGBM="LinearToRGBM",Nt.RGBD_TO_LINEAR="RGBDToLinear",Nt.LINEAR_TO_RGBD="LinearToRGBD",Nt.LINEAR_TO_LOG_LUV="LinearToLogLuv",Nt.LOG_LUV_TO_LINEAR="LogLuvToLinear";class Lt extends t.Texture{toJSON(e){const t=super.toJSON(e),r=void 0===e||"string"==typeof e;if(void 0!==this.image&&!r){const t=this.image;if(Array.isArray(t)){e.images[t.uuid].url=[];for(let r=0;r 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\t\t\t\treturn col;\n\t\t\t}`);r=e.include(t);break;default:r=e.include(zt.Nodes.uv)}if(this.projection.value===Ft.PLANAR&&this.firstTime){const t=`g${this.uuid.toString().replace(/-/g,"")}`;e.addVertexParsCode(`varying vec2 ${t}_vCustomUv;`),e.addFragmentParsCode(`varying vec2 ${t}_vCustomUv;`),e.addVertexFinalCode(`\n vec3 ${t}_posN = normalize(transformed);\n${0===this.axis.value?`\n\t\t\t\t\t\t\t\t\t float ${t}_u = (1. + (${t}_posN.z)) / 2.;\n\t\t\t\t\t\t\t\t\t float ${t}_v = (1. + (${t}_posN.y)) / 2.;\n\t\t\t\t\t\t\t\t\t `:""}\n\n${1===this.axis.value?`\n\t\t\t\t\t\t\t\t\t float ${t}_u = (1. + (${t}_posN.x)) / 2.;\n\t\t\t\t\t\t\t\t\t float ${t}_v = (1. - (${t}_posN.z)) / 2.;\n\t\t\t\t\t\t\t\t\t `:""}\n\n${2===this.axis.value?`\n\t\t\t\t\t\t\t\t\t float ${t}_u = (1. + (${t}_posN.x)) / 2.;\n\t\t\t\t\t\t\t\t\t float ${t}_v = (1. + (${t}_posN.y)) / 2.;\n\t\t\t\t\t\t\t\t\t `:""}\n\n ${t}_vCustomUv = vec2(${t}_u, ${t}_v);\n `)}e.addFragmentVariable(this.calpha,"float");const i=[];return i.push(this.texture.getTexture(e,"t")),i.push(this.textureSize.build(e,"v2")),i.push(this.crop.build(e,"f")),i.push(this.mat.build(e,"mat3")),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),this.firstTime=!this.firstTime,e.format(r+"("+i.join(",")+")",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.texture=this.texture.toJSON(e).uuid,t.textureSize=this.textureSize.toJSON(e).uuid,t.crop=this.crop.toJSON(e).uuid,t.projection=this.projection.toJSON(e).uuid,t.axis=this.axis.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.texture&&(this.texture=t.getNode(e.texture),this.texture.value.updateMatrix(),this.mat=new Rt(this.texture.value.matrix)),e.textureSize&&(this.textureSize=t.getNode(e.textureSize)),e.crop&&(this.crop=t.getNode(e.crop)),e.projection&&(this.projection=t.getNode(e.projection)),e.axis&&(this.axis=t.getNode(e.axis)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.mode&&(this.mode=t.getNode(e.mode)),e.calpha&&(this.calpha=e.calpha),this}copy(e){return super.copy(e),this.texture.copy(e.texture),this.textureSize.copy(e.textureSize),this.crop.copy(e.crop),this.projection.copy(e.projection),this.axis.copy(e.axis),this.alpha.copy(e.alpha),this.mode.copy(e.mode),this}}zt.Nodes={cylindrical:new Ot("\nvec3 cylindricalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, float alpha, int mode, out float calpha) {\n vec3 posN = normalize(vPosition);\n float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);\n float v = (posN.y / 2.) + .5;\n\n vec2 calculatedUv = vec2(u,v);\n\t\t\t\tvec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\n vec2 df = fwidth(uvs);\n \tif(df.x > 0.5) df.x = 0.;\n vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\t\t\t\treturn col;\n\t\t\t}\n"),spherical:new Ot("\nvec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, float alpha, int mode, out float calpha) {\n vec3 posN = normalize(vPosition);\n float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);\n float v = 0.5 + asin(posN.y) / 3.1415;\n\n vec2 calculatedUv = vec2(u,v);\n\t\t\t\tvec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\n vec2 df = fwidth(uvs);\n \tif(df.x > 0.5) df.x = 0.;\n vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\t\t\t\treturn col;\n\t\t\t}\n"),uv:new Ot("vec3 uvTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, float alpha, int mode, out float calpha) {\n\n\t\t\t\tvec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\t\t\t\tvec4 tmp = texture2D( tex, uvs );\n\n\t\t\t\tvec3 col = tmp.rgb;\n\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\t\t\t\treturn col;\n\t\t\t}")};class kt extends dt{constructor(e=new ut,t=new ut,r=new ut,i=new ut,n=new ut,s=new ut,o=new ut){super("v3"),this.nodeType="Fresnel",this.color=e,this.bias=t,this.scale=r,this.intensity=i,this.factor=n,this.alpha=s,this.mode=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("vWorldNormal"),e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");const r=e.include(kt.Nodes.fresnel),i=[];return i.push(this.color.build(e,"c")),i.push(this.bias.build(e,"f")),i.push(this.scale.build(e,"f")),i.push(this.intensity.build(e,"f")),i.push(this.factor.build(e,"f")),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),e.format(r+"("+i.join(",")+")",this.getType(e),t)}return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.color=this.color.toJSON(e).uuid,t.bias=this.bias.toJSON(e).uuid,t.scale=this.scale.toJSON(e).uuid,t.intensity=this.intensity.toJSON(e).uuid,t.factor=this.factor.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.color&&(this.color=t.getNode(e.color)),e.bias&&(this.bias=t.getNode(e.bias)),e.scale&&(this.scale=t.getNode(e.scale)),e.intensity&&(this.intensity=t.getNode(e.intensity)),e.factor&&(this.factor=t.getNode(e.factor)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.mode&&(this.mode=t.getNode(e.mode)),e.calpha&&(this.calpha=e.calpha),this}copy(e){return super.copy(e),this.color.copy(e.color),this.bias.copy(e.bias),this.scale.copy(e.scale),this.intensity.copy(e.intensity),this.factor.copy(e.factor),this.alpha.copy(e.alpha),this.mode.copy(e.mode),this.calpha=e.calpha,this}}kt.Nodes={fresnel:new Ot("vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, float alpha, int mode, out float calpha) {\n\t\t\t\tfloat fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWorldNormal ) ) ), intensity );\n\n\t\t\t\tfloat lalpha = clamp( fresnel, 0.0, 1.0 ) * alpha;\n\t\t\t\tcalpha = lalpha / clamp(lalpha + accumAlpha, 0.001, 1.0);\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha;\n\t\t\t\treturn color;\n\t\t\t}")},function(e){e.SIMPLEX="simplex3d",e.SIMPLEX_FRACTAL="simplex3dFractal",e.ASHIMA="simplexAshima",e.FBM="fbm",e.PERLIN="perlin"}(Ut||(Ut={}));const Gt=function(){const e=new Ot("vec3 random3(vec3 c) {\n\t\t\tfloat j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));\n\t\t\tvec3 r;\n\t\t\tr.z = fract(512.0*j);\n\t\t\tj *= .125;\n\t\t\tr.x = fract(512.0*j);\n\t\t\tj *= .125;\n\t\t\tr.y = fract(512.0*j);\n\t\t\treturn r-0.5;\n\t\t}"),t=new Ot("float simplex3d(vec3 p) {\n\t\t\t vec3 s = floor(p + dot(p, vec3(F3)));\n\t\t\t vec3 x = p - s + dot(s, vec3(G3));\n\t\t\t \n\t\t\t vec3 e = step(vec3(0.0), x - x.yzx);\n\t\t\t vec3 i1 = e*(1.0 - e.zxy);\n\t\t\t vec3 i2 = 1.0 - e.zxy*(1.0 - e);\n\t\t\t\t\n\t\t\t vec3 x1 = x - i1 + G3;\n\t\t\t vec3 x2 = x - i2 + 2.0*G3;\n\t\t\t vec3 x3 = x - 1.0 + 3.0*G3;\n\t\t\t \n\t\t\t vec4 w, d;\n\t\t\t \n\t\t\t w.x = dot(x, x);\n\t\t\t w.y = dot(x1, x1);\n\t\t\t w.z = dot(x2, x2);\n\t\t\t w.w = dot(x3, x3);\n\t\t\t \n\t\t\t w = max(0.6 - w, 0.0);\n\t\t\t \n\t\t\t d.x = dot(random3(s), x);\n\t\t\t d.y = dot(random3(s + i1), x1);\n\t\t\t d.z = dot(random3(s + i2), x2);\n\t\t\t d.w = dot(random3(s + 1.0), x3);\n\t\t\t \n\t\t\t w *= w;\n\t\t\t w *= w;\n\t\t\t d *= w;\n\t\t\t \n\t\t\t return dot(d, vec4(52.0));\n\t\t}",[e]);t.keywords.F3=new Mt("float F3 0.3333333"),t.keywords.G3=new Mt("float G3 0.1666667");const r=new Ot("float simplex3dFractal(vec3 m) {\n\t\t\tmat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);\n\t\t\tmat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);\n\t\t\tmat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);\n\t\t\treturn 0.5333333 * simplex3d(m * rot1)\n\t\t\t\t + 0.2666667 * simplex3d(2.0 * m * rot2)\n\t\t\t\t + 0.1333333 * simplex3d(4.0 * m * rot3)\n\t\t\t\t + 0.0666667 * simplex3d(8.0 * m);\n\t\t}",[t]),i=new Ot("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),n=new Ot("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),s=new Ot("float simplexAshima(vec3 v) {\n\t\t const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n\t\t const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\t\t vec3 i = floor(v + dot(v, C.yyy) );\n\t\t vec3 x0 = v - i + dot(i, C.xxx) ;\n\t\t vec3 g = step(x0.yzx, x0.xyz);\n\t\t vec3 l = 1.0 - g;\n\t\t vec3 i1 = min( g.xyz, l.zxy );\n\t\t vec3 i2 = max( g.xyz, l.zxy );\n\t\t vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n\t\t vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n\t\t vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n\t\t i = mod(i, 289.0 ); \n\t\t vec4 p = permute( permute( permute( \n\t\t\t\t\t i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n\t\t\t\t + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) \n\t\t\t\t + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\t\t float n_ = 1.0/7.0; // N=7\n\t\t vec3 ns = n_ * D.wyz - D.xzx;\n\t\t vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)\n\t\t vec4 x_ = floor(j * ns.z);\n\t\t vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\t\t vec4 x = x_ *ns.x + ns.yyyy;\n\t\t vec4 y = y_ *ns.x + ns.yyyy;\n\t\t vec4 h = 1.0 - abs(x) - abs(y);\n\t\t vec4 b0 = vec4( x.xy, y.xy );\n\t\t vec4 b1 = vec4( x.zw, y.zw );\n\t\t vec4 s0 = floor(b0)*2.0 + 1.0;\n\t\t vec4 s1 = floor(b1)*2.0 + 1.0;\n\t\t vec4 sh = -step(h, vec4(0.0));\n\t\t vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n\t\t vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\t\t vec3 p0 = vec3(a0.xy,h.x);\n\t\t vec3 p1 = vec3(a0.zw,h.y);\n\t\t vec3 p2 = vec3(a1.xy,h.z);\n\t\t vec3 p3 = vec3(a1.zw,h.w);\n\t\t vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n\t\t p0 *= norm.x;\n\t\t p1 *= norm.y;\n\t\t p2 *= norm.z;\n\t\t p3 *= norm.w;\n\t\t vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n\t\t m = m * m;\n\t\t return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), \n\t\t\t\t\t\t\t\t\t\tdot(p2,x2), dot(p3,x3) ) );\n\t\t}",[i,n]),o=new Ot("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),a=new Ot("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[o]),l=new Ot("float noise(vec3 p){\n\t\t\tvec3 a = floor(p);\n\t\t\tvec3 d = p - a;\n\t\t\td = d * d * (3.0 - 2.0 * d);\n\t\t\tvec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);\n\t\t\tvec4 k1 = perm(b.xyxy);\n\t\t\tvec4 k2 = perm(k1.xyxy + b.zzww);\n\t\t\tvec4 c = k2 + a.zzzz;\n\t\t\tvec4 k3 = perm(c);\n\t\t\tvec4 k4 = perm(c + 1.0);\n\t\t\tvec4 o1 = fract(k3 * (1.0 / 41.0));\n\t\t\tvec4 o2 = fract(k4 * (1.0 / 41.0));\n\t\t\tvec4 o3 = o2 * d.z + o1 * (1.0 - d.z);\n\t\t\tvec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);\n\t\t\treturn o4.y * d.y + o4.x * (1.0 - d.y);\n\t\t}",[a]),c=new Ot("float fbm(vec3 x) {\n\t\t\tfloat v = 0.0;\n\t\t\tfloat a = 0.5;\n\t\t\tvec3 shift = vec3(100);\n\t\t\tfor (int i = 0; i < NUM_OCTAVES; ++i) {\n\t\t\t\tv += a * noise(x);\n\t\t\t\tx = x * 2.0 + shift;\n\t\t\t\ta *= 0.5;\n\t\t\t}\n\t\t\treturn v;\n\t\t}",[l]);c.keywords.NUM_OCTAVES=new Mt("int NUM_OCTAVES 5");const h=new Ot("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}");return{simplex:t,simplexFractal:r,simplexAshima:s,fbm:c,perlin:new Ot("float perlin(vec3 P){\n\t\t vec3 Pi0 = floor(P);\n\t\t vec3 Pi1 = Pi0 + vec3(1.0);\n\t\t Pi0 = mod(Pi0, 289.0);\n\t\t Pi1 = mod(Pi1, 289.0);\n\t\t vec3 Pf0 = fract(P);\n\t\t vec3 Pf1 = Pf0 - vec3(1.0);\n\t\t vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n\t\t vec4 iy = vec4(Pi0.yy, Pi1.yy);\n\t\t vec4 iz0 = Pi0.zzzz;\n\t\t vec4 iz1 = Pi1.zzzz;\n\t\t vec4 ixy = permute(permute(ix) + iy);\n\t\t vec4 ixy0 = permute(ixy + iz0);\n\t\t vec4 ixy1 = permute(ixy + iz1);\n\t\t vec4 gx0 = ixy0 / 7.0;\n\t\t vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;\n\t\t gx0 = fract(gx0);\n\t\t vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n\t\t vec4 sz0 = step(gz0, vec4(0.0));\n\t\t gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n\t\t gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\t\t vec4 gx1 = ixy1 / 7.0;\n\t\t vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;\n\t\t gx1 = fract(gx1);\n\t\t vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n\t\t vec4 sz1 = step(gz1, vec4(0.0));\n\t\t gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n\t\t gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\t\t vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n\t\t vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n\t\t vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n\t\t vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n\t\t vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n\t\t vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n\t\t vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n\t\t vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\t\t vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n\t\t g000 *= norm0.x;\n\t\t g010 *= norm0.y;\n\t\t g100 *= norm0.z;\n\t\t g110 *= norm0.w;\n\t\t vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n\t\t g001 *= norm1.x;\n\t\t g011 *= norm1.y;\n\t\t g101 *= norm1.z;\n\t\t g111 *= norm1.w;\n\t\t float n000 = dot(g000, Pf0);\n\t\t float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n\t\t float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n\t\t float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n\t\t float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n\t\t float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n\t\t float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n\t\t float n111 = dot(g111, Pf1);\n\t\t vec3 fade_xyz = fade(Pf0);\n\t\t vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n\t\t vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n\t\t float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); \n\t\t return 2.2 * n_xyz;\n\t\t}",[i,n,h])}}();class jt extends dt{constructor(e=new ut,t=new ut,r=new ut,i=new ut,n=new ut,s=new ut,o=new ut){super("v3"),this.nodeType="Rainbow",this.filmThickness=e,this.movement=t,this.wavelengths=r,this.noiseStrength=i,this.noiseScale=n,this.offset=s,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.require("normal"),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");const r=e.include(jt.Nodes.rainbow),i=[];return i.push(this.filmThickness.build(e,"f")),i.push(this.movement.build(e,"f")),i.push(this.wavelengths.build(e,"v3")),i.push(this.noiseStrength.build(e,"f")),i.push(this.noiseScale.build(e,"f")),i.push(this.offset.build(e,"v3")),i.push(this.alpha.build(e,"f")),i.push(this.calpha),e.format(r+"("+i.join(",")+")",this.getType(e),t)}return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.filmThickness=this.filmThickness.toJSON(e).uuid,t.movement=this.movement.toJSON(e).uuid,t.wavelengths=this.wavelengths.toJSON(e).uuid,t.noiseStrength=this.noiseStrength.toJSON(e).uuid,t.noiseScale=this.noiseScale.toJSON(e).uuid,t.offset=this.offset.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.filmThickness&&(this.filmThickness=t.getNode(e.filmThickness)),e.movement&&(this.movement=t.getNode(e.movement)),e.wavelengths&&(this.wavelengths=t.getNode(e.wavelengths)),e.noiseStrength&&(this.noiseStrength=t.getNode(e.noiseStrength)),e.noiseScale&&(this.noiseScale=t.getNode(e.noiseScale)),e.offset&&(this.offset=t.getNode(e.offset)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.calpha&&(this.calpha=e.calpha),this}copy(e){return super.copy(e),this.filmThickness.copy(e.filmThickness),this.movement.copy(e.movement),this.wavelengths.copy(e.wavelengths),this.noiseStrength.copy(e.noiseStrength),this.noiseScale.copy(e.noiseScale),this.offset.copy(e.offset),this.alpha.copy(e.alpha),this.calpha=e.calpha,this}}jt.Nodes=function(){const e=new Ot("vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {\n vec3 viewDir = normalize(-(cameraPosition + offset));\n vec3 st = normalize(position) * noiseScale;\n\t\t\t\t vec3 q = vec3(simplex3d(st),\n\t\t\t\t\t\t\t simplex3d(st + vec3(1.0)),\n\t\t\t\t\t\t\t simplex3d(st + vec3(1.0)));\n\n\t\t\t\t vec3 r = vec3(simplex3d(st + vec3(1.4, 1.3, 1.0) * q + vec3(1.7, 9.2, 1.0)),\n\t\t\t\t\t\t\t simplex3d(st + vec3(2.0, 1.2, 1.0) * q + vec3(8.3, 2.8, 1.0)),\n\t\t\t\t\t\t\t simplex3d(st * q));\n\n float noise = simplex3d(st + r);\n\n return .5 + .5 * cos((((filmThickness + (noise * noiseStrength)) / (vec3(wavelengths.r * 1.0, wavelengths.g * 0.8, wavelengths.b * 0.6) + 1.0)) * dot(normalize(vObjectNormal), viewDir)) + movement);\n }",[Gt.simplex]);return{rainbow:new Ot("vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, float alpha, out float calpha) {\n vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);\n\n float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);\n float lalpha = alpha * rainbowContribution;\n calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n accumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\n return res;\n }",[e])}}();class Vt extends dt{constructor(e=new ut,t=new ut){super("v3"),this.nodeType="CustomNormal",this.cnormal=e,this.alpha=t}generate(e,t){if(e.isShader("fragment")){const r=e.include(Vt.Nodes.customNormal),i=[];return i.push(this.cnormal.build(e,"v3")),i.push("normal"),i.push(this.alpha.build(e,"f")),e.format(r+"("+i.join(",")+")",this.getType(e),t)}return console.warn("CustomNormalNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.cnormal=this.cnormal.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.cnormal&&(this.cnormal=t.getNode(e.cnormal)),e.alpha&&(this.alpha=t.getNode(e.alpha)),this}copy(e){return super.copy(e),this.cnormal.copy(e.cnormal),this.alpha.copy(e.alpha),this}}Vt.Nodes={customNormal:new Ot("vec3 customNormal(vec3 cnormal, vec3 norm, float alpha) {\n\t\t\t\tvec3 normal = packNormalToRGB( norm ).rgb;\n\t\t\t\tnormal *= step( vec3(0.5), cnormal );\n\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * alpha;\n\n\t\t\t\treturn normal;\n\t\t\t}")};class Ht extends dt{constructor(e=new ut,t=new ut,r=new ut,i=new ut,n=new ut,s=new ut,o=new ut,a=new ut,l=new ut){super("v3"),this.nodeType="Gradient",this.glType=e,this.num=t,this.smooth=r,this.colors=i,this.steps=n,this.offset=s,this.morph=o,this.angle=a,this.alpha=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");const r=e.include(Ht.Nodes.gradient),i=[];return i.push(this.glType.build(e,"i")),i.push(this.num.build(e,"i")),i.push(this.smooth.build(e,"b")),i.push(this.colors.build(e,"v4[]")),i.push(this.steps.build(e,"f[]")),i.push(this.offset.build(e,"v2")),i.push(this.morph.build(e,"v2")),i.push(this.angle.build(e,"f")),i.push(this.alpha.build(e,"f")),i.push(this.calpha),e.format(r+"("+i.join(",")+")",this.getType(e),t)}return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.glType=this.glType.toJSON(e).uuid,t.num=this.num.toJSON(e).uuid,t.smooth=this.smooth.toJSON(e).uuid,t.colors=this.colors.toJSON(e).uuid,t.steps=this.steps.toJSON(e).uuid,t.offset=this.offset.toJSON(e).uuid,t.morph=this.morph.toJSON(e).uuid,t.angle=this.angle.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}copy(e){return super.copy(e),this.glType.copy(e.glType),this.num.copy(e.num),this.smooth.copy(e.smooth),this.colors.copy(e.colors),this.steps.copy(e.steps),this.offset.copy(e.offset),this.morph.copy(e.morph),this.angle.copy(e.angle),this.alpha.copy(e.alpha),this.calpha=e.calpha,this}fromJSON(e,t){return super.fromJSON(e,t),e.calpha&&(this.calpha=e.calpha),e.glType&&(this.glType=t.getNode(e.glType)),e.num&&(this.num=t.getNode(e.num)),e.smooth&&(this.smooth=t.getNode(e.smooth)),e.colors&&(this.colors=t.getNode(e.colors)),e.steps&&(this.steps=t.getNode(e.steps)),e.offset&&(this.offset=t.getNode(e.offset)),e.morph&&(this.morph=t.getNode(e.morph)),e.angle&&(this.angle=t.getNode(e.angle)),e.alpha&&(this.alpha=t.getNode(e.alpha)),this}}var Jt,Qt;Ht.Nodes={gradient:new Ot("vec3 gradient(int glType, int num, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, float alpha, out float calpha) {\n\t\t\t\tvec4 color = colors[0];\n\t\t\t\tvec2 m = morph / vUv.xy;\n\t\t\t\tvec2 rot = vec2( 0.5 + m.x, m.y );\n\t\t\t\tvec2 dt = vec2(\n\t\t\t\t\tcos( angle ) * rot.x - sin( angle ) * rot.y,\n\t\t\t\t\tsin( angle ) * rot.x + cos( angle ) * rot.y\n\t\t\t\t);\n\t\t\t\tvec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0;\n\t\t\t\tfloat t = dot( pt, dt ) / dot( dt, dt );\n\t\t\t\tif ( glType == 1 ) {\n\t\t\t\t\tt = distance (\n\t\t\t\t\t\t( vUv + morph ) * 3.0,\n\t\t\t\t\t\t( vUv + offset ) + 1.0\n\t\t\t\t\t) + angle;\n\t\t\t\t} else if ( glType == 2 ) {\n\t\t\t\t\tfloat polar = atan(\n\t\t\t\t\t\tvUv.x + morph.x - 0.5 + offset.x,\n\t\t\t\t\t\tvUv.y + morph.y - 0.5 + offset.y\n\t\t\t\t\t) * -1.0;\n\t\t\t\t\tt = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) );\n\t\t\t\t}\n\t\t\t\tfloat p;\n\t\t\t\tfor ( int i = 1; i < num; i++ ) {\n\t\t\t\t\t\tp = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );\n\t\t\t\t\t\tcolor = mix( color, colors[i],\n\t\t\t\t\t\t\t\t\t( smoothed ) ? smoothstep( 0.0, 1.0, p ) : p\n\t\t\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t\tfloat lalpha = alpha * color.a;\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\n\t\t\t\treturn color.xyz;\n\t\t\t}")},function(e){e.NOISE="noise",e.MAP="map"}(Jt||(Jt={}));class Yt extends dt{constructor(e=new ut,t=new ut,r=new ut,i=new ut,n=new ut,s=new ut){super("v3"),this.nodeType="VertexDisplacement",this.displacementTypeIndex=e,this.intensity=t,this.movementOrTexture=r,Object.values(Jt)[this.displacementTypeIndex.value]===Jt.MAP&&(this.mat=new Rt(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=n,this.noiseFunctionIndex=s}generate(e,t){if(e.isShader("vertex")){let r;e.define("USE_LAYER_DISPLACE");const i=[];i.push("displaced_position"),i.push("displaced_normal");switch(Object.values(Jt)[this.displacementTypeIndex.value]){case Jt.MAP:r=e.include(Yt.Nodes.map),i.push(this.movementOrTexture.getTexture(e,"t")),i.push("uv"),i.push(this.cropOrOffset.build(e,"f")),i.push(this.mat.build(e,"mat3"));break;case Jt.NOISE:{const t=Object.values(Ut)[this.noiseFunctionIndex.value],n=new Ot("vec3 orthogonal(vec3 v) {\n\t\t\t\t\t\t\treturn normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));\n\t\t\t\t\t\t}"),s=new Ot(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement) {\n\t\t\t\t\t\t\treturn p + n * ${t}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;\n\t\t\t\t\t\t}`,[Gt.simplex,Gt.simplexFractal,Gt.simplexAshima,Gt.fbm,Gt.perlin]),o=new Ot("vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, float intensity, out vec3 displaced_normal) {\n\t\t\t\t\t\t\tvec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement);\n\t\t\t\t\t\t\tvec3 tangent1 = orthogonal(normal);\n\t\t\t\t\t\t\tvec3 tangent2 = normalize(cross(normal, tangent1));\n\t\t\t\t\t\t\tvec3 nearby1 = position + tangent1 * 0.1;\n\t\t\t\t\t\t\tvec3 nearby2 = position + tangent2 * 0.1;\n\t\t\t\t\t\t\tvec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement);\n\t\t\t\t\t\t\tvec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement);\n\t\t\t\t\t\t\tdisplaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));\n\t\t\t\t\t\t\treturn displaced_position;\n\t\t\t\t\t\t}",[s,n]);r=e.include(o),i.push(this.scale.build(e,"f")),i.push(this.cropOrOffset.build(e,"v3")),i.push(this.movementOrTexture.build(e,"f"));break}}return i.push(this.intensity.build(e,"f")),i.push("displaced_normal"),e.format(r+"("+i.join(",")+")",this.getType(e),t)}return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.intensity=this.intensity.toJSON(e).uuid,t.scale=this.scale.toJSON(e).uuid,t.movementOrTexture=this.movementOrTexture.toJSON(e).uuid,t.cropOrOffset=this.cropOrOffset.toJSON(e).uuid),t.displacementTypeIndex=this.displacementTypeIndex,t.noiseFunctionIndex=this.noiseFunctionIndex,t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),this.displacementTypeIndex=e.displacementTypeIndex,this.noiseFunctionIndex=e.noiseFunctionIndex,e.cropOrOffset&&(this.cropOrOffset=t.getNode(e.cropOrOffset)),e.intensity&&(this.intensity=t.getNode(e.intensity)),e.movementOrTexture&&(1===e.displacementTypeIndex.value?(this.movementOrTexture=t.getNode(e.movementOrTexture),this.movementOrTexture.value.updateMatrix(),this.mat=new Rt(this.movementOrTexture.value.matrix)):0===e.displacementTypeIndex.value&&(this.movementOrTexture=t.getNode(e.movementOrTexture))),e.scale&&(this.scale=t.getNode(e.scale)),this}copy(e){return super.copy(e),this.noiseFunctionIndex=e.noiseFunctionIndex,this.scale.copy(e.scale),this.cropOrOffset.copy(e.cropOrOffset),this.intensity.copy(e.intensity),this.movementOrTexture.copy(e.movementOrTexture),this}}Yt.Nodes=function(){const e=new Ot("vec3 orthogonal(vec3 v) {\n\t\t\t\treturn normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));\n\t\t\t}"),t=new Ot("float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {\n\t\t\t\tvec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;\n\t\t\t\tvec4 tmp = texture2D(tex, uvs);\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tif (crop > 0.5) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\treturn 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn col.r;\n\t\t\t}");return{map:new Ot("vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {\n\t\t\t\tvec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;\n\t\t\t\tvec3 tangent1 = normalize(orthogonal(normal));\n\t\t\t\tvec3 tangent2 = normalize(cross(normal, tangent1));\n\t\t\t\tvec3 nearby1 = position + tangent1 * 0.1;\n\t\t\t\tvec3 nearby2 = position + tangent2 * 0.1;\n\t\t\t\tvec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;\n\t\t\t\tvec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;\n\t\t\t\tdisplaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));\n\t\t\t\treturn displaced_position;\n\t\t\t}",[e,t])}}();class Wt extends dt{constructor(e=new ut,t=new ut,r=new ut,i=new ut,n=new ut,s=new ut,o=new ut,a=new ut,l=new ut,c=new ut,h=new ut,u=new ut,d=new ut,p=new ut,f=new ut){super("v3"),this.nodeType="Noise",this.scale=e,this.move=t,this.fA=r,this.fB=i,this.distortion=n,this.colorA=s,this.colorB=o,this.colorC=a,this.colorD=l,this.intA=c,this.intB=h,this.intC=u,this.intD=d,this.alpha=p,this.noiseFunctionIndex=f}generate(e,t,r,i,n){e.require("uv"),e.requires.uv=[!0];const s=Object.values(Ut)[this.noiseFunctionIndex.value],o=new Ot(`vec3 ${s}customNoise(float scale, float move, vec2 fA, vec2 fB, vec2 distortion, vec3 colorA, vec3 colorB, vec3 colorC, vec3 colorD, float intA, float intB, float intC, float intD, float alpha) {\n\t\t\t\tvec3 st = normalize(position) * scale;\n\t\t\t\tvec3 q = vec3(${s}(st),\n\t\t\t\t\t\t\t ${s}(st + vec3(1.0)),\n\t\t\t\t\t\t\t ${s}(st + vec3(1.0)));\n\t\t\t\tvec3 r = vec3(${s}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),\n\t\t\t\t\t\t\t ${s}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), \n\t\t\t\t\t\t\t ${s}(st * q));\n\t\t\t\tfloat f = ${s}(st + r);\n\t\t\t\tvec3 color;\n\t\t\t\tcolor = mix(colorA * intA, colorB * intB, clamp((f * f) * 4.0, 0.0, 1.0));\n\t\t\t\tcolor = mix(color, colorC * intC, clamp(length(q), 0.0, 1.0));\n\t\t\t\tcolor = mix(color, colorD * intD, clamp(length(r.x), 0.0, 1.0));\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * alpha;\n\t\t\t\treturn clamp(color, 0.0, 1.0);\n\t\t\t}`,[Gt.simplex,Gt.simplexFractal,Gt.simplexAshima,Gt.fbm,Gt.perlin]),a=e.include(o),l=[];l.push(this.scale.build(e,"f")),l.push(this.move.build(e,"f")),l.push(this.fA.build(e,"v2")),l.push(this.fB.build(e,"v2")),l.push(this.distortion.build(e,"v2")),l.push(this.colorA.build(e,"c")),l.push(this.colorB.build(e,"c")),l.push(this.colorC.build(e,"c")),l.push(this.colorD.build(e,"c")),l.push(this.intA.build(e,"f")),l.push(this.intB.build(e,"f")),l.push(this.intC.build(e,"f")),l.push(this.intD.build(e,"f")),l.push(this.alpha.build(e,"f"));return e.format(a+"("+l.join(",")+")",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scale=this.scale.toJSON(e).uuid,t.move=this.move.toJSON(e).uuid,t.fA=this.fA.toJSON(e).uuid,t.fB=this.fB.toJSON(e).uuid,t.distortion=this.distortion.toJSON(e).uuid,t.colorA=this.colorA.toJSON(e).uuid,t.colorB=this.colorB.toJSON(e).uuid,t.colorC=this.colorC.toJSON(e).uuid,t.colorD=this.colorD.toJSON(e).uuid,t.intA=this.intA.toJSON(e).uuid,t.intB=this.intB.toJSON(e).uuid,t.intC=this.intC.toJSON(e).uuid,t.intD=this.intD.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid),t.noiseFunction=this.noiseFunctionIndex,t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scale&&(this.scale=t.getNode(e.scale)),e.move&&(this.move=t.getNode(e.move)),e.fA&&(this.fA=t.getNode(e.fA)),e.fB&&(this.fB=t.getNode(e.fB)),e.distortion&&(this.distortion=t.getNode(e.distortion)),e.colorA&&(this.colorA=t.getNode(e.colorA)),e.colorB&&(this.colorB=t.getNode(e.colorB)),e.colorC&&(this.colorC=t.getNode(e.colorC)),e.colorD&&(this.colorD=t.getNode(e.colorD)),e.intA&&(this.intA=t.getNode(e.intA)),e.intB&&(this.intB=t.getNode(e.intB)),e.intC&&(this.intC=t.getNode(e.intC)),e.intD&&(this.intD=t.getNode(e.intD)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.noiseFunctionIndex&&(this.noiseFunctionIndex=t.getNode(e.noiseFunctionIndex)),this}copy(e){return super.copy(e),this.scale.copy(e.scale),this.move.copy(e.move),this.fA.copy(e.fA),this.fB.copy(e.fB),this.distortion.copy(e.distortion),this.colorA.copy(e.colorA),this.colorB.copy(e.colorB),this.colorC.copy(e.colorC),this.colorD.copy(e.colorD),this.intA.copy(e.intA),this.intB.copy(e.intB),this.intC.copy(e.intC),this.intD.copy(e.intD),this.alpha.copy(e.alpha),this.noiseFunctionIndex.copy(e.noiseFunctionIndex),this}}Wt.numOctaves=5,function(e){e.ADD="+",e.SUB="-",e.MUL="*",e.DIV="/"}(Qt||(Qt={}));class Xt extends dt{constructor(e=new ut,t=new ut,r=Xt.ADD){super(),this.nodeType="Operator",this.a=e,this.b=t,this.op=r}getType(e){const t=this.a.getType(e),r=this.b.getType(e);return e.isTypeMatrix(t)?"v4":e.getTypeLength(r)>e.getTypeLength(t)?r:t}generate(e,t){const r=this.getType(e);this.type=r;const i=this.a.build(e,r),n=this.b.build(e,r);return e.format("( "+i+" "+this.op+" "+n+" )",r,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.op=e.op,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,t.b=this.b.toJSON(e).uuid,t.op=this.op),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.op&&(this.op=e.op),this}}Xt.ADD=Qt.ADD,Xt.SUB=Qt.SUB,Xt.MUL=Qt.MUL,Xt.DIV=Qt.DIV;class Kt extends dt{constructor(e=new ut,t=new ut,r=new ut,i=new ut){super("v3"),this.nodeType="Blend",this.a=e,this.b=t,this.alpha=r,this.mode=i}generate(e,t){if(e.isShader("fragment")){const r=[];return r.push(this.a.build(e,"c")),r.push(this.b.build(e,"c")),r.push(this.alpha.build(e,"f")),r.push(this.mode.build(e,"i")),e.format("spe_blend("+r.join(",")+")",this.getType(e),t)}return console.warn("BlendNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.alpha.copy(e.alpha),this.mode.copy(e.mode),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,t.b=this.b.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.mode&&(this.mode=t.getNode(e.mode)),this}}class qt extends dt{constructor(e=new ut,t=new ut,r=new ut,i=new ut,n=new ut,s=new ut,o=new ut){super("v3"),this.nodeType="Depth",this.near=e,this.far=t,this.isVector=r,this.origin=i,this.colorA=n,this.colorB=s,this.alpha=o}generate(e,t){if(e.isShader("fragment")){e.require("worldPosition");const r=e.include(qt.Nodes.sdepth),i=[];return i.push(this.near.build(e,"f")),i.push(this.far.build(e,"f")),i.push(this.isVector.build(e,"f")),i.push(this.origin.build(e,"v3")),i.push(this.colorA.build(e,"v3")),i.push(this.colorB.build(e,"v3")),i.push(this.alpha.build(e,"f")),e.format(r+"("+i.join(",")+")",this.getType(e),t)}return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.near=this.near.toJSON(e).uuid,t.far=this.far.toJSON(e).uuid,t.isVector=this.isVector.toJSON(e).uuid,t.origin=this.origin.toJSON(e).uuid,t.colorA=this.colorA.toJSON(e).uuid,t.colorB=this.colorB.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.near&&(this.near=t.getNode(e.near)),e.far&&(this.far=t.getNode(e.far)),e.isVector&&(this.isVector=t.getNode(e.isVector)),e.origin&&(this.origin=t.getNode(e.origin)),e.colorA&&(this.colorA=t.getNode(e.colorA)),e.colorB&&(this.colorB=t.getNode(e.colorB)),e.alpha&&(this.alpha=t.getNode(e.alpha)),this}copy(e){return super.copy(e),this.near.copy(e.near),this.far.copy(e.far),this.isVector.copy(e.isVector),this.origin.copy(e.origin),this.colorA.copy(e.colorA),this.colorB.copy(e.colorB),this.alpha.copy(e.alpha),this}}qt.Nodes={sdepth:new Ot("vec3 sdepth(float near, float far, float isVector, vec3 origin, vec3 colorA, vec3 colorB, float alpha) {\n\t\t\t\tvec3 base = ( isVector > 0.5 ) ? origin : cameraPosition;\n\t\t\t\tfloat dist = length( vWPosition - base );\n\t\t\t\tfloat dep = ( dist - near ) / ( far - near );\n\t\t\t\tvec3 depth = mix( colorB, colorA, 1.0 - clamp( dep, 0., 1. ) );\n\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * alpha;\n\n\t\t\t\treturn depth;\n\t\t\t}")};class Zt extends dt{constructor(e=new ut,t=new Pt,r=new ut,i=new ut){super("v3"),this.nodeType="Matcap",this.color=e,this.texture=t,this.alpha=r,this.mode=i,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");const r=e.include(Zt.Nodes.matcap);e.require("normal"),e.requires.normal=!0;const i=[];return i.push(this.color.build(e,"v3")),i.push(this.texture.getTexture(e,"t")),i.push("normal"),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),e.format(r+"("+i.join(",")+")",this.getType(e),t)}return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.texture.copy(e.texture),this.color.copy(e.color),this.alpha.copy(e.alpha),this.mode.copy(e.mode),this.calpha=e.calpha,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.texture=this.texture.toJSON(e).uuid,t.color=this.color.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.calpha&&(this.calpha=e.calpha),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.texture&&(this.texture=t.getNode(e.texture)),e.color&&(this.color=t.getNode(e.color)),e.mode&&(this.mode=t.getNode(e.mode)),this}}Zt.Nodes={matcap:new Ot("vec3 matcap(vec3 color, sampler2D matcapTex, vec3 normal, float alpha, int mode, out float calpha) {\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n vec4 matcapColor = texture2D( matcapTex, uv );\n // matcapColor = matcapTexelToLinear( matcapColor );\n matcapColor.rgb *= color;\n \n calpha = alpha / clamp( alpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * alpha;\n \n return matcapColor.rgb;\n }\n ")};class $t{constructor(e){this.id=2,this.layerCount=2,this.uuid=t.MathUtils.generateUUID(),this.needsUpdate=!1,this._material=e,this._layerNodes=[];const r=this._createLayer({id:0,type:ot.COLOR});this._material.color=r.color,void 0===this._material.alpha&&(this._material.alpha=new gt(1));const i=new gt(1),n=new vt(0);"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=i,this._material.shadingBlend=n),this._layerNodes.push({id:0,type:at.COLOR,color:r.color,alpha:r.alpha,mode:r.mode}),this._layerNodes.push({id:1,type:at.LIGHTING,alpha:i,mode:n}),this.head=r.layer,this.head.next=new lt(1,{type:ot.LIGHTING,alpha:i,mode:n})}get material(){return this._material}set material(e){let t,r;this._material=e;let i=this.head;for(;void 0!==i;){if(i.type===ot.LIGHTING){t=i.uniforms[`f${i.id}_alpha`],r=i.uniforms[`f${i.id}_mode`];break}i=i.next}"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=t,this._material.shadingBlend=r),this.blendColors(),this.blendAfterColors(),this.blendPositions()}addLayer(e){var r;if(e.id=null!==(r=e.id)&&void 0!==r?r:++this.id,this.layerCount++,e.type===ot.LIGHTING){const r=this.createLightLayer(e);return this.uuid=t.MathUtils.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),r}const i=this._createLayer(e),n=i.layer;if(void 0===this.head)this.head=n;else{let e=this.head;for(;null!=e.next;)e=e.next;e.next=n}return i.color&&this._layerNodes.push({id:n.id,type:at.COLOR,color:i.color,alpha:i.alpha,mode:i.mode}),i.position&&this._layerNodes.push({id:n.id,type:at.POSITION,position:i.position}),this.uuid=t.MathUtils.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}addLayerBeforeAt(e,r){var i;let n=this.head;e.id=null!==(i=e.id)&&void 0!==i?i:++this.id,this.layerCount++;const s=this._createLayer(e),o=s.layer;o.next=r;let a=0;if(n===r)this.head=o,s.color&&this._layerNodes.splice(0,0,{id:o.id,type:at.COLOR,color:s.color,alpha:s.alpha,mode:s.mode}),s.position&&this._layerNodes.splice(0,0,{id:o.id,type:at.POSITION,position:s.position});else{for(a=1;(null==n?void 0:n.next)!==r;)n=null==n?void 0:n.next,a++;n.next=o,s.color&&this._layerNodes.splice(a,0,{id:o.id,type:at.COLOR,color:s.color,alpha:s.alpha,mode:s.mode}),s.position&&this._layerNodes.splice(a,0,{id:o.id,type:at.POSITION,position:s.position})}return this.uuid=t.MathUtils.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),o}addLayerAt(e,r){var i;r.id=null!==(i=r.id)&&void 0!==i?i:++this.id,this.layerCount++;const n=this._createLayer(r),s=n.layer;if(n.color&&this._layerNodes.splice(e,0,{id:s.id,type:at.COLOR,color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(e,0,{id:s.id,type:at.POSITION,position:n.position}),0==e)s.next=this.head,this.head=s;else{let t=this.head,r=this.head.next;for(let i=0;ie.clone&&!r?e.clone():e));else{const i=t.uniforms[s].value;null!=i&&(e[n]=i.clone&&!r?i.clone():i)}}this.addLayer(e)}}clone(){return new $t(this._material).copy(this)}toJSON(e){return{id:this.id,uuid:this.uuid,head:this.head.toJSON(e)}}fromJSON(e,t,r){const i=new lt(e.head.id,{type:e.head.type}).fromJSON(e.head,t);let n=e.head.next,s=i;for(;null!=n;)s.next=new lt(n.id,{type:n.type}).fromJSON(n,t),n=n.next,s=s.next;this._layerNodes=[],this.head=void 0,this.rebuildLayerNodes(this.head,i,!0);let o=i;for(s=this.head;null!=o.next;)this.rebuildLayerNodes(s,o.next,!0),s=s.next,o=o.next;return this._material=r,this.id=e.id,this.uuid=e.uuid,this.blendColors(),this.blendAfterColors(),this.blendPositions(),this}dispose(){let e=this.head;for(this._layerNodes=[],this.layerCount=0;void 0!==e;)!0===e.hasOwnProperty("dispose")&&e.dispose(),e=e.next;this.head=void 0}_createLayer(e){var r,i,n,s,o,a,l,c,h,u,d,p,f,m,g,v,y,A,w,x,b,S,E,C,T,O,D,M,_,N,L,B,I,P,R,F,U,z,k,G,j,V,H,J,Q,Y,W,X,K,q,Z,$,ee,te,re,ie,ne,se,oe,ae,le,ce,he,ue,de,pe,fe,me,ge,ve,ye,Ae,we,xe,be,Se,Ee;const Ce=e.type;switch(Ce){case ot.COLOR:{const t=new mt(null!==(r=e.color)&&void 0!==r?r:5855577),s=new gt(null!==(i=e.alpha)&&void 0!==i?i:1),o=new _t("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");o.keywords.alpha=s;const a=new vt(null!==(n=e.mode)&&void 0!==n?n:0);t.alpha=s;return{layer:new lt(e.id,{type:Ce,color:t,alpha:s,calpha:o,mode:a}),color:t,alpha:o,mode:a}}case ot.TEXTURE:{const r=null!==(s=e.texture)&&void 0!==s?s:new Lt,i=r.matrix;e.mat&&i.copy(e.mat),r.needsUpdate=!0;const n=new gt(null!==(o=e.crop)&&void 0!==o?o:0),d=new vt(null!==(a=e.projection)&&void 0!==a?a:0),p=new vt(null!==(l=e.axis)&&void 0!==l?l:0),f=new gt(null!==(c=e.alpha)&&void 0!==c?c:1),m=new vt(null!==(h=e.mode)&&void 0!==h?h:0),g=new Pt(r),v=new wt(null!==(u=e.textureSize)&&void 0!==u?u:new t.Vector3(r.image.width,r.image.height)),y=new zt(g,v,n,d,p,f,m),A=new _t(y.calpha,"f");return{layer:new lt(e.id,{type:Ce,texture:g,textureSize:v,crop:n,projection:d,axis:p,mat:y.mat,alpha:f,calpha:A,mode:m}),color:y,alpha:A,mode:m}}case ot.MATCAP:{const t=new mt(null!==(d=e.color)&&void 0!==d?d:16777215),r=null!==(p=e.texture)&&void 0!==p?p:new Lt;r.needsUpdate=!0;const i=new gt(null!==(f=e.alpha)&&void 0!==f?f:1),n=new Pt(r),s=new vt(null!==(m=e.mode)&&void 0!==m?m:0),o=new Zt(t,n,i,s),a=new _t(o.calpha,"f");return{layer:new lt(e.id,{type:Ce,texture:n,color:t,alpha:i,calpha:a,mode:s}),color:o,alpha:a,mode:s}}case ot.FRESNEL:{const t=new mt(null!==(g=e.color)&&void 0!==g?g:16777215),r=new gt(null!==(v=e.bias)&&void 0!==v?v:.1),i=new gt(null!==(y=e.scale)&&void 0!==y?y:1),n=new gt(null!==(A=e.intensity)&&void 0!==A?A:2),s=new gt(null!==(w=e.factor)&&void 0!==w?w:1),o=new gt(null!==(x=e.alpha)&&void 0!==x?x:1),a=new vt(null!==(b=e.mode)&&void 0!==b?b:0),l=new kt(t,r,i,n,s,o,a),c=new _t(l.calpha,"f");return{layer:new lt(e.id,{type:Ce,color:t,bias:r,scale:i,intensity:n,factor:s,alpha:o,calpha:c,mode:a}),color:l,alpha:c,mode:a}}case ot.RAINBOW:{const r=new gt(null!==(S=e.filmThickness)&&void 0!==S?S:30),i=new gt(null!==(E=e.movement)&&void 0!==E?E:0),n=new wt(null!==(C=e.wavelengths)&&void 0!==C?C:new t.Vector3(0,0,0)),s=new gt(null!==(T=e.noiseStrength)&&void 0!==T?T:0),o=new gt(null!==(O=e.noiseScale)&&void 0!==O?O:1),a=new wt(null!==(D=e.offset)&&void 0!==D?D:new t.Vector3(0,0,0)),l=new gt(null!==(M=e.alpha)&&void 0!==M?M:1),c=new jt(r,i,n,s,o,a,l),h=new _t(c.calpha,"f"),u=new vt(null!==(_=e.mode)&&void 0!==_?_:0);return{layer:new lt(e.id,{type:Ce,filmThickness:r,movement:i,wavelengths:n,noiseStrength:s,noiseScale:o,offset:a,alpha:l,calpha:h,mode:u}),color:c,alpha:h,mode:u}}case ot.DEPTH:{const r=new gt(null!==(N=e.near)&&void 0!==N?N:700),i=new gt(null!==(L=e.far)&&void 0!==L?L:1e3),n=new gt(null!==(B=e.isVector)&&void 0!==B?B:0),s=new wt(null!==(I=e.origin)&&void 0!==I?I:new t.Vector3),o=new mt(null!==(P=e.colorA)&&void 0!==P?P:new t.Color),a=new mt(null!==(R=e.colorB)&&void 0!==R?R:new t.Color(0,0,0)),l=new gt(null!==(F=e.alpha)&&void 0!==F?F:1),c=new vt(null!==(U=e.mode)&&void 0!==U?U:0),h=new _t("alpha / clamp(alpha + accumAlpha, 0.001, 1.0 )","f");h.keywords.alpha=l;const u=new qt(r,i,n,s,o,a,l);return{layer:new lt(e.id,{type:Ce,near:r,far:i,isVector:n,origin:s,colorA:o,colorB:a,alpha:l,calpha:h,mode:c}),color:u,alpha:h,mode:c}}case ot.NOISE:{const r=new gt(null!==(z=e.scale)&&void 0!==z?z:2),i=new gt(null!==(k=e.move)&&void 0!==k?k:1),n=new At(null!==(G=e.fA)&&void 0!==G?G:new t.Vector2(1.7,9.2)),s=new At(null!==(j=e.fB)&&void 0!==j?j:new t.Vector2(8.3,2.8)),o=new At(null!==(V=e.distortion)&&void 0!==V?V:new t.Vector2(1,1)),a=new mt(null!==(H=e.colorA)&&void 0!==H?H:new t.Color(.4,.4,.4)),l=new mt(null!==(J=e.colorB)&&void 0!==J?J:new t.Color(.4,.4,.4)),c=new mt(null!==(Q=e.colorC)&&void 0!==Q?Q:new t.Color(1,1,1)),h=new mt(null!==(Y=e.colorD)&&void 0!==Y?Y:new t.Color(1,1,1)),u=new gt(null!==(W=e.intA)&&void 0!==W?W:1),d=new gt(null!==(X=e.intB)&&void 0!==X?X:1),p=new gt(null!==(K=e.intC)&&void 0!==K?K:1),f=new gt(null!==(q=e.intD)&&void 0!==q?q:1),m=new gt(null!==(Z=e.alpha)&&void 0!==Z?Z:1),g=new vt(null!==($=e.mode)&&void 0!==$?$:0),v=new vt(null!==(ee=e.noiseType)&&void 0!==ee?ee:0),y=new _t("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");y.keywords.alpha=m;const A=new Wt(r,i,n,s,o,a,l,c,h,u,d,p,f,m,v);return{layer:new lt(e.id,{type:Ce,scale:r,move:i,fA:n,fB:s,distortion:o,colorA:a,colorB:l,colorC:c,colorD:h,intA:u,intB:d,intC:p,intD:f,alpha:m,calpha:y,mode:g,noiseType:v}),color:A,alpha:y,mode:g}}case ot.NORMAL:{const r=new wt(null!==(te=e.cnormal)&&void 0!==te?te:new t.Vector3(1,1,1)),i=new gt(null!==(re=e.alpha)&&void 0!==re?re:1),n=new vt(null!==(ie=e.mode)&&void 0!==ie?ie:0),s=new Vt(r,i),o=new _t("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");o.keywords.alpha=i;return{layer:new lt(e.id,{type:Ce,cnormal:r,alpha:i,calpha:o,mode:n}),color:s,alpha:o,mode:n}}case ot.GRADIENT:{const r=new vt(null!==(ne=e.gl_type)&&void 0!==ne?ne:0),i=new vt(null!==(se=e.num)&&void 0!==se?se:2),n=new yt(null!==(oe=e.smooth)&&void 0!==oe&&oe);let s,o;e.colors?s=new xt(e.colors.length,e.colors):(s=new xt(10,new t.Vector4(0,0,0,1)),s.value[1]=new t.Vector4(1,1,1,1)),e.steps?o=new bt(e.steps.length,e.steps):(o=new bt(10,1),o.value[0]=0);const a=new At(null!==(ae=e.offset)&&void 0!==ae?ae:new t.Vector2(0,0)),l=new At(null!==(le=e.morph)&&void 0!==le?le:new t.Vector2(0,0)),c=new gt(null!==(ce=e.angle)&&void 0!==ce?ce:0),h=new gt(null!==(he=e.alpha)&&void 0!==he?he:1),u=new vt(null!==(ue=e.mode)&&void 0!==ue?ue:0),d=new Ht(r,i,n,s,o,a,l,c,h),p=new _t(d.calpha,"f");return{layer:new lt(e.id,{type:Ce,gl_type:r,num:i,smooth:n,colors:s,steps:o,offset:a,morph:l,angle:c,alpha:h,calpha:p,mode:u}),color:d,alpha:p,mode:u}}case ot.DISPLACE:{const r=new vt(null!==(de=e.displacementType)&&void 0!==de?de:0);if(0===r.value){const i=new wt(null!==(pe=e.offset)&&void 0!==pe?pe:new t.Vector3(0,0,0)),n=new gt(null!==(fe=e.scale)&&void 0!==fe?fe:10),s=new gt(null!==(me=e.intensity)&&void 0!==me?me:8),o=new gt(null!==(ge=e.movement)&&void 0!==ge?ge:1),a=new gt(null!==(ve=e.alpha)&&void 0!==ve?ve:1),l=new vt(null!==(ye=e.mode)&&void 0!==ye?ye:0),c=new vt(null!==(Ae=e.noiseType)&&void 0!==Ae?Ae:0),h=new Yt(r,s,o,i,n,c);return{layer:new lt(e.id,{displacementType:r,type:Ce,offset:i,scale:n,intensity:s,movement:o,alpha:a,mode:l,noiseType:c}),position:h}}if(1===r.value){const t=null!==(we=e.texture)&&void 0!==we?we:new Lt,i=t.matrix;e.mat&&i.copy(e.mat),t.needsUpdate=!0;const n=new gt(null!==(xe=e.intensity)&&void 0!==xe?xe:8),s=new Pt(t),o=new gt(null!==(be=e.crop)&&void 0!==be?be:0),a=new gt(null!==(Se=e.alpha)&&void 0!==Se?Se:1),l=new vt(null!==(Ee=e.mode)&&void 0!==Ee?Ee:0),c=new Yt(r,n,s,o);return{layer:new lt(e.id,{displacementType:r,type:Ce,intensity:n,texture:s,crop:o,mat:c.mat,alpha:a,mode:l}),position:c}}return{}}}return{}}blendColors(){const e=this._layerNodes.findIndex((e=>e.type===at.COLOR)),t=this._layerNodes.findIndex((e=>e.type===at.LIGHTING));if(-1!==e&&ee.type===at.LIGHTING));if(this._layerNodes.length>t+1){for(let r=t+1;re.type===at.POSITION));if(e.length>0){let t=e[0].position;for(let r=1;rt.id!==e.id)),e.type){case ot.DISPLACE:this.blendPositions();break;default:this.blendColors(),this.blendAfterColors()}}} +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */function er(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))}class tr{constructor(e){e=null!=e?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}}class rr extends pt{constructor(e=0,r,i,n){super("v4"),this.nodeType="Vector4",this.value=e instanceof t.Vector4?e:new t.Vector4(e,r,i,n)}generateReadonly(e,t,r,i,n,s){return e.format("vec4("+this.value.x+", "+this.value.y+", "+this.value.z+", "+this.value.w+")",i,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,t.z=this.value.z,t.w=this.value.w,!0===this.getReadonly()&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),e.z&&(this.value.z=e.z),e.w&&(this.value.w=e.w),void 0!==e.readonly&&(this.readonly=e.readonly),this}}ft.addShortcuts(rr.prototype,"value",["x","y","z","w"]);const ir=new RegExp("^structs*([a-z_0-9]+)s*{s*((.|\n)*?)}","gim"),nr=new RegExp("s*(w*?)s*(w*?)(=|;)","gim");class sr extends dt{constructor(e=""){super(),this.inputs=[],this.src="",this.nodeType="Struct",this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}generate(e,t,r,i,n){return"source"===t?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];const t=ir.exec(e);if(t){const e=t[2];let r;for(;r=nr.exec(e);)this.inputs.push({type:r[1],name:r[2]});this.name=t[1]}else this.name="";this.type=this.name}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.src=this.src),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.src&&(this.src=e.src,this.parse(this.src)),this}}class or extends dt{constructor(e,t){super(),this.inputs=[],this.nodeType="FunctionCall",this.value=e,this.inputs=null!=t?t:[]}getFunction(){return this.value}getType(e){return this.value.getType(e)}generate(e,t,r,i,n){i=this.getType(e);const s=this.value;let o=s.build(e,t)+"( ";const a=[];if(s.inputs){for(let t=0;te.clone())),this}toJSON(e){var t;let r=this.getJSONNode(e);if(!r){const i=this.value;if(r=this.createJSONNode(e),r.value=this.value.toJSON(e).uuid,null===(t=i.inputs)||void 0===t?void 0:t.length){r.inputs={};for(let t=0;tr&&t>i?this.a.getType(e):r>i?this.b.getType(e):this.c.getType(e)}getType(e){switch(this.method){case lr.LENGTH:case lr.DISTANCE:case lr.DOT:return"f";case lr.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let r,i,n;const s=this.a?e.getTypeLength(this.a.getType(e)):0,o=this.b?e.getTypeLength(this.b.getType(e)):0,a=this.c?e.getTypeLength(this.c.getType(e)):0,l=this.getInputType(e),c=this.getType(e);switch(this.type=c,this.method){case lr.NEGATE:return e.format("( -"+this.a.build(e,l)+" )",l,t);case lr.INVERT:return e.format("( 1.0 - "+this.a.build(e,l)+" )",l,t);case lr.CROSS:r=this.a.build(e,"v3"),i=this.b.build(e,"v3");break;case lr.STEP:r=this.a.build(e,1===s?"f":l),i=this.b.build(e,l);break;case lr.MIN:case lr.MAX:case lr.MOD:r=this.a.build(e,l),i=this.b.build(e,1===o?"f":l);break;case lr.REFRACT:r=this.a.build(e,l),i=this.b.build(e,l),n=this.c.build(e,"f");break;case lr.MIX:r=this.a.build(e,l),i=this.b.build(e,l),n=this.c.build(e,1===a?"f":l);break;default:r=this.a.build(e,l),this.b&&(i=this.b.build(e,l)),this.c&&(n=this.c.build(e,l))}const h=[];h.push(r),i&&h.push(i),n&&h.push(n);const u=this.getNumInputs(e);if(h.length!==u)throw Error(`Arguments not match used in "${this.method}". Require ${u}, currently ${h.length}.`);return e.format(this.method+"( "+h.join(", ")+" )",c,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b=e.b instanceof ut?e.b.clone():e.b,this.c=e.c instanceof ut?e.c.clone():e.c,this.method=e.method,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,this.b&&(t.b=this.b.toJSON(e).uuid),this.c&&(t.c=this.c.toJSON(e).uuid),t.method=this.method),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.c&&(this.c=t.getNode(e.c)),e.method&&(this.method=e.method),this}}lr.RAD=ar.RAD,lr.DEG=ar.DEG,lr.EXP=ar.EXP,lr.EXP2=ar.EXP2,lr.LOG=ar.LOG,lr.LOG2=ar.LOG2,lr.SQRT=ar.SQRT,lr.INV_SQRT=ar.INV_SQRT,lr.FLOOR=ar.FLOOR,lr.CEIL=ar.CEIL,lr.NORMALIZE=ar.NORMALIZE,lr.FRACT=ar.FRACT,lr.SATURATE=ar.SATURATE,lr.SIN=ar.SIN,lr.COS=ar.COS,lr.TAN=ar.TAN,lr.ASIN=ar.ASIN,lr.ACOS=ar.ACOS,lr.ARCTAN=ar.ARCTAN,lr.ABS=ar.ABS,lr.SIGN=ar.SIGN,lr.LENGTH=ar.LENGTH,lr.NEGATE=ar.NEGATE,lr.INVERT=ar.INVERT,lr.MIN=ar.MIN,lr.MAX=ar.MAX,lr.MOD=ar.MOD,lr.STEP=ar.STEP,lr.REFLECT=ar.REFLECT,lr.DISTANCE=ar.DISTANCE,lr.DOT=ar.DOT,lr.CROSS=ar.CROSS,lr.POW=ar.POW,lr.MIX=ar.MIX,lr.CLAMP=ar.CLAMP,lr.REFRACT=ar.REFRACT,lr.SMOOTHSTEP=ar.SMOOTHSTEP,lr.FACEFORWARD=ar.FACEFORWARD;class cr extends dt{constructor(e=new ut,t=new ut,r=new ut){super("v4"),this.nodeType="TextureCubeUV",this.value=e,this.uv=t,this.bias=r}bilinearCubeUV(e,t,r,i){var n,s,o,a;const l=new or(cr.Nodes.bilinearCubeUV,[t,r,i]);this.colorSpaceTL=null!==(n=this.colorSpaceTL)&&void 0!==n?n:new Nt(new _t("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(l.build(e)+".tl"),this.colorSpaceTR=null!==(s=this.colorSpaceTR)&&void 0!==s?s:new Nt(new _t("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(l.build(e)+".tr"),this.colorSpaceBL=null!==(o=this.colorSpaceBL)&&void 0!==o?o:new Nt(new _t("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(l.build(e)+".bl"),this.colorSpaceBR=null!==(a=this.colorSpaceBR)&&void 0!==a?a:new Nt(new _t("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(l.build(e)+".br");const c={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(c),this.colorSpaceTLExp=new _t(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new _t(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new _t(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new _t(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();const h=new _t("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return h.keywords.cubeUV_TL=this.colorSpaceTLExp,h.keywords.cubeUV_TR=this.colorSpaceTRExp,h.keywords.cubeUV_BL=this.colorSpaceBLExp,h.keywords.cubeUV_BR=this.colorSpaceBRExp,h.keywords.cubeUV=l,h}generate(e,t){if(e.isShader("fragment")){const r=this.uv,i=this.bias||e.context.roughness,n=new or(cr.Nodes.roughnessToMip,[i]),s=new lr(n,cr.Nodes.m0,cr.Nodes.cubeUV_maxMipLevel,lr.CLAMP),o=new lr(s,lr.FLOOR),a=new lr(s,lr.FRACT),l=this.bilinearCubeUV(e,this.value,r,o),c=this.bilinearCubeUV(e,this.value,r,new Xt(o,new gt(1).setReadonly(!0),Xt.ADD)),h=new lr(l,c,a,lr.MIX);return e.format(h.build(e),"v4",t)}return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.uv.copy(e.uv),this.bias.copy(e.bias),this.value.copy(e.value),e.colorSpaceTL?this.colorSpaceTL?this.colorSpaceTL.copy(e.colorSpaceTL):this.colorSpaceTL=e.colorSpaceTL.clone():this.colorSpaceTL=void 0,e.colorSpaceTR?this.colorSpaceTR?this.colorSpaceTR.copy(e.colorSpaceTR):this.colorSpaceTR=e.colorSpaceTR.clone():this.colorSpaceTR=void 0,e.colorSpaceBL?this.colorSpaceBL?this.colorSpaceBL.copy(e.colorSpaceBL):this.colorSpaceBL=e.colorSpaceBL.clone():this.colorSpaceBL=void 0,e.colorSpaceBR?this.colorSpaceBR?this.colorSpaceBR.copy(e.colorSpaceBR):this.colorSpaceBR=e.colorSpaceBR.clone():this.colorSpaceBR=void 0,e.colorSpaceTLExp?this.colorSpaceTLExp?this.colorSpaceTLExp.copy(e.colorSpaceTLExp):this.colorSpaceTLExp=e.colorSpaceTLExp.clone():this.colorSpaceTLExp=void 0,e.colorSpaceTRExp?this.colorSpaceTRExp?this.colorSpaceTRExp.copy(e.colorSpaceTRExp):this.colorSpaceTRExp=e.colorSpaceTRExp.clone():this.colorSpaceTRExp=void 0,e.colorSpaceBLExp?this.colorSpaceBLExp?this.colorSpaceBLExp.copy(e.colorSpaceBLExp):this.colorSpaceBLExp=e.colorSpaceBLExp.clone():this.colorSpaceBLExp=void 0,e.colorSpaceBRExp?this.colorSpaceBRExp?this.colorSpaceBRExp.copy(e.colorSpaceBRExp):this.colorSpaceBRExp=e.colorSpaceBRExp.clone():this.colorSpaceBRExp=void 0,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid,t.uv=this.uv.toJSON(e).uuid,t.bias=this.bias.toJSON(e).uuid,this.colorSpaceTL&&this.colorSpaceTL.toJSON(e).uuid,this.colorSpaceTR&&this.colorSpaceTR.toJSON(e).uuid,this.colorSpaceBL&&this.colorSpaceBL.toJSON(e).uuid,this.colorSpaceBR&&this.colorSpaceBR.toJSON(e).uuid,this.colorSpaceTLExp&&this.colorSpaceTLExp.toJSON(e).uuid,this.colorSpaceTRExp&&this.colorSpaceTRExp.toJSON(e).uuid,this.colorSpaceBLExp&&this.colorSpaceBLExp.toJSON(e).uuid,this.colorSpaceBRExp&&this.colorSpaceBRExp.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=t.getNode(e.value)),e.uv&&(this.uv=t.getNode(e.uv)),e.bias&&(this.bias=t.getNode(e.bias)),e.colorSpaceTL&&(this.colorSpaceTL=t.getNode(e.colorSpaceTL)),e.colorSpaceTR&&(this.colorSpaceTR=t.getNode(e.colorSpaceTR)),e.colorSpaceBL&&(this.colorSpaceBL=t.getNode(e.colorSpaceBL)),e.colorSpaceBR&&(this.colorSpaceBR=t.getNode(e.colorSpaceBR)),e.colorSpaceTLExp&&(this.colorSpaceTLExp=t.getNode(e.colorSpaceTLExp)),e.colorSpaceTRExp&&(this.colorSpaceTRExp=t.getNode(e.colorSpaceTRExp)),e.colorSpaceBLExp&&(this.colorSpaceBLExp=t.getNode(e.colorSpaceBLExp)),e.colorSpaceBRExp&&(this.colorSpaceBRExp=t.getNode(e.colorSpaceBRExp)),this}}cr.Nodes=function(){const e=new sr("struct TextureCubeUVData {\n\t\t\tvec4 tl;\n\t\t\tvec4 tr;\n\t\t\tvec4 br;\n\t\t\tvec4 bl;\n\t\t\tvec2 f;\n\t\t}"),t=new Mt("float cubeUV_maxMipLevel 8.0",!0),r=new Mt("float cubeUV_minMipLevel 4.0",!0),i=new Mt("float cubeUV_maxTileSize 256.0",!0),n=new Mt("float cubeUV_minTileSize 16.0",!0),s=new Ot("float getFace(vec3 direction) {\n\t\t\t\tvec3 absDirection = abs(direction);\n\t\t\t\tfloat face = -1.0;\n\t\t\t\tif (absDirection.x > absDirection.z) {\n\t\t\t\t\tif (absDirection.x > absDirection.y)\n\t\t\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\t\t\telse\n\t\t\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t\t\t} else {\n\t\t\t\t\tif (absDirection.z > absDirection.y)\n\t\t\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\t\t\telse\n\t\t\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t\t\t}\n\t\t\t\treturn face;\n\t\t}");s.useKeywords=!1;const o=new Ot("vec2 getUV(vec3 direction, float face) {\n\t\t\t\tvec2 uv;\n\t\t\t\tif (face == 0.0) {\n\t\t\t\t\tuv = vec2(direction.z, direction.y) / abs(direction.x); // pos x\n\t\t\t\t} else if (face == 1.0) {\n\t\t\t\t\tuv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y\n\t\t\t\t} else if (face == 2.0) {\n\t\t\t\t\tuv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z\n\t\t\t\t} else if (face == 3.0) {\n\t\t\t\t\tuv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x\n\t\t\t\t} else if (face == 4.0) {\n\t\t\t\t\tuv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y\n\t\t\t\t} else {\n\t\t\t\t\tuv = vec2(direction.x, direction.y) / abs(direction.z); // neg z\n\t\t\t\t}\n\t\t\t\treturn 0.5 * (uv + 1.0);\n\t\t}");o.useKeywords=!1;const a=new Ot("TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n\t\t\tfloat face = getFace(direction);\n\t\t\tfloat filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n\t\t\tmipInt = max(mipInt, cubeUV_minMipLevel);\n\t\t\tfloat faceSize = exp2(mipInt);\n\t\t\tfloat texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n\t\t\tvec2 uv = getUV(direction, face) * (faceSize - 1.0);\n\t\t\tvec2 f = fract(uv);\n\t\t\tuv += 0.5 - f;\n\t\t\tif (face > 2.0) {\n\t\t\t\tuv.y += faceSize;\n\t\t\t\tface -= 3.0;\n\t\t\t}\n\t\t\tuv.x += face * faceSize;\n\t\t\tif(mipInt < cubeUV_maxMipLevel){\n\t\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t\t}\n\t\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\t\tuv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n\t\t\tuv *= texelSize;\n\t\t\tvec4 tl = texture2D(envMap, uv);\n\t\t\tuv.x += texelSize;\n\t\t\tvec4 tr = texture2D(envMap, uv);\n\t\t\tuv.y += texelSize;\n\t\t\tvec4 br = texture2D(envMap, uv);\n\t\t\tuv.x -= texelSize;\n\t\t\tvec4 bl = texture2D(envMap, uv);\n\t\t\treturn TextureCubeUVData( tl, tr, br, bl, f );\n\t\t}",[e,s,o,t,r,i,n]);a.useKeywords=!1;const l=new Mt("float r0 1.0",!0),c=new Mt("float v0 0.339",!0),h=new Mt("float m0 -2.0",!0),u=new Mt("float r1 0.8",!0),d=new Mt("float v1 0.276",!0),p=new Mt("float m1 -1.0",!0),f=new Mt("float r4 0.4",!0),m=new Mt("float v4 0.046",!0),g=new Mt("float m4 2.0",!0),v=new Mt("float r5 0.305",!0),y=new Mt("float v5 0.016",!0),A=new Mt("float m5 3.0",!0),w=new Mt("float r6 0.21",!0),x=new Mt("float v6 0.0038",!0),b=new Mt("float m6 4.0",!0);return{bilinearCubeUV:a,roughnessToMip:new Ot("float roughnessToMip(float roughness) {\n\t\t\tfloat mip = 0.0;\n\t\t\tif (roughness >= r1) {\n\t\t\t\tmip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n\t\t\t} else if (roughness >= r4) {\n\t\t\t\tmip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n\t\t\t} else if (roughness >= r5) {\n\t\t\t\tmip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n\t\t\t} else if (roughness >= r6) {\n\t\t\t\tmip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n\t\t\t} else {\n\t\t\t\tmip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25\n\t\t\t}\n\t\t\treturn mip;\n\t\t}",[l,c,h,u,d,p,f,m,g,v,y,A,w,x,b]),m0:h,cubeUV_maxMipLevel:t}}();class hr extends dt{constructor(e){super("v3"),this.nodeType="Normal",this.scope=null!=e?e:hr.VIEW}getShared(){return this.scope===hr.WORLD}build(e,t,r,i){const n=e.context[this.scope+"Normal"];return n?n.build(e,t,r,i):super.build(e,t,r)}generate(e,t,r,i,n){let s;switch(this.scope){case hr.VIEW:s=e.isShader("vertex")?"transformedNormal":"geometryNormal";break;case hr.LOCAL:e.isShader("vertex")?s="objectNormal":(e.requires.normal=!0,s="vObjectNormal");break;case hr.WORLD:e.isShader("vertex")?s="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,s="vWNormal")}return e.format(s,this.getType(e),t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}}hr.LOCAL="local",hr.WORLD="world",hr.VIEW="view",hr.NORMAL="normal",St.addKeyword("viewNormal",(function(){return new hr(hr.VIEW)})),St.addKeyword("localNormal",(function(){return new hr(hr.NORMAL)})),St.addKeyword("worldNormal",(function(){return new hr(hr.WORLD)}));class ur extends dt{constructor(e){super("v3"),this.nodeType="Position",this.scope=null!=e?e:ur.LOCAL}getType(){switch(this.scope){case ur.PROJECTION:return"v4"}return this.type}getShader(){switch(this.scope){case ur.LOCAL:case ur.WORLD:return!1}return!0}generate(e,t,r,i,n){let s;switch(this.scope){case ur.LOCAL:e.isShader("vertex")?s="transformed":(e.requires.position=!0,s="vPosition");break;case ur.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,s="vWPosition";break;case ur.VIEW:s=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case ur.PROJECTION:s=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )"}return e.format(s,this.getType(),t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}}ur.LOCAL="local",ur.WORLD="world",ur.VIEW="view",ur.PROJECTION="projection",St.addKeyword("position",(function(){return new ur})),St.addKeyword("worldPosition",(function(){return new ur(ur.WORLD)})),St.addKeyword("viewPosition",(function(){return new ur(ur.VIEW)}));class dr extends dt{constructor(e){super("v3"),this.nodeType="Reflect",this.scope=null!=e?e:dr.CUBE}getUnique(e){return!e.context.viewNormal}getType(){switch(this.scope){case dr.SPHERE:return"v2"}return this.type}generate(e,t){const r=this.getUnique(e);if(e.isShader("fragment")){let i;switch(this.scope){case dr.VECTOR:{const t=new hr(hr.VIEW),n=e.context.roughness,s=t.build(e,"v3"),o=new ur(ur.VIEW).build(e,"v3"),a=n?n.build(e,"f"):void 0;let l=`reflect( -normalize( ${o} ), ${s} )`;a&&(l=`normalize( mix( ${l}, ${s}, ${a} * ${a} ) )`);const c=`inverseTransformDirection( ${l}, viewMatrix )`;r?(e.addNodeCode(`vec3 reflectVec = ${c};`),i="reflectVec"):i=c;break}case dr.CUBE:{const t=new dr(dr.VECTOR).build(e,"v3"),n="vec3( -"+t+".x, "+t+".yz )";r?(e.addNodeCode(`vec3 reflectCubeVec = ${n};`),i="reflectCubeVec"):i=n;break}case dr.SPHERE:{const t="normalize( ( viewMatrix * vec4( "+new dr(dr.VECTOR).build(e,"v3")+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";r?(e.addNodeCode(`vec2 reflectSphereVec = ${t};`),i="reflectSphereVec"):i=t;break}}return e.format(i,this.getType(),t)}return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}}dr.CUBE="cube",dr.SPHERE="sphere",dr.VECTOR="vector";class pr extends dt{constructor(e=new Pt,t,r){super("v4"),this.nodeType="TextureCube",this.value=e,this.radianceNode=new cr(this.value,null!=t?t:new dr(dr.VECTOR),r),this.irradianceNode=new cr(this.value,new hr(hr.WORLD),new gt(1).setReadonly(!0))}generate(e,t){if(e.isShader("fragment")){e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value);return("irradiance"===e.slot?this.irradianceNode:this.radianceNode).build(e,t)}return console.warn("TextureCubeNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.value.copy(e.value),this.radianceNode.copy(e.radianceNode),this.irradianceNode.copy(e.irradianceNode),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid,this.radianceNode&&(t.radianceNode=this.radianceNode.toJSON(e).uuid),this.irradianceNode&&(t.irradianceNode=this.irradianceNode.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=t.getNode(e.value)),e.radianceNode&&(this.radianceNode=t.getNode(e.radianceNode)),e.irradianceNode&&(this.irradianceNode=t.getNode(e.irradianceNode)),this}}class fr extends pt{constructor(e=new t.CubeTexture,r,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=e,this.uv=null!=r?r:new dr,this.bias=i}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){var r,i;if("samplerCube"===t)return this.getTexture(e,t);const n=this.getTexture(e,t),s=null===(r=this.uv)||void 0===r?void 0:r.build(e,"v3");let o,a=this.bias?this.bias.build(e,"f"):void 0;void 0===a&&e.context.bias&&(a=e.context.bias.setTexture(this).build(e,"f")),o=a?"texCubeBias( "+n+", "+s+", "+a+" )":"texCube( "+n+", "+s+" )";const l={include:e.isShader("vertex"),ignoreCache:!0},c=this.getType(e);return e.addContext(l),this.colorSpace=null!==(i=this.colorSpace)&&void 0!==i?i:new Nt(new _t("",c)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(o),o=this.colorSpace.build(e,c),e.removeContext(),e.format(o,c,t)}copy(e){return super.copy(e),this.value.copy(e.value),e.uv?this.uv?this.uv.copy(e.uv):this.uv=e.uv.clone():this.uv=void 0,e.bias?this.bias?this.bias.copy(e.bias):this.bias=e.bias.clone():this.bias=void 0,this}toJSON(e){var t;let r=this.getJSONNode(e);return r||(r=this.createJSONNode(e),this.value&&(r.value=this.value.uuid),r.uv=null===(t=this.uv)||void 0===t?void 0:t.toJSON(e).uuid,this.bias&&(r.bias=this.bias.toJSON(e).uuid)),r.nodeType=this.nodeType,r}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=t.getTexture(e.value)),e.uv&&(this.uv=t.getNode(e.uv)),e.bias&&(this.bias=t.getNode(e.bias)),this}}const mr=ft.elements,gr=["float","vec2","vec3","vec4"],vr={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},yr={t:"sampler2D",tc:"samplerCube",b:"bool",i:"int",f:"float",c:"vec3",v2:"vec2",v3:"vec3",v4:"vec4",m3:"mat3",m4:"mat4","f[]":"float[]","v4[]":"vec4[]"};class Ar{constructor(){this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.getIncludesCode=function(){function e(e,t){return e.deps.length-t.deps.length}return function(t,r){let i=this.getIncludes(t,r);if(!i)return"";let n="";i=i.sort(e);for(let e=0;e","#include "].join("\n"),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join("\n"),fragment:["float accumAlpha = 0.0;","void accumulateAlpha(float alpha) {\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * alpha;\n\t\t\t\t}",""].join("\n")},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.buildShader("vertex",e),this.buildShader("fragment",t);for(let e=0;e0?e+1:"";this.addVaryCode("varying vec2 vUv"+t+";"),e>0&&this.addVertexParsCode("attribute vec2 uv"+t+";"),this.addVertexFinalCode("vUv"+t+" = uv"+t+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition&&(this.addVaryCode("varying vec3 vWPosition;"),this.addVertexFinalCode("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;")),this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode("vObjectNormal = normal;")),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ? ( (modelMatrix * vec4(position, 1.0)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this.requires.vWorldNormal&&(this.addVaryCode("varying vec3 vWorldNormal;"),this.addVertexFinalCode("vWorldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );")),this}buildShader(e,t){this.resultCode[e]=t.build(this.setShader(e),"v4")}setMaterial(e,t){return this.material=e,this.renderer=t,this.requires.lights=e.lights,this.requires.fog=e.fog,this.mergeDefines(e.defines),this}addFlow(e,t,r){return this.addSlot(e).addCache(t).addContext(r)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(e){return this.cache=null!=e?e:"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(e){return this.context=Object.assign({},this.context,e),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(e){return this.slot=e||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(e,t){void 0===this.fragmentVariables[e]&&(this.addFragmentCode(`${t} ${e};`),this.fragmentVariables[e]="")}addVertexCode(e){this.addCode(e,"vertex")}addFragmentCode(e){this.addCode(e,"fragment")}addCode(e,t){this.code[null!=t?t:this.shader]+=e+"\n"}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[null!=t?t:this.shader]+=e+"\n"}clearNodeCode(e){e=null!=e?e:this.shader;const t=this.nodeCode[e];return this.nodeCode[e]="",t}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(e){this.addFinalCode(e,"vertex")}addFragmentFinalCode(e){this.addFinalCode(e,"fragment")}addFinalCode(e,t){this.finalCode[null!=t?t:this.shader]+=e+"\n"}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[null!=t?t:this.shader]+=e+"\n"}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return-1!==this.caches.indexOf(e)}isSlot(e){return-1!==this.slots.indexOf(e)}define(e,t){this.defines[e]=void 0===t?1:t}require(e){this.requires[e]=!0}isDefined(e){return void 0!==this.defines[e]}getVar(e,t,r,i="varying",n="V",s=""){const o=this.getVars(i);let a=o[e];if(!a){const i=o.length;a={name:r||"node"+n+i+(s?"_"+s:""),type:t},o.push(a),o[e]=a}return a}getTempVar(e,t,r,i){return this.getVar(e,t,r,this.shader,"T",i)}getAttribute(e,t){if(!this.attributes[e]){const r=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(r.name+" = "+e+";"),this.attributes[e]={varying:r,name:e,type:t}}return this.attributes[e]}getCode(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join("\n")}getVarListCode(e,t){t=null!=t?t:"";let r="";for(let i=0,n=e.length;i{er(this,void 0,void 0,(function*(){for(;void 0===e.image;)yield new Promise((e=>requestAnimationFrame(e)));t.addLayerAt(1,{type:ot.TEXTURE,texture:e}),this.dispose()}))})(),t}clampUniformsForPreview(){if(this.userData.layers)for(const i of this.userData.layers.getLayers())i.type!=ot.DISPLACE_MAP&&i.type!=ot.DISPLACE_NOISE||(i.uniforms[`${i.id}_intensity`]=(e=i.uniforms[`${i.id}_intensity`],t=-150,r=150,Math.min(Math.max(e,t),r)));var e,t,r}customProgramCacheKey(){return this.getHash()}updateFrame(e){for(let t=0;tt.NormalBlending,this}getHash(){let e="{";return e+='"vertex":'+this.vertex.getHash()+",",e+='"fragment":'+this.fragment.getHash(),e+="}",e}copy(e){const t=this.uuid;for(const t in e)this[t]=e[t];return this.uuid=t,void 0!==e.userData&&(this.userData=JSON.parse(JSON.stringify(e.userData))),this}toJSON(e){const t=this.userData.layers;this.userData.layers=void 0;const r=super.toJSON(e);return r.type="ShaderMaterial",r.userData={type:this.userData.type,category:this.userData.category,nodeType:this.type,layers:t.toJSON(e)},r.vertex=this.vertex.toJSON(e).uuid,r.fragment=this.fragment.toJSON(e).uuid,delete r.vertexShader,delete r.fragmentShader,delete r.color,delete r.shininess,delete r.specular,delete r.roughness,delete r.metalness,delete r.uniforms,e&&!e.materials[this.uuid]&&(e.materials[this.uuid]=r),this.userData.layers=t,r}fromJSON(e,r){var i;this.defines=null!==(i=e.defines)&&void 0!==i?i:{},this.depthFunc=e.depthFunc,this.depthWrite=e.depthWrite,this.side=void 0!==e.side?e.side:t.FrontSide,this.transparent=e.transparent,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.wireframe=e.wireframe,this.userData.layers.fromJSON(e.userData.layers,r,this)}}Object.defineProperties(xr.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(e){!0===e&&this.version++,this.needsCompile=e},get:function(){return this.needsCompile}}});class br extends ut{constructor(){super("basic"),this.nodeType="Basic",this.color=new mt(5855577)}generate(e){let r;if(e.isShader("vertex")){const i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(t.UniformsUtils.merge([t.UniformsLib.fog])),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#include "].join("\n"));const n=["#include ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#if defined( USE_LAYER_DISPLACE )\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#ifndef FLAT_SHADED"," vNormal = normalize( transformedNormal );","#endif","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","\tvNormal = transformedNormal;","#endif"),n.push("#include ","#include ","#include ","#include ","#include ","#include ","\tvViewPosition = - mvPosition.xyz;","#include "),r=n.join("\n")}else{void 0===this.color&&(this.color=new mt(5855577)),this.color.analyze(e,{slot:"color"}),this.alpha&&this.alpha.analyze(e),this.mask&&this.mask.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"});const t=this.color.flow(e,"c",{slot:"color"}),i=this.alpha?this.alpha.flow(e,"f"):void 0,n=this.mask?this.mask.flow(e,"b"):void 0,s=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0;e.requires.transparent=void 0!==i,e.addParsCode(["#include ","#include ","varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif"].join("\n"));const o=["#include ",t.code];n&&o.push(n.code,"if ( ! "+n.result+" ) discard;"),i&&o.push(i.code,"#ifdef ALPHATEST"," if ( "+i.result+" <= ALPHATEST ) discard;","#endif"),s?o.push(s.code,`vec3 outgoingLight = ${t.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${s.result}, 1.0, SPE_BLENDING_NORMAL);`):o.push(`vec3 finalColor = ${t.result};`),i?o.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${i.result} );`):o.push("gl_FragColor = vec4("+t.result+", 1.0 );"),o.push("#include ","#include "),r=o.join("\n")}return r}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),e.position&&(this.position=e.position.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.mask&&(this.mask=e.mask.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.color&&(t.color=this.color.toJSON(e).uuid),this.position&&(t.position=this.position.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.mask&&(t.mask=this.mask.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.mask&&(this.mask=t.getNode(e.mask)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),this}}class Sr extends xr{constructor(e=new br,t){super(e,e,t),this.type="BasicNodeMaterial"}}ft.addShortcuts(Sr.prototype,"fragment",["color","alpha","afterColor","shadingAlpha","shadingBlend","mask","position"]);class Er extends Sr{constructor(e,t,r){super(t,e),this.userData.type="BasicMaterial",this.userData.category="Basic",this.userData.layers=null!=r?r:this._getLayerStack(null==e?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(void 0!==e.userData.layers&&e.userData.layers instanceof $t){const t=e.userData.layers,r=e.fragment;super.copy(e);const i=r.clone();this.fragment=i,this.vertex=i;const n=t.clone();this.userData.layers=n,n.material=this}else super.copy(e);return this}static fromJSON(e,t,r){const i=r.getNode(t.vertex),n=new Er(void 0,i);return n.fromJSON(t,r),n}static fromMaterial(e){const t=new Er(e.map?{map:e.map}:{}),r=t.fragment;return r.color.value.copy(e.color),r.alpha.value=e.opacity,t}dispose(){super.dispose()}}class Cr extends ut{constructor(){super("phong"),this.nodeType="Phong",this.color=new mt(5855577),this.specular=new mt(1118481),this.shininess=new gt(30),this.shadingAlpha=new gt(1),this.shadingBlend=new vt(0)}build(e){let r;if(e.define("PHONG"),e.requires.lights=!0,e.isShader("vertex")){const i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(t.UniformsUtils.merge([t.UniformsLib.fog,t.UniformsLib.lights])),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));const n=["#include ","#include ","#include ","#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("\t#include ","\t#include ","\t#include ","\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\t#include ","\t#include "),r=n.join("\n")}else{this.mask&&this.mask.analyze(e),void 0===this.color&&(this.color=new mt(5855577)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.normal&&this.normal.analyze(e),this.light&&this.light.analyze(e,{cache:"light"}),this.ao&&this.ao.analyze(e),this.ambient&&this.ambient.analyze(e),this.shadow&&this.shadow.analyze(e),this.emissive&&this.emissive.analyze(e,{slot:"emissive"}),this.environment&&this.environment.analyze(e,{slot:"environment"}),this.environmentAlpha&&this.environment&&this.environmentAlpha.analyze(e);const t=this.mask?this.mask.flow(e,"b"):void 0,i=this.color.flow(e,"c",{slot:"color"}),n=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0,h=this.normal?this.normal.flow(e,"v3"):void 0,u=this.light?this.light.flow(e,"v3",{cache:"light"}):void 0,d=this.ao?this.ao.flow(e,"f"):void 0,p=this.ambient?this.ambient.flow(e,"c"):void 0,f=this.shadow?this.shadow.flow(e,"c"):void 0,m=this.emissive?this.emissive.flow(e,"c",{slot:"emissive"}):void 0,g=this.environment?this.environment.flow(e,"c",{slot:"environment"}):void 0,v=this.environmentAlpha&&this.environment?this.environmentAlpha.flow(e,"f"):void 0;e.requires.transparent=void 0!==c,e.addParsCode(["#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));const y=["#include ","\tBlinnPhongMaterial material;"];t&&y.push(t.code,"if ( ! "+t.result+" ) discard;"),y.push(i.code,"\tvec3 diffuseColor = "+i.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","#include ",n.code,"\tvec3 specular = "+n.result+";",s.code,"\tfloat shininess = max( 0.0001, "+s.result+" );","\tfloat specularStrength = 1.0;"),c&&y.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),h&&y.push(h.code,"normal = "+h.result+";"),y.push("material.diffuseColor = "+(u?"vec3( 1.0 )":"diffuseColor")+";"),y.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include ","#include "),u&&(y.push(u.code,"reflectedLight.directDiffuse = "+u.result+";"),y.push("reflectedLight.directDiffuse *= diffuseColor;","reflectedLight.indirectDiffuse *= diffuseColor;")),d&&y.push(d.code,"reflectedLight.indirectDiffuse *= "+d.result+";"),p&&y.push(p.code,"reflectedLight.indirectDiffuse += "+p.result+";"),f&&y.push(f.code,"reflectedLight.directDiffuse *= "+f.result+";","reflectedLight.directSpecular += "+f.result+";"),m&&y.push(m.code,"reflectedLight.directDiffuse += "+m.result+";"),y.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;"),g&&(y.push(g.code),v?y.push(v.code,"outgoingLight = mix( outgoingLight, "+g.result+", "+v.result+" );"):y.push("outgoingLight = "+g.result+";")),y.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result}, ${a.result} );\n\t\t\t\t}\n\t\t\t\t`),l&&y.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),c?y.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):y.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),y.push("#include ","#include ","#include ","#include ","#include "),r=y.join("\n")}return r}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.mask&&(this.mask=e.mask.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.normal&&(this.normal=e.normal.clone()),e.light&&(this.light=e.light.clone()),e.shadow&&(this.shadow=e.shadow.clone()),e.ao&&(this.ao=e.ao.clone()),e.emissive&&(this.emissive=e.emissive.clone()),e.ambient&&(this.ambient=e.ambient.clone()),e.environment&&(this.environment=e.environment.clone()),e.environmentAlpha&&(this.environmentAlpha=e.environmentAlpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.specular=this.specular.toJSON(e).uuid,t.shininess=this.shininess.toJSON(e).uuid,t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid,t.shadingBlend=this.shadingBlend.toJSON(e).uuid,this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid),this.mask&&(t.mask=this.mask.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.normal&&(t.normal=this.normal.toJSON(e).uuid),this.light&&(t.light=this.light.toJSON(e).uuid),this.ao&&(t.ao=this.ao.toJSON(e).uuid),this.ambient&&(t.ambient=this.ambient.toJSON(e).uuid),this.shadow&&(t.shadow=this.shadow.toJSON(e).uuid),this.emissive&&(t.emissive=this.emissive.toJSON(e).uuid),this.environment&&(t.environment=this.environment.toJSON(e).uuid),this.environmentAlpha&&(t.environmentAlpha=this.environmentAlpha.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.specular&&(this.specular=t.getNode(e.specular)),e.shininess&&(this.shininess=t.getNode(e.shininess)),e.mask&&(this.mask=t.getNode(e.mask)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.normal&&(this.normal=t.getNode(e.normal)),e.light&&(this.light=t.getNode(e.light)),e.ao&&(this.ao=t.getNode(e.ao)),e.ambient&&(this.ambient=t.getNode(e.ambient)),e.shadow&&(this.shadow=t.getNode(e.shadow)),e.emissive&&(this.emissive=t.getNode(e.emissive)),e.environment&&(this.environment=t.getNode(e.environment)),e.environmentAlpha&&(this.environmentAlpha=t.getNode(e.environmentAlpha)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}}class Tr extends xr{constructor(e=new Cr,t){super(e,e,t),this.type="PhongNodeMaterial"}}ft.addShortcuts(Tr.prototype,"fragment",["color","afterColor","alpha","shadingAlpha","shadingBlend","specular","shininess","normal","emissive","ambient","light","shadow","ao","environment","environmentAlpha","mask","position"]);class Or extends Tr{constructor(e,t,r){super(t,e),this.userData.type="PhongMaterial",this.userData.category="Phong",this.userData.layers=null!=r?r:this._getLayerStack(null==e?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(void 0!==e.userData.layers&&e.userData.layers instanceof $t){const t=e.userData.layers,r=e.fragment;super.copy(e);const i=r.clone();this.fragment=i,this.vertex=i;const n=t.clone();this.userData.layers=n,n.material=this,i.shadingAlpha.value=r.shadingAlpha.value,i.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){const i=r.getNode(t.vertex),n=new Or(void 0,i);return n.fromJSON(t,r),n}static fromMaterial(e){const t=new Or(e.map?{map:e.map}:{}),r=t.fragment;return r.color.value.copy(e.color),r.alpha.value=e.opacity,t}dispose(){super.dispose()}}class Dr extends ut{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new mt(5855577),this.emissive=new mt(0),this.emissiveIntensity=new gt(1),this.shadingAlpha=new gt(1),this.shadingBlend=new vt(0)}build(e){let r;if(e.define("LAMBERT"),e.requires.lights=!0,e.isShader("vertex")){const i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(t.UniformsUtils.merge([t.UniformsLib.fog,t.UniformsLib.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","\tvarying vec3 vIndirectBack;","#endif","#include ","#include ","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));const n=["#include ","#include ","#include ","#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("\t#include ","\t#include ","\t#include ","\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\n\t\t\t\t\tvec3 diffuse = vec3( 1.0 );\n\t\t\t\t\tGeometricContext geometry;\n\t\t\t\t\tgeometry.position = mvPosition.xyz;\n\t\t\t\t\tgeometry.normal = normalize( transformedNormal );\n\t\t\t\t\tgeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\t\t\t\t\tGeometricContext backGeometry;\n\t\t\t\t\tbackGeometry.position = geometry.position;\n\t\t\t\t\tbackGeometry.normal = -geometry.normal;\n\t\t\t\t\tbackGeometry.viewDir = geometry.viewDir;\n\t\t\t\t\tvLightFront = vec3( 0.0 );\n\t\t\t\t\tvIndirectFront = vec3( 0.0 );\n\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\tvLightBack = vec3( 0.0 );\n\t\t\t\t\t\tvIndirectBack = vec3( 0.0 );\n\t\t\t\t\t#endif\n\t\t\t\t\tIncidentLight directLight;\n\t\t\t\t\tfloat dotNL;\n\t\t\t\t\tvec3 directLightColor_Diffuse;\n\t\t\t\t\t#if NUM_POINT_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_SPOT_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_DIR_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_HEMI_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t","\t#include ","\t#include "),r=n.join("\n")}else{this.mask&&this.mask.analyze(e),void 0===this.color&&(this.color=new mt(5855577)),this.color.analyze(e,{slot:"color"}),this.emissive.analyze(e,{slot:"emissive"}),this.emissiveIntensity.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.normal&&this.normal.analyze(e),this.light&&this.light.analyze(e,{cache:"light"}),this.ao&&this.ao.analyze(e),this.ambient&&this.ambient.analyze(e),this.shadow&&this.shadow.analyze(e),this.environment&&this.environment.analyze(e,{slot:"environment"}),this.environmentAlpha&&this.environment&&this.environmentAlpha.analyze(e);const t=this.mask?this.mask.flow(e,"b"):void 0,i=this.color.flow(e,"c",{slot:"color"}),n=this.emissive.flow(e,"c",{slot:"emissive"}),s=this.emissiveIntensity.flow(e,"f",{slot:"emissive"}),o=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0,h=this.normal?this.normal.flow(e,"v3"):void 0;this.environment&&this.environment.flow(e,"c",{slot:"environment"}),this.environmentAlpha&&this.environment&&this.environmentAlpha.flow(e,"f");e.requires.transparent=void 0!==c,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","\tvarying vec3 vIndirectBack;","#endif","#include ","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));const u=["#include ","#include "];t&&u.push(t.code,"if ( ! "+t.result+" ) discard;"),u.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","#include "),c&&u.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),h&&u.push(h.code,"normal = "+h.result+";"),u.push("#ifdef DOUBLE_SIDED","\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;","#else","\treflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include ","reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor );","#ifdef DOUBLE_SIDED","\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;","#else","\treflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor ) * getShadowMask();"),n&&u.push(n.code,"reflectedLight.directDiffuse += "+n.result+" * "+s.result+";"),u.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;"),u.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result}, ${a.result} );\n\t\t\t\t}\n\t\t\t\t`),l&&u.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),c?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u.push("#include ","#include ","#include ","#include ","#include "),r=u.join("\n")}return r}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.emissiveIntensity=e.emissiveIntensity.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.mask&&(this.mask=e.mask.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.normal&&(this.normal=e.normal.clone()),e.light&&(this.light=e.light.clone()),e.shadow&&(this.shadow=e.shadow.clone()),e.ao&&(this.ao=e.ao.clone()),e.emissive&&(this.emissive=e.emissive.clone()),e.ambient&&(this.ambient=e.ambient.clone()),e.environment&&(this.environment=e.environment.clone()),e.environmentAlpha&&(this.environmentAlpha=e.environmentAlpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.emissiveIntensity=this.emissiveIntensity.toJSON(e).uuid,t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid,t.shadingBlend=this.shadingBlend.toJSON(e).uuid,this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid),this.mask&&(t.mask=this.mask.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.normal&&(t.normal=this.normal.toJSON(e).uuid),this.light&&(t.light=this.light.toJSON(e).uuid),this.ao&&(t.ao=this.ao.toJSON(e).uuid),this.ambient&&(t.ambient=this.ambient.toJSON(e).uuid),this.shadow&&(t.shadow=this.shadow.toJSON(e).uuid),this.emissive&&(t.emissive=this.emissive.toJSON(e).uuid),this.environment&&(t.environment=this.environment.toJSON(e).uuid),this.environmentAlpha&&(t.environmentAlpha=this.environmentAlpha.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),e.emissiveIntensity&&(this.emissiveIntensity=t.getNode(e.emissiveIntensity)),e.mask&&(this.mask=t.getNode(e.mask)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.normal&&(this.normal=t.getNode(e.normal)),e.light&&(this.light=t.getNode(e.light)),e.ao&&(this.ao=t.getNode(e.ao)),e.ambient&&(this.ambient=t.getNode(e.ambient)),e.shadow&&(this.shadow=t.getNode(e.shadow)),e.emissive&&(this.emissive=t.getNode(e.emissive)),e.environment&&(this.environment=t.getNode(e.environment)),e.environmentAlpha&&(this.environmentAlpha=t.getNode(e.environmentAlpha)),this}}class Mr extends xr{constructor(e=new Dr,t){super(e,e,t),this.type="LambertNodeMaterial"}}ft.addShortcuts(Mr.prototype,"fragment",["color","afterColor","alpha","shadingAlpha","shadingBlend","normal","emissive","emissiveIntensity","ambient","light","shadow","ao","environment","environmentAlpha","mask","position"]);class _r extends Mr{constructor(e,t,r){super(t,e),this.userData.type="LambertMaterial",this.userData.category="Lambert",this.userData.layers=null!=r?r:this._getLayerStack(null==e?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(void 0!==e.userData.layers&&e.userData.layers instanceof $t){const t=e.userData.layers,r=e.fragment;super.copy(e);const i=r.clone();this.fragment=i,this.vertex=i;const n=t.clone();this.userData.layers=n,n.material=this,i.shadingAlpha.value=r.shadingAlpha.value,i.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){const i=r.getNode(t.vertex),n=new _r(void 0,i);return n.fromJSON(t,r),n}dispose(){super.dispose()}}class Nr extends ut{constructor(){super("toon"),this.nodeType="Toon",this.color=new mt(5855577),this.specular=new mt(1118481),this.shininess=new gt(30),this.shadingAlpha=new gt(1),this.shadingBlend=new vt(0)}build(e){let r;if(e.define("TOON"),e.requires.lights=!0,e.isShader("vertex")){const i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(t.UniformsUtils.merge([t.UniformsLib.fog,t.UniformsLib.lights])),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));const n=["#include ","#include ","#include ","#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("\t#include ","\t#include ","\t#include ","\t#include ","\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\t#include ","\t#include "),r=n.join("\n")}else{this.mask&&this.mask.analyze(e),void 0===this.color&&(this.color=new mt(5855577)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.normal&&this.normal.analyze(e),this.light&&this.light.analyze(e,{cache:"light"}),this.ao&&this.ao.analyze(e),this.ambient&&this.ambient.analyze(e),this.shadow&&this.shadow.analyze(e),this.emissive&&this.emissive.analyze(e,{slot:"emissive"}),this.environment&&this.environment.analyze(e,{slot:"environment"}),this.environmentAlpha&&this.environment&&this.environmentAlpha.analyze(e);const t=this.mask?this.mask.flow(e,"b"):void 0,i=this.color.flow(e,"c",{slot:"color"}),n=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0,h=this.normal?this.normal.flow(e,"v3"):void 0,u=this.light?this.light.flow(e,"v3",{cache:"light"}):void 0,d=this.ao?this.ao.flow(e,"f"):void 0,p=this.ambient?this.ambient.flow(e,"c"):void 0,f=this.shadow?this.shadow.flow(e,"c"):void 0,m=this.emissive?this.emissive.flow(e,"c",{slot:"emissive"}):void 0,g=this.environment?this.environment.flow(e,"c",{slot:"environment"}):void 0,v=this.environmentAlpha&&this.environment?this.environmentAlpha.flow(e,"f"):void 0;e.requires.transparent=void 0!==c,e.addParsCode(["#include ","#include ","#include ","#include ","#include ","\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#endif\n\t\t\t\t\tstruct ToonMaterial {\n\t\t\t\t\t\tvec3\tdiffuseColor;\n\t\t\t\t\t\tvec3\tspecularColor;\n\t\t\t\t\t\tfloat\tspecularShininess;\n\t\t\t\t\t\tfloat\tspecularStrength;\n\t\t\t\t\t};\n\t\t\t\t\tvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\t\t\t\t\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t\t\t\t\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\t\t\t\t\tirradiance *= PI;\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t\t\t\t\t\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n\t\t\t\t\t}\n\t\t\t\t\tvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\t\t\t\t\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t\t\t\t\t}\n\t\t\t\t\t#define RE_Direct\t\t\t\tRE_Direct_Toon\n\t\t\t\t\t#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n\t\t\t\t\t#define Material_LightProbeLOD( material )\t(0)\n\t\t\t\t\t","#include ","#include ","#include ","#include "].join("\n"));const y=["#include ","\tToonMaterial material;"];t&&y.push(t.code,"if ( ! "+t.result+" ) discard;"),y.push(i.code,"\tvec3 diffuseColor = "+i.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","#include ",n.code,"\tvec3 specular = "+n.result+";",s.code,"\tfloat shininess = max( 0.0001, "+s.result+" );","\tfloat specularStrength = 1.0;"),c&&y.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),h&&y.push(h.code,"normal = "+h.result+";"),y.push("material.diffuseColor = "+(u?"vec3( 1.0 )":"diffuseColor")+";"),y.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include ","#include "),u&&(y.push(u.code,"reflectedLight.directDiffuse = "+u.result+";"),y.push("reflectedLight.directDiffuse *= diffuseColor;","reflectedLight.indirectDiffuse *= diffuseColor;")),d&&y.push(d.code,"reflectedLight.indirectDiffuse *= "+d.result+";"),p&&y.push(p.code,"reflectedLight.indirectDiffuse += "+p.result+";"),f&&y.push(f.code,"reflectedLight.directDiffuse *= "+f.result+";","reflectedLight.directSpecular += "+f.result+";"),m&&y.push(m.code,"reflectedLight.directDiffuse += "+m.result+";"),y.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;"),g&&(y.push(g.code),v?y.push(v.code,"outgoingLight = mix( outgoingLight, "+g.result+", "+v.result+" );"):y.push("outgoingLight = "+g.result+";")),y.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result}, ${a.result} );\n\t\t\t\t}\n\t\t\t\t`),l&&y.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),c?y.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):y.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),y.push("#include ","#include ","#include ","#include ","#include "),r=y.join("\n")}return r}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.mask&&(this.mask=e.mask.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.normal&&(this.normal=e.normal.clone()),e.light&&(this.light=e.light.clone()),e.shadow&&(this.shadow=e.shadow.clone()),e.ao&&(this.ao=e.ao.clone()),e.emissive&&(this.emissive=e.emissive.clone()),e.ambient&&(this.ambient=e.ambient.clone()),e.environment&&(this.environment=e.environment.clone()),e.environmentAlpha&&(this.environmentAlpha=e.environmentAlpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.specular=this.specular.toJSON(e).uuid,t.shininess=this.shininess.toJSON(e).uuid,this.mask&&(t.mask=this.mask.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.normal&&(t.normal=this.normal.toJSON(e).uuid),this.light&&(t.light=this.light.toJSON(e).uuid),this.ao&&(t.ao=this.ao.toJSON(e).uuid),this.ambient&&(t.ambient=this.ambient.toJSON(e).uuid),this.shadow&&(t.shadow=this.shadow.toJSON(e).uuid),this.emissive&&(t.emissive=this.emissive.toJSON(e).uuid),this.environment&&(t.environment=this.environment.toJSON(e).uuid),this.environmentAlpha&&(t.environmentAlpha=this.environmentAlpha.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.specular&&(this.specular=t.getNode(e.specular)),e.shininess&&(this.shininess=t.getNode(e.shininess)),e.mask&&(this.mask=t.getNode(e.mask)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.normal&&(this.normal=t.getNode(e.normal)),e.light&&(this.light=t.getNode(e.light)),e.ao&&(this.ao=t.getNode(e.ao)),e.ambient&&(this.ambient=t.getNode(e.ambient)),e.shadow&&(this.shadow=t.getNode(e.shadow)),e.emissive&&(this.emissive=t.getNode(e.emissive)),e.environment&&(this.environment=t.getNode(e.environment)),e.environmentAlpha&&(this.environmentAlpha=t.getNode(e.environmentAlpha)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}}class Lr extends xr{constructor(e=new Nr,t){super(e,e,t),this.type="ToonNodeMaterial"}}ft.addShortcuts(Lr.prototype,"fragment",["color","afterColor","alpha","shadingAlpha","shadingBlend","specular","shininess","normal","emissive","ambient","light","shadow","ao","environment","environmentAlpha","mask","position"]);class Br extends Lr{constructor(e,t,r){super(t,e),this.userData.type="ToonMaterial",this.userData.category="Toon",this.userData.layers=null!=r?r:this._getLayerStack(null==e?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(void 0!==e.userData.layers&&e.userData.layers instanceof $t){const t=e.userData.layers,r=e.fragment;super.copy(e);const i=r.clone();this.fragment=i,this.vertex=i;const n=t.clone();this.userData.layers=n,n.material=this,i.shadingAlpha.value=r.shadingAlpha.value,i.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){const i=r.getNode(t.vertex),n=new Br(void 0,i);return n.fromJSON(t,r),n}dispose(){super.dispose()}}class Ir extends gt{constructor(e){super(),this.nodeType="MaxMIPLevel",this.texture=e,this.maxMIPLevel=0}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.texture&&(t.texture=this.texture.toJSON(e).uuid),t.maxMIPLevel=this.maxMIPLevel),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.texture&&(this.texture=t.getNode(e.texture)),void 0!==e.maxMIPLevel&&(this.maxMIPLevel=e.maxMIPLevel),this}}Object.defineProperties(Ir.prototype,{value:{get:function(){if(0===this.maxMIPLevel){let e=this.texture.value.image;Array.isArray(e)&&(e=e[0]),this.maxMIPLevel=void 0!==e?Math.log(Math.max(e.width,e.height))*Math.LOG2E:0}return this.maxMIPLevel},set:function(){}}});class Pr extends dt{constructor(e=new ut,t){super("f"),this.nodeType="SpecularMIPLevel",this.roughness=e,this.texture=t}setTexture(e){return this.texture=e,this}generate(e,t){var r;if(e.isShader("fragment")){this.maxMIPLevel=null!==(r=this.maxMIPLevel)&&void 0!==r?r:new Ir,this.maxMIPLevel.texture=this.texture;const i=e.include(Pr.Nodes.getSpecularMIPLevel);return e.format(i+"( "+this.roughness.build(e,"f")+", "+this.maxMIPLevel.build(e,"f")+" )",this.type,t)}return console.warn("SpecularMIPLevelNode is not compatible with "+e.shader+" shader."),e.format("0.0",this.type,t)}copy(e){return super.copy(e),this.roughness=e.roughness,e.texture?this.texture?this.texture.copy(e.texture):this.texture=e.texture.clone():this.texture=void 0,e.maxMIPLevel?this.maxMIPLevel?this.maxMIPLevel.copy(e.maxMIPLevel):this.maxMIPLevel=e.maxMIPLevel.clone():this.maxMIPLevel=void 0,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.texture&&(t.texture=this.texture.toJSON(e).uuid),this.roughness&&(t.roughness=this.roughness.toJSON(e).uuid),this.maxMIPLevel&&(t.maxMIPLevel=this.maxMIPLevel.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.roughness&&(this.roughness=t.getNode(e.roughness)),e.texture&&(this.texture=t.getNode(e.texture)),e.maxMIPLevel&&(this.maxMIPLevel=t.getNode(e.maxMIPLevel)),this}}Pr.Nodes={getSpecularMIPLevel:new Ot(["float getSpecularMIPLevel( const in float roughness, const in float maxMIPLevelScalar ) {","\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );","\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );","\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );","}"].join("\n"))};class Rr extends ut{constructor(){super("standard"),this.nodeType="Standard",this.color=new mt(5855577),this.roughness=new gt(.3),this.metalness=new gt(0),this.reflectivity=new gt(.5),this.shadingAlpha=new gt(1),this.shadingBlend=new vt(0)}build(e){var r,i,n,s,o,a,l;let c;e.define("STANDARD");const h=null!==(i=null!==(r=this.clearcoat)&&void 0!==r?r:this.clearcoatRoughness)&&void 0!==i?i:this.clearcoatNormal;if(h&&e.define("CLEARCOAT"),e.requires.lights=!0,e.extensions.derivatives=!0,e.extensions.shaderTextureLOD=!0,e.isShader("vertex")){const r=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(t.UniformsUtils.merge([t.UniformsLib.fog,t.UniformsLib.lights])),t.UniformsLib.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));const i=["#include ","#include ","#include ","#include ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#if defined( USE_LAYER_DISPLACE )\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];r&&i.push(r.code,r.result?"displaced_position = "+r.result+";":""),i.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push("#include ","#include ","#include ","#include ","#include ","#include ","\tvViewPosition = - mvPosition.xyz;","#include ","#include "),c=i.join("\n")}else{const t=new _t("material.specularRoughness","f"),r=new _t("material.clearcoatRoughness","f"),i={roughness:t,bias:new Pr(t),viewNormal:new _t("normal","v3"),worldNormal:new _t("inverseTransformDirection( geometry.normal, viewMatrix )","v3"),gamma:!0},u={gamma:!0},d={roughness:r,bias:new Pr(r),viewNormal:new _t("clearcoatNormal","v3"),worldNormal:new _t("inverseTransformDirection( geometry.clearcoatNormal, viewMatrix )","v3"),gamma:!0};this.mask&&this.mask.analyze(e),void 0===this.color&&(this.color=new mt(5855577)),this.color.analyze(e,{slot:"color",context:u}),this.roughness.analyze(e),this.metalness.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.normal&&this.normal.analyze(e),this.clearcoat&&this.clearcoat.analyze(e),this.clearcoatRoughness&&this.clearcoatRoughness.analyze(e),this.clearcoatNormal&&this.clearcoatNormal.analyze(e),this.reflectivity&&this.reflectivity.analyze(e),this.light&&this.light.analyze(e,{cache:"light"}),this.ao&&this.ao.analyze(e),this.ambient&&this.ambient.analyze(e),this.shadow&&this.shadow.analyze(e),this.emissive&&this.emissive.analyze(e,{slot:"emissive"}),this.environment&&(this.environment.analyze(e,{cache:"radiance",context:i,slot:"radiance"}),e.requires.irradiance&&this.environment.analyze(e,{cache:"irradiance",context:i,slot:"irradiance"})),this.sheen&&this.sheen.analyze(e);const p=this.mask?this.mask.flow(e,"b"):void 0,f=this.color.flow(e,"c",{slot:"color",context:u}),m=this.roughness.flow(e,"f"),g=this.metalness.flow(e,"f"),v=this.shadingAlpha.flow(e,"f"),y=this.shadingBlend.flow(e,"i"),A=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,w=this.alpha?this.alpha.flow(e,"f"):void 0,x=this.normal?this.normal.flow(e,"v3"):void 0,b=this.clearcoat?this.clearcoat.flow(e,"f"):void 0,S=this.clearcoatRoughness?this.clearcoatRoughness.flow(e,"f"):void 0,E=this.clearcoatNormal?this.clearcoatNormal.flow(e,"v3"):void 0,C=this.reflectivity?this.reflectivity.flow(e,"f"):void 0,T=this.light?this.light.flow(e,"v3",{cache:"light"}):void 0,O=this.ao?this.ao.flow(e,"f"):void 0,D=this.ambient?this.ambient.flow(e,"c"):void 0,M=this.shadow?this.shadow.flow(e,"c"):void 0,_=this.emissive?this.emissive.flow(e,"c",{slot:"emissive"}):void 0;let N;this.environment&&(N={radiance:this.environment.flow(e,"c",{cache:"radiance",context:i,slot:"radiance"})},e.requires.irradiance&&(N.irradiance=this.environment.flow(e,"c",{cache:"irradiance",context:i,slot:"irradiance"})));const L=h&&N?null===(n=this.environment)||void 0===n?void 0:n.flow(e,"c",{cache:"clearcoat",context:d,slot:"environment"}):void 0,B=this.sheen?this.sheen.flow(e,"c"):void 0;e.requires.transparent=void 0!==w,e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));const I=["#include ","\t#include ","\t#include ","\tPhysicalMaterial material;","\tmaterial.diffuseColor = vec3( 1.0 );"];p&&I.push(p.code,"if ( ! "+p.result+" ) discard;"),I.push(f.code,"\tvec3 diffuseColor = "+f.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","#include ",m.code,"\tfloat roughnessFactor = "+m.result+";",g.code,"\tfloat metalnessFactor = "+g.result+";"),w&&I.push(w.code,"#ifdef ALPHATEST","\tif ( "+w.result+" <= ALPHATEST ) discard;","#endif"),x&&I.push(x.code,"normal = "+x.result+";"),E&&I.push(E.code,"clearcoatNormal = "+E.result+";"),I.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),I.push("material.diffuseColor = "+(T?"vec3( 1.0 )":"diffuseColor * ( 1.0 - metalnessFactor )")+";","material.specularRoughness = max( roughnessFactor, 0.0525 );","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );"),b?I.push(b.code,"material.clearcoat = saturate( "+b.result+" );"):h&&I.push("material.clearcoat = 0.0;"),S?I.push(S.code,"material.clearcoatRoughness = max( "+S.result+", 0.0525 );","material.clearcoatRoughness += geometryRoughness;","material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );"):h&&I.push("material.clearcoatRoughness = 0.0;"),B&&I.push("material.sheenColor = "+B.result+";"),C?I.push(C.code,"material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( "+C.result+" ) ), diffuseColor, metalnessFactor );"):I.push("material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor, metalnessFactor );"),I.push("#include "),T&&(I.push(T.code,"reflectedLight.directDiffuse = "+T.result+";"),I.push("diffuseColor *= 1.0 - metalnessFactor;","reflectedLight.directDiffuse *= diffuseColor;","reflectedLight.indirectDiffuse *= diffuseColor;")),O&&I.push(O.code,"reflectedLight.indirectDiffuse *= "+O.result+";","float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );","reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, "+O.result+", material.specularRoughness );"),D&&I.push(D.code,"reflectedLight.indirectDiffuse += "+D.result+";"),M&&I.push(M.code,"reflectedLight.directDiffuse *= "+M.result+";","reflectedLight.directSpecular *= "+M.result+";"),_&&I.push(_.code,"reflectedLight.directDiffuse += "+_.result+";"),N&&(I.push(null===(s=N.radiance)||void 0===s?void 0:s.code),e.requires.irradiance&&I.push(null===(o=N.irradiance)||void 0===o?void 0:o.code),L&&I.push(L.code,"clearcoatRadiance += "+L.result+";"),I.push("radiance += "+(null===(a=N.radiance)||void 0===a?void 0:a.result)+";"),e.requires.irradiance&&I.push("iblIrradiance += PI * "+(null===(l=N.irradiance)||void 0===l?void 0:l.result)+";")),I.push("#include "),I.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;"),I.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${v.result} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${v.result}, ${y.result} );\n\t\t\t\t}\n\t\t\t\t`),A&&I.push(A.code,`outgoingLight = spe_blend(outgoingLight, ${A.result}, 1.0, SPE_BLENDING_NORMAL);`),w?I.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${w.result} );`):I.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),I.push("#include ","#include ","#include ","#include ","#include "),c=I.join("\n")}return c}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.mask&&(this.mask=e.mask.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.normal&&(this.normal=e.normal.clone()),e.clearcoat&&(this.clearcoat=e.clearcoat.clone()),e.clearcoatRoughness&&(this.clearcoatRoughness=e.clearcoatRoughness.clone()),e.clearcoatNormal&&(this.clearcoatNormal=e.clearcoatNormal.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.light&&(this.light=e.light.clone()),e.shadow&&(this.shadow=e.shadow.clone()),e.ao&&(this.ao=e.ao.clone()),e.emissive&&(this.emissive=e.emissive.clone()),e.ambient&&(this.ambient=e.ambient.clone()),e.environment&&(this.environment=e.environment.clone()),e.sheen&&(this.sheen=e.sheen.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.roughness=this.roughness.toJSON(e).uuid,t.metalness=this.metalness.toJSON(e).uuid,this.mask&&(t.mask=this.mask.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.normal&&(t.normal=this.normal.toJSON(e).uuid),this.clearcoat&&(t.clearcoat=this.clearcoat.toJSON(e).uuid),this.clearcoatRoughness&&(t.clearcoatRoughness=this.clearcoatRoughness.toJSON(e).uuid),this.clearcoatNormal&&(t.clearcoatNormal=this.clearcoatNormal.toJSON(e).uuid),this.reflectivity&&(t.reflectivity=this.reflectivity.toJSON(e).uuid),this.light&&(t.light=this.light.toJSON(e).uuid),this.ao&&(t.ao=this.ao.toJSON(e).uuid),this.ambient&&(t.ambient=this.ambient.toJSON(e).uuid),this.shadow&&(t.shadow=this.shadow.toJSON(e).uuid),this.emissive&&(t.emissive=this.emissive.toJSON(e).uuid),this.environment&&(t.environment=this.environment.toJSON(e).uuid),this.sheen&&(t.sheen=this.sheen.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.roughness&&(this.roughness=t.getNode(e.roughness)),e.metalness&&(this.metalness=t.getNode(e.metalness)),e.mask&&(this.mask=t.getNode(e.mask)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.normal&&(this.normal=t.getNode(e.normal)),e.clearcoat&&(this.clearcoat=t.getNode(e.clearcoat)),e.clearcoatRoughness&&(this.clearcoatRoughness=t.getNode(e.clearcoatRoughness)),e.clearcoatNormal&&(this.clearcoatNormal=t.getNode(e.clearcoatNormal)),e.reflectivity&&(this.reflectivity=t.getNode(e.reflectivity)),e.light&&(this.light=t.getNode(e.light)),e.ao&&(this.ao=t.getNode(e.ao)),e.ambient&&(this.ambient=t.getNode(e.ambient)),e.shadow&&(this.shadow=t.getNode(e.shadow)),e.emissive&&(this.emissive=t.getNode(e.emissive)),e.environment&&(this.environment=t.getNode(e.environment)),e.sheen&&(this.sheen=t.getNode(e.sheen)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}}class Fr extends xr{constructor(e=new Rr,t){super(e,e,t),this.type="StandardNodeMaterial"}}ft.addShortcuts(Fr.prototype,"fragment",["color","afterColor","alpha","shadingAlpha","shadingBlend","roughness","metalness","reflectivity","clearcoat","clearcoatRoughness","clearcoatNormal","normal","emissive","fresnel","ambient","light","shadow","ao","environment","mask","position","sheen"]);class Ur extends Fr{constructor(e,t,r){super(t,e),this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=null!=r?r:this._getLayerStack(null==e?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(void 0!==e.userData.layers&&e.userData.layers instanceof $t){const t=e.userData.layers,r=e.fragment;super.copy(e);const i=r.clone();this.fragment=i,this.vertex=i;const n=t.clone();this.userData.layers=n,n.material=this,i.shadingAlpha.value=r.shadingAlpha.value,i.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){const i=r.getNode(t.vertex),n=new Ur(void 0,i);return n.fromJSON(t,r),n}dispose(){super.dispose()}}const zr={BasicMaterial:Er,PhongMaterial:Or,LambertMaterial:_r,ToonMaterial:Br,PhysicalMaterial:Ur},kr=new Set;var Gr,jr;!function(e){e[e.LINEAR=0]="LINEAR",e[e.EASE=1]="EASE",e[e.EASE_IN=2]="EASE_IN",e[e.EASE_OUT=3]="EASE_OUT",e[e.EASE_IN_OUT=4]="EASE_IN_OUT",e[e.CUBIC=5]="CUBIC",e[e.SPRING=6]="SPRING"}(Gr||(Gr={}));class Vr{constructor(){this.easing=Gr.EASE_IN_OUT,this.duration=1e3,this.delay=0,this.cubicControls=[.5,.05,.1,.3],this.springParameters={mass:1,stiffness:80,damping:10,velocity:0},this.repeat=!1,this.cycle=!1,this.rewind=!1}get sp_mass(){return this.springParameters.mass}set sp_mass(e){this.springParameters.mass=e}get sp_stiffness(){return this.springParameters.stiffness}set sp_stiffness(e){this.springParameters.stiffness=e}get sp_damping(){return this.springParameters.damping}set sp_damping(e){this.springParameters.damping=e}get sp_velocity(){return this.springParameters.velocity}set sp_velocity(e){this.springParameters.velocity=e}copy(e){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters=Object.assign({},e.springParameters),this.repeat=e.repeat,this.cycle=e.cycle,this.rewind=e.rewind,this}clone(){return(new Vr).copy(this)}toJSON(){const e={easing:this.easing,duration:this.duration,delay:this.delay,cubicControls:this.cubicControls,springParameters:Object.assign({},this.springParameters)};return!0===this.repeat&&(e.repeat=!0),!0===this.cycle&&(e.cycle=!0),!0===this.rewind&&(e.rewind=!0),void 0!==this.object&&(e.object=this.object.uuid),void 0!==this.state&&(e.state=this.state.uuid),e}fromJSON(e,t,r){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters.mass=e.springParameters.mass,this.springParameters.stiffness=e.springParameters.stiffness,this.springParameters.damping=e.springParameters.damping,this.springParameters.velocity=e.springParameters.velocity,void 0!==e.repeat&&(this.repeat=e.repeat),void 0!==e.cycle&&(this.cycle=e.cycle),void 0!==e.rewind&&(this.rewind=e.rewind),void 0!==e.object&&(this.object=t[e.object]),void 0!==e.state&&(this.state=r[e.state]),this}}!function(e){e[e.MOUSE_DOWN=0]="MOUSE_DOWN",e[e.MOUSE_UP=1]="MOUSE_UP",e[e.MOUSE_HOVER=2]="MOUSE_HOVER",e[e.MOUSE_ENTER=3]="MOUSE_ENTER",e[e.MOUSE_LEAVE=4]="MOUSE_LEAVE",e[e.KEY_DOWN=5]="KEY_DOWN",e[e.KEY_UP=6]="KEY_UP",e[e.START=7]="START",e[e.OPEN_LINK=8]="OPEN_LINK",e[e.LOOK_AT=9]="LOOK_AT",e[e.FOLLOW=10]="FOLLOW"}(jr||(jr={}));class Hr{constructor(e,t){this.targets=[],this.ui={isCollapsed:!1},this._type=e,this.key=t}get type(){return this._type}set type(e){this._type=e,e===jr.LOOK_AT?this.distance=1e3:this.distance=void 0,e!==jr.KEY_DOWN&&e!==jr.KEY_UP&&(this.key=void 0)}newTarget(e){const t=new Vr;if(t.object=e,void 0!==e){const r=e.interaction.states;r.length>0&&(t.state=r[r.length-1])}return this.targets.push(t),kr.add(t),t}addTarget(e,t=0){this.targets.splice(t,0,e),kr.add(e)}removeTarget(e){kr.delete(this.targets[e]),this.targets.splice(e,1)}dispatchReverse(){for(let e=0,t=this.targets.length;e0){e.targets=[];for(let t=0,r=this.targets.length;te.clone()))})}else this.material={layersList:e.material.layersList.map((e=>e.clone()))};return void 0!==e.camera&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho}),this}clone(){return(new Jr).copy(this)}toJSON(e){const t={uuid:this.uuid,name:this.name,position:this.position.toArray(),rotation:this.rotation.toArray(),scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};if(void 0!==this.geometry&&(t.geometry={width:this.geometry.width,height:this.geometry.height,depth:this.geometry.depth}),void 0!==this.material)if(this.material instanceof Array){t.material=[];for(let r=0,i=this.material.length;rt.toJSON(e)))})}else t.material={layersList:this.material.layersList.map((t=>t.toJSON(e)))};return void 0!==this.camera&&(t.camera={zoomPersp:this.camera.zoomPersp,zoomOrtho:this.camera.zoomOrtho}),t}fromJSON(e,t){if(this.uuid=e.uuid,this.name=e.name,this.position.fromArray(e.position),this.rotation.fromArray(e.rotation),this.scale.fromArray(e.scale),this.hiddenMatrix.fromArray(e.hiddenMatrix),void 0!==e.geometry&&(this.geometry={width:e.geometry.width,height:e.geometry.height,depth:e.geometry.depth}),void 0!==e.material)if(e.material instanceof Array){this.material=[];for(let r=0,i=e.material.length;rct(e,t)))})}else this.material={layersList:e.material.layersList.map((e=>ct(e,t)))};return void 0!==e.camera&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho}),this}}var Qr={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Yr={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Wr=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Xr={CSS:{},springs:{}};function Kr(e,t,r){return Math.min(Math.max(e,t),r)}function qr(e,t){return e.indexOf(t)>-1}function Zr(e,t){return e.apply(null,t)}var $r={arr:function(e){return Array.isArray(e)},obj:function(e){return qr(Object.prototype.toString.call(e),"Object")},pth:function(e){return $r.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return!("isNode"in e)&&(e.nodeType||$r.svg(e))},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return $r.hex(e)||$r.rgb(e)||$r.hsl(e)},key:function(e){return!Qr.hasOwnProperty(e)&&!Yr.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function ei(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ti(e,t){var r=ei(e),i=Kr($r.und(r[0])?1:r[0],.1,100),n=Kr($r.und(r[1])?100:r[1],.1,100),s=Kr($r.und(r[2])?10:r[2],.1,100),o=Kr($r.und(r[3])?0:r[3],.1,100),a=Math.sqrt(n/i),l=s/(2*Math.sqrt(n*i)),c=l<1?a*Math.sqrt(1-l*l):0,h=l<1?(l*a-o)/c:-o+a;function u(e){var r=t?t*e/1e3:e;return r=l<1?Math.exp(-r*l*a)*(1*Math.cos(c*r)+h*Math.sin(c*r)):(1+h*r)*Math.exp(-r*a),0===e||1===e?e:1-r}return t?u:function(){var t=Xr.springs[e];if(t)return t;for(var r=1/6,i=0,n=0;;)if(1===u(i+=r)){if(++n>=16)break}else n=0;var s=i*r*1e3;return Xr.springs[e]=s,s}}function ri(e){return void 0===e&&(e=10),function(t){return Math.ceil(Kr(t,1e-6,1)*e)*(1/e)}}var ii,ni,si=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function r(e,t){return 3*t-6*e}function i(e){return 3*e}function n(e,n,s){return((t(n,s)*e+r(n,s))*e+i(n))*e}function s(e,n,s){return 3*t(n,s)*e*e+2*r(n,s)*e+i(n)}return function(t,r,i,o){if(0<=t&&t<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(t!==r||i!==o)for(var l=0;l<11;++l)a[l]=n(l*e,t,i);return function(e){return t===r&&i===o||0===e||1===e?e:n(c(e),r,o)}}function c(r){for(var o=0,l=1;10!==l&&a[l]<=r;++l)o+=e;--l;var c=o+(r-a[l])/(a[l+1]-a[l])*e,h=s(c,t,i);return h>=.001?function(e,t,r,i){for(var o=0;o<4;++o){var a=s(t,r,i);if(0===a)return t;t-=(n(t,r,i)-e)/a}return t}(r,c,t,i):0===h?c:function(e,t,r,i,s){var o,a,l=0;do{(o=n(a=t+(r-t)/2,i,s)-e)>0?r=a:t=a}while(Math.abs(o)>1e-7&&++l<10);return a}(r,o,o+e,t,i)}}}(),oi=(ii={linear:function(){return function(e){return e}}},ni={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,r=4;e<((t=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var r=Kr(e,1,10),i=Kr(t,.1,2);return function(e){return 0===e||1===e?e:-r*Math.pow(2,10*(e-1))*Math.sin((e-1-i/(2*Math.PI)*Math.asin(1/r))*(2*Math.PI)/i)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(e,t){ni[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ni).forEach((function(e){var t=ni[e];ii["easeIn"+e]=t,ii["easeOut"+e]=function(e,r){return function(i){return 1-t(e,r)(1-i)}},ii["easeInOut"+e]=function(e,r){return function(i){return i<.5?t(e,r)(2*i)/2:1-t(e,r)(-2*i+2)/2}}})),ii);function ai(e,t){if($r.fnc(e))return e;var r=e.split("(")[0],i=oi[r],n=ei(e);switch(r){case"spring":return ti(e,t);case"cubicBezier":return Zr(si,n);case"steps":return Zr(ri,n);default:return Zr(i,n)}}function li(e){try{return document.querySelectorAll(e)}catch(e){return}}function ci(e,t){for(var r=e.length,i=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(0==o)t=r=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,u=2*a-h;t=c(u,h,s+1/3),r=c(u,h,s),i=c(u,h,s-1/3)}return"rgba("+255*t+","+255*r+","+255*i+","+l+")"}(e):void 0;var t,r}function vi(e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(t)return t[1]}function yi(e,t){return $r.fnc(e)?e(t.target,t.id,t.total):e}function Ai(e,t){return e.getAttribute(t)}function wi(e,t,r){if(di([r,"deg","rad","turn"],vi(t)))return t;var i=Xr.CSS[t+r];if(!$r.und(i))return i;var n=document.createElement(e.tagName),s=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;s.appendChild(n),n.style.position="absolute",n.style.width=100+r;var o=100/n.offsetWidth;s.removeChild(n);var a=o*parseFloat(t);return Xr.CSS[t+r]=a,a}function xi(e,t,r){if(t in e.style){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=e.style[t]||getComputedStyle(e).getPropertyValue(i)||"0";return r?wi(e,n,r):n}}function bi(e,t){return $r.dom(e)&&!$r.inp(e)&&(Ai(e,t)||$r.svg(e)&&e[t])?"attribute":$r.dom(e)&&di(Wr,t)?"transform":$r.dom(e)&&"transform"!==t&&xi(e,t)?"css":null!=e[t]?"object":void 0}function Si(e){if($r.dom(e)){for(var t,r=e.style.transform||"",i=/(\w+)\(([^)]*)\)/g,n=new Map;t=i.exec(r);)n.set(t[1],t[2]);return n}}function Ei(e,t,r,i){var n=qr(t,"scale")?1:0+function(e){return qr(e,"translate")||"perspective"===e?"px":qr(e,"rotate")||qr(e,"skew")?"deg":void 0}(t),s=Si(e).get(t)||n;return r&&(r.transforms.list.set(t,s),r.transforms.last=t),i?wi(e,s,i):s}function Ci(e,t,r,i){switch(bi(e,t)){case"transform":return Ei(e,t,i,r);case"css":return xi(e,t,r);case"attribute":return Ai(e,t);default:return e[t]||0}}function Ti(e,t){var r=/^(\*=|\+=|-=)/.exec(e);if(!r)return e;var i=vi(e)||0,n=parseFloat(t),s=parseFloat(e.replace(r[0],""));switch(r[0][0]){case"+":return n+s+i;case"-":return n-s+i;case"*":return n*s+i}}function Oi(e,t){if($r.col(e))return gi(e);if(/\s/g.test(e))return e;var r=vi(e),i=r?e.substr(0,e.length-r.length):e;return t?i+t:i}function Di(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Mi(e){for(var t,r=e.points,i=0,n=0;n0&&(i+=Di(t,s)),t=s}return i}function _i(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*Ai(e,"r")}(e);case"rect":return function(e){return 2*Ai(e,"width")+2*Ai(e,"height")}(e);case"line":return function(e){return Di({x:Ai(e,"x1"),y:Ai(e,"y1")},{x:Ai(e,"x2"),y:Ai(e,"y2")})}(e);case"polyline":return Mi(e);case"polygon":return function(e){var t=e.points;return Mi(e)+Di(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Ni(e,t){var r=t||{},i=r.el||function(e){for(var t=e.parentNode;$r.svg(t)&&$r.svg(t.parentNode);)t=t.parentNode;return t}(e),n=i.getBoundingClientRect(),s=Ai(i,"viewBox"),o=n.width,a=n.height,l=r.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function Li(e,t){function r(r){void 0===r&&(r=0);var i=t+r>=1?t+r:0;return e.el.getPointAtLength(i)}var i=Ni(e.el,e.svg),n=r(),s=r(-1),o=r(1);switch(e.property){case"x":return(n.x-i.x)*i.w;case"y":return(n.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}function Bi(e,t){var r=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,i=Oi($r.pth(e)?e.totalLength:e,t)+"";return{original:i,numbers:i.match(r)?i.match(r).map(Number):[0],strings:$r.str(e)||t?i.split(r):[]}}function Ii(e){return ci(e?hi($r.arr(e)?e.map(ui):ui(e)):[],(function(e,t,r){return r.indexOf(e)===t}))}function Pi(e){var t=Ii(e);return t.map((function(e,r){return{target:e,id:r,total:t.length,transforms:{list:Si(e)}}}))}function Ri(e,t){var r=pi(t);if(/^spring/.test(r.easing)&&(r.duration=ti(r.easing)),$r.arr(e)){var i=e.length;2===i&&!$r.obj(e[0])?e={value:e}:$r.fnc(t.duration)||(r.duration=t.duration/i)}var n=$r.arr(e)?e:[e];return n.map((function(e,r){var i=$r.obj(e)&&!$r.pth(e)?e:{value:e};return $r.und(i.delay)&&(i.delay=r?0:t.delay),$r.und(i.endDelay)&&(i.endDelay=r===n.length-1?t.endDelay:0),i})).map((function(e){return mi(e,r)}))}function Fi(e,t){var r=[],i=t.keyframes;for(var n in i&&(t=mi(function(e){for(var t=ci(hi(e.map((function(e){return Object.keys(e)}))),(function(e){return $r.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),r={},i=function(i){var n=t[i];r[n]=e.map((function(e){var t={};for(var r in e)$r.key(r)?r==n&&(t.value=e[r]):t[r]=e[r];return t}))},n=0;n-1&&(Ji.splice(s,1),r=Ji.length)}else n.tick(t);i++}e()}else Hi=cancelAnimationFrame(Hi)}return e}();function Wi(e){void 0===e&&(e={});var t,r=0,i=0,n=0,s=0,o=null;function a(e){var t=window.Promise&&new Promise((function(e){return o=e}));return e.finished=t,t}var l=function(e){var t=fi(Qr,e),r=fi(Yr,e),i=Fi(r,e),n=Pi(e.targets),s=Gi(n,i),o=ji(s,r),a=Vi;return Vi++,mi(t,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(e);a(l);function c(){var e=l.direction;"alternate"!==e&&(l.direction="normal"!==e?"normal":"reverse"),l.reversed=!l.reversed,t.forEach((function(e){return e.reversed=l.reversed}))}function h(e){return l.reversed?l.duration-e:e}function u(){r=0,i=h(l.currentTime)*(1/Wi.speed)}function d(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){var t=0,r=l.animations,i=r.length;for(!0===l.reversePlayback&&!1===l.rewind&&(e=l.duration-e);t2||(y=Math.round(y*p)/p)),f.push(y)}var x=d.length;if(x){g=d[0];for(var b=0;b0&&(l.began=!0,f("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,f("loopBegin")),v<=m&&0!==l.currentTime&&p(0),(v>=g&&l.currentTime!==u||!u)&&p(u),v>m&&v=u&&(i=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(r=n,f("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&c()):(l.paused=!0,l.completed||(l.completed=!0,f("loopComplete"),f("complete"),!l.passThrough&&"Promise"in window&&(o(),a(l)))))}return l.reset=function(){var e=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed="reverse"===e,l.remaining=l.loop,t=l.children;for(var r=s=t.length;r--;)l.children[r].reset();(l.reversed&&!0!==l.loop||"alternate"===e&&1===l.loop)&&l.remaining++,p(l.reversed?l.duration:0)},l.set=function(e,t){return ki(e,t),l},l.tick=function(e){n=e,r||(r=n),m((n+(i-r))*Wi.speed)},l.seek=function(e){m(h(e))},l.pause=function(){l.paused=!0,u()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ji.push(l),u(),Hi||Yi())},l.reverse=function(){c(),l.completed=!l.reversed,u()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function Xi(e,t){for(var r=t.length;r--;)di(e,t[r].animatable.target)&&t.splice(r,1)}"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){document.hidden?(Ji.forEach((function(e){return e.pause()})),Qi=Ji.slice(0),Wi.running=Ji=[]):Qi.forEach((function(e){return e.play()}))})),Wi.version="3.2.0",Wi.speed=1,Wi.running=Ji,Wi.remove=function(e){for(var t=Ii(e),r=Ji.length;r--;){var i=Ji[r],n=i.animations,s=i.children;Xi(t,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;Xi(t,l),l.length||a.children.length||s.splice(o,1)}n.length||s.length||i.pause()}},Wi.get=Ci,Wi.set=ki,Wi.convertPx=wi,Wi.path=function(e,t){var r=$r.str(e)?li(e)[0]:e,i=t||100;return function(e){return{property:e,el:r,svg:Ni(r),totalLength:_i(r)*(i/100)}}},Wi.setDashoffset=function(e){var t=_i(e);return e.setAttribute("stroke-dasharray",t),t},Wi.stagger=function(e,t){void 0===t&&(t={});var r=t.direction||"normal",i=t.easing?ai(t.easing):null,n=t.grid,s=t.axis,o=t.from||0,a="first"===o,l="center"===o,c="last"===o,h=$r.arr(e),u=h?parseFloat(e[0]):parseFloat(e),d=h?parseFloat(e[1]):0,p=vi(h?e[1]:e)||0,f=t.start||0+(h?u:0),m=[],g=0;return function(e,t,v){if(a&&(o=0),l&&(o=(v-1)/2),c&&(o=v-1),!m.length){for(var y=0;y-1&&Ji.splice(n,1);for(var a=0;at.id===e.id));null==i||i.copy(e)}pushMaterialLayer(e){if(0===this.i.states.length||!1===Ze(this.i.object))return;const t=this.i.object;if(t.material instanceof Array){const r=t.selectedMaterial;if(void 0!==r)for(let t=0,i=this.i.states.length;t{i.load(e,t,void 0,r)}))}_loadScript(e){return new Promise(((t,r)=>{const i=document.createElement("script");i.onload=t,i.onerror=r,i.src=this.encoderPath+e,document.head.appendChild(i)}))}preload(){return this._initEncoder().then((()=>this))}_initEncoder(){if(this.encoderPending)return this.encoderPending;const e="object"!=typeof WebAssembly||"js"===this.encoderConfig.type,t=[];return e?t.push(this._loadScript("draco_encoder.js")):(t.push(this._loadScript("draco_encoder_wrapper.js")),t.push(this._loadLibrary("draco_encoder.wasm","arraybuffer"))),this.encoderPending=Promise.all(t).then((t=>{e||(this.encoderConfig.wasmBinary=t[1])})),this.encoderPending}async parse(e,t={decodeSpeed:5,encodeSpeed:5,encoderMethod:qi.MESH_EDGEBREAKER_ENCODING,quantization:[16,8,8,8,8],exportUvs:!0,exportNormals:!0,exportColor:!1}){if(!0===e.isBufferGeometry)throw new Error("DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.");if(await this._initEncoder(),void 0===DracoEncoderModule)throw new Error("THREE.DRACOExporter: required the draco_encoder to work.");const r=e.geometry,i=await DracoEncoderModule(this.encoderConfig),n=new i.Encoder;let s,o;const a={};if(!0!==r.isBufferGeometry)throw new Error("THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.");if(!0===e.isMesh){s=new i.MeshBuilder,o=new i.Mesh;const e=r.getAttribute("position");a.POSITION=s.AddFloatAttributeToMesh(o,i.POSITION,e.count,e.itemSize,e.array);const n=r.getIndex();if(null!==n)s.AddFacesToMesh(o,n.count/3,n.array);else{const t=new(e.count>65535?Uint32Array:Uint16Array)(e.count);for(let e=0;e0&&(this.options.trs=!0),await this.processInput(e);const i=this;Promise.all(this.pending).then((function(){const e=i.buffers,r=i.json,n=i.options,s=i.extensionsUsed,o=new Blob(e,{type:"application/octet-stream"}),a=Object.keys(s);if(a.length>0&&(r.extensionsUsed=a),r.buffers&&r.buffers.length>0&&(r.buffers[0].byteLength=o.size),!0===n.binary){const e=new window.FileReader;e.readAsArrayBuffer(o),e.onloadend=function(){const i=En(e.result),n=new DataView(new ArrayBuffer(8));n.setUint32(0,i.byteLength,!0),n.setUint32(4,5130562,!0);const s=En(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;const t=new Uint8Array(new ArrayBuffer(e.length));for(let r=0,i=e.length;r255?32:i}return t.buffer}(JSON.stringify(r)),32),o=new DataView(new ArrayBuffer(8));o.setUint32(0,s.byteLength,!0),o.setUint32(4,1313821514,!0);const a=new ArrayBuffer(12),l=new DataView(a);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0);const c=12+o.byteLength+s.byteLength+n.byteLength+i.byteLength;l.setUint32(8,c,!0);const h=new Blob([a,o,s,n,i],{type:"application/octet-stream"}),u=new window.FileReader;u.readAsArrayBuffer(h),u.onloadend=function(){t(u.result)}}}else if(r.buffers&&r.buffers.length>0){const e=new window.FileReader;e.readAsDataURL(o),e.onloadend=function(){const i=e.result;r.buffers[0].uri=i,t(r)}}else t(r)}))}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,i=this.extensionsUsed;try{const n=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&n.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in n.gltfExtensions)t.extensions[e]=n.gltfExtensions[e],i[e]=!0;delete n.gltfExtensions}Object.keys(n).length>0&&(t.extras=n)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new t.Vector3;for(let t=0,i=e.count;t5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const r=this.cache;if(r.attributesNormalized.has(e))return r.attributesNormalized.get(e);const i=e.clone(),n=new t.Vector3;for(let e=0,t=i.count;e4?i=e.array[n*e.itemSize+r]:0===r?i=e.getX(n):1===r?i=e.getY(n):2===r?i=e.getZ(n):3===r&&(i=e.getW(n)),t===an?l.setFloat32(c,i,!0):t===ln?l.setUint32(c,i,!0):t===on?l.setUint16(c,i,!0):t===sn&&l.setUint8(c,i),c+=o}const h={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:a};void 0!==n&&(h.target=n),n===cn&&(h.byteStride=e.itemSize*o),this.byteOffset+=a,s.bufferViews.push(h);return{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(i){const n=new window.FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){const e=En(n.result),s={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,i(r.bufferViews.push(s)-1)}}))}processAccessor(e,t,r,i){const n=this.options,s=this.json;let o;if(e.array.constructor===Float32Array)o=an;else if(e.array.constructor===Uint32Array)o=ln;else if(e.array.constructor===Uint16Array)o=on;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");o=sn}if(void 0===r&&(r=0),void 0===i&&(i=e.count),n.truncateDrawRange&&void 0!==t&&null===t.index){const n=r+i,s=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;r=Math.max(r,t.drawRange.start),(i=Math.min(n,s)-r)<0&&(i=0)}if(0===i)return null;const a=function(e,t,r){const i={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let n=t;n4?r=e.array[n*e.itemSize+t]:0===t?r=e.getX(n):1===t?r=e.getY(n):2===t?r=e.getZ(n):3===t&&(r=e.getW(n)),i.min[t]=Math.min(i.min[t],r),i.max[t]=Math.max(i.max[t],r)}return i}(e,r,i),l={componentType:o,count:i,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]};if(!this.options.draco){let n;void 0!==t&&(n=e===t.index?hn:cn);const s=this.processBufferView(e,o,r,i,n);l.bufferView=s.id,l.byteOffset=s.byteOffset}return!0===e.normalized&&(l.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(l)-1}processImage(e,r,i){const n=this,s=n.cache,o=n.json,a=n.options,l=n.pending;s.images.has(e)||s.images.set(e,{});const c=s.images.get(e),h=r===t.RGBAFormat?"image/png":"image/jpeg",u=h+":flipY/"+i.toString();if(void 0!==c[u])return c[u];o.images||(o.images=[]);const d={mimeType:h};if(a.embedImages){const s=Cn=Cn||document.createElement("canvas");s.width=Math.min(e.width,a.maxTextureSize),s.height=Math.min(e.height,a.maxTextureSize);const o=s.getContext("2d");if(!0===i&&(o.translate(0,s.height),o.scale(1,-1)),"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)o.drawImage(e,0,0,s.width,s.height);else{r!==t.RGBAFormat&&r!==t.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const i=new Uint8ClampedArray(e.height*e.width*4);if(r===t.RGBAFormat)for(let t=0;t1&&(t.multiplyScalar(1/r),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),r>0&&(n.emissiveFactor=t.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(t,e.emissiveMap),n.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap)};e.normalScale&&-1!==e.normalScale.x&&(e.normalScale.x!==e.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),n.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:1};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),n.occlusionTexture=t}e.transparent?n.alphaMode="BLEND":e.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===t.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)}));const o=i.materials.push(n)-1;return r.materials.set(e,o),o}async processMesh(e){const r=this.cache,i=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,r=e.material.length;t0){const t=[],i=[],n={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)n[e.morphTargetDictionary[t]]=t;for(let s=0;s0&&(l.extras={},l.extras.targetNames=i)}const m=Array.isArray(e.material);if(m&&0===o.groups.length)return null;const g=m?e.material:[e.material],v=m?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,t=v.length;e0&&(t.targets=u),null!==o.index){let i=this.getUID(o.index);void 0===v[e].start&&void 0===v[e].count||(i+=":"+v[e].start+":"+v[e].count),r.attributes.has(i)?t.indices=r.attributes.get(i):(t.indices=this.processAccessor(o.index,o,v[e].start,v[e].count),r.attributes.set(i,t.indices)),null===t.indices&&delete t.indices}const i=this.processMaterial(g[v[e].materialIndex]);null!==i&&(t.material=i),h.push(t)}if(l.primitives=h,this.options.draco){const t=await this.dracoExporter.parse(e);this.processBuffer(t.buffer);const r={buffer:0,byteOffset:this.byteOffset,byteLength:t.buffer.length};this.byteOffset+=r.byteLength,i.bufferViews||(i.bufferViews=[]),i.bufferViews.push(r),h.forEach((e=>{e.extensions||(e.extensions={}),e.extensions.KHR_draco_mesh_compression={bufferView:i.bufferViews.length-1,attributes:t.attributeIDs}})),i.extensionsRequired||(i.extensionsRequired=[]),i.extensionsRequired.includes("KHR_draco_mesh_compression")||i.extensionsRequired.push("KHR_draco_mesh_compression"),this.extensionsUsed.KHR_draco_mesh_compression=!0}i.meshes||(i.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,l)}));const y=i.meshes.push(l)-1;return r.meshes.set(s,y),y}processCamera(e){const r=this.json;r.cameras||(r.cameras=[]);const i=e.isOrthographicCamera,n={type:i?"orthographic":"perspective"};return i?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:t.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),r.cameras.push(n)-1}processAnimation(e,r){const i=this.json,n=this.nodeMap;i.animations||(i.animations=[]);const s=(e=Zi.Utils.mergeMorphTargetTracks(e.clone(),r)).tracks,o=[],a=[];for(let e=0;e0){const t=[];for(let i=0,n=e.children.length;i0&&(n.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,n)}));const s=t.nodes.push(n)-1;return i.set(e,s),s}async processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};""!==e.name&&(i.name=e.name),t.scenes.push(i);const n=[];for(let t=0,i=e.children.length;t0&&(i.nodes=n),this.serializeUserData(e,i)}async processObjects(e){const r=new t.Scene;r.name="AuxScene";for(let t=0;t0&&await this.processObjects(i);for(let e=0;e0&&(s.range=e.distance)):e.isSpotLight&&(s.type="spot",e.distance>0&&(s.range=e.distance),s.spot={},s.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,s.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),n[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},n[this.name]=!0);const o=i.extensions[this.name].lights;o.push(s),t.extensions=t.extensions||{},t.extensions[this.name]={light:o.length-1}}}class Dn{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class Mn{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;const r=this.writer,i=r.extensionsUsed,n={};t.pbrMetallicRoughness.baseColorFactor&&(n.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);const s=[1,1,1];if(e.specular.toArray(s,0),n.specularFactor=s,n.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(n.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){const t={index:r.processTexture(e.specularMap)};r.applyTextureTransform(t,e.specularMap),n.specularGlossinessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=n,i[this.name]=!0}}Zi.Utils={insertKeyframe:function(e,t){const r=.001,i=e.getValueSize(),n=new e.TimeBufferType(e.times.length+1),s=new e.ValueBufferType(e.values.length+i),o=e.createInterpolant(new e.ValueBufferType(i));let a;if(0===e.times.length){n[0]=t;for(let e=0;ee.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)t){n.set(e.times.slice(0,l+1),0),n[l+1]=t,n.set(e.times.slice(l+1),l+2),s.set(e.values.slice(0,(l+1)*i),0),s.set(o.evaluate(t),(l+1)*i),s.set(e.values.slice((l+1)*i),(l+2)*i),a=l+1;break}}return e.times=n,e.values=s,a},mergeMorphTargetTracks:function(e,r){const i=[],n={},s=e.tracks;for(let e=0;e{var n,s,o,a,l;for(let e=0,l=i.length;e{var i,n,s;const o=e.layersList;if(void 0===t.backLayer){const i=r.getValues();i.alpha=0,t.backLayer=o.addLayerBeforeAt(i,t),t.backLayer.isBack=!0,e.dispose()}const a=`f${t.id}_alpha`,l=`f${null===(i=t.backLayer)||void 0===i?void 0:i.id}_alpha`,c=t.uniforms[a],h=null===(n=t.backLayer)||void 0===n?void 0:n.uniforms[l];null===(s=this._animation)||void 0===s||s.add({targets:c,value:0},0).add({targets:h,value:r.uniforms[`f${r.id}_alpha`].value},0)},this._interpolateMaterialTexture=(e,t,r)=>{var i;const n=`f${t.id}_texture`,s=t.uniforms[n].value,o=r.uniforms[`f${r.id}_texture`].value,a=t.uniforms[`f${t.id}_crop`],l=r.uniforms[`f${r.id}_crop`];a&&l&&a.value!==l.value&&(a.value=Number(l.value)),s.wrapS===o.wrapS&&s.wrapT===o.wrapT||(s.wrapS=o.wrapS,s.wrapT=o.wrapT,s.needsUpdate=!0);const c=s.matrix,h=o.matrix;if(!1===c.equals(h)){const e={repeatX:s.repeat.x,repeatY:s.repeat.y,offsetX:s.offset.x,offsetY:s.offset.y};null===(i=this._animation)||void 0===i||i.add({targets:e,repeatX:o.repeat.x,repeatY:o.repeat.y,offsetX:o.offset.x,offsetY:o.offset.y,update:()=>{s.repeat.set(e.repeatX,e.repeatY),s.offset.set(e.offsetX,e.offsetY),s.updateMatrix(),s.needsUpdate=!0}},0)}const u=["alpha","mode"];"displace_map"===t.type&&u.push("intensity"),this._interpolateMaterialBetweenValues(e,t,r,u)},this._interpolateMaterialGradient=(e,t,r)=>{var i;const n=t.uniforms[`f${t.id}_num`],s=r.uniforms[`f${r.id}_num`],o=`f${t.id}_steps`,a=`f${r.id}_steps`,l=t.uniforms[o],c=r.uniforms[a],h=`f${t.id}_colors`,u=`f${r.id}_colors`,d=t.uniforms[h],p=r.uniforms[u];if(n.value<=s.value){const e=d.value[n.value-1];for(let t=Number(n.value);t{l.value[e]=n.value}},0)}}}else{const e=[];for(let t=0;t{var s;null===(s=this._animation)||void 0===s||s.add({targets:[n,r],value:c.value[t],x:i.x,y:i.y,z:i.z,w:i.w,update:()=>{l.value[t]=n.value},complete:()=>{e(t)}},0)})))}}const t=p.value[s.value-1];for(let r=Number(s.value);r{var n;const s={value:l.value[r]};null===(n=this._animation)||void 0===n||n.add({targets:[s,i],value:1,x:t.x,y:t.y,z:t.z,w:t.w,update:()=>{l.value[r]=s.value},complete:()=>{e(r)}},0)})))}Promise.all(e).then((()=>{n.value=Number(s.value)}),(()=>{}))}this._interpolateMaterialBetweenValues(e,t,r,["alpha","mode","gl_type","smooth","offset","morph","angle"])},this.statesManager=new Ki(this)}computeCache(){return this.cache={mouseDown:this.events.find((e=>e.type===jr.MOUSE_DOWN)),mouseUp:this.events.find((e=>e.type===jr.MOUSE_UP)),mouseHover:this.events.find((e=>e.type===jr.MOUSE_HOVER)),start:this.events.find((e=>e.type===jr.START)),lookAt:this.events.find((e=>e.type===jr.LOOK_AT)),follow:this.events.find((e=>e.type===jr.FOLLOW)),keyDown:this.events.filter((e=>e.type===jr.KEY_DOWN)),keyUp:this.events.filter((e=>e.type===jr.KEY_UP))},this.cache}newState(e){const t=new Jr;return t.name=e,t.update(this.object),this.selectedState=this.states.length,this.states.push(t),t}addState(e,t){this.states.splice(t,0,e)}removeState(e){this.selectedState===e&&(this.selectedState=void 0),this.states.splice(e,1)}selectState(e){void 0!==e&&this.states[e].execute(this.object),this.selectedState=e}hasEventType(e,t){return e===jr.KEY_DOWN||e===jr.KEY_UP?void 0!==t&&this.events.some((r=>r.type===e&&r.key===t)):this.events.some((t=>t.type===e))}newEvent(){const e=[jr.MOUSE_DOWN,jr.MOUSE_UP,jr.MOUSE_HOVER,jr.KEY_DOWN].find((e=>!1===this.hasEventType(e))),t=new Hr(e);return this.events.push(t),t}addEvent(e,t){this.events.splice(t,0,e);const r=this.events[t].targets;for(let e=0,t=r.length;e0){t.states=[];for(let r=0,i=this.states.length;r0){t.events=[];for(let e=0,r=this.events.length;e1?(this.states[0].execute(this.object),this._currentState=this.states[0],this._prevState=void 0):void 0!==this._state0?this._state0.execute(this.object):this.events.some((e=>e.type===jr.LOOK_AT||e.type===jr.FOLLOW))&&(this._state0=new Jr,this._state0.update(this.object))}end(){var e;void 0!==this._animation&&(this._animation.pause(),this._animation=void 0,this._removeBackLayer()),this.states.length>1?this.states[null!==(e=this.selectedState)&&void 0!==e?e:0].execute(this.object):void 0!==this._state0&&(this._state0.execute(this.object),this._state0=void 0),this._currentState=void 0,this._prevState=void 0}lookAt(e){var t;this.object.lookAt(e),null===(t=this._animation)||void 0===t||t.finished.then((()=>{this.lookAt(e)}))}follow(e){this.object.position.copy(e),null!==this.object.parent&&this.object.position.applyMatrix4((new t.Matrix4).copy(this.object.parent.matrixWorld).invert()),this.object.position.applyMatrix4((new t.Matrix4).copy(this.object.hiddenMatrix).invert())}play(e){this.object.visible&&void 0!==e.state&&this.animate(e.state,e)}reverse(e){this.object.visible&&void 0!==this._prevState&&this.animate(this._prevState,e)}_removeBackLayer(){if("material"in this.object){const e=this.object.material;if(e instanceof Array)for(let t=0,r=e.length;t{this._removeBackLayer(),this._animation=void 0})),this.animateMatrix(e),this.animateGeometry(e),this.animateMaterial(e),this.animateCamera(e)}animateMatrix(e){var r,i,n,s;if(!1===this.object.position.equals(e.position)){const t=this.object.position.clone(),i={t:0};null===(r=this._animation)||void 0===r||r.add({targets:i,t:1,update:()=>{this.object.position.lerpVectors(t,e.position,i.t)}},0)}if(!1===this.object.scale.equals(e.scale)){const t=this.object.scale.clone(),r={t:0};null===(i=this._animation)||void 0===i||i.add({targets:r,t:1,update:()=>{this.object.scale.lerpVectors(t,e.scale,r.t)}},0)}if(!1===this.object.rotation.equals(e.rotation)){const r=this.object.quaternion.clone(),i={t:0},s={x:this.object.rotation.x-e.rotation.x,y:this.object.rotation.y-e.rotation.y,z:this.object.rotation.z-e.rotation.z},o=e.rotation.clone(),a=.01*t.MathUtils.DEG2RAD,l=359.99*t.MathUtils.DEG2RAD;s.x===2*Math.PI?0===o.x?o.x=a:o.x===2*Math.PI&&(o.x=l):s.x===2*-Math.PI&&(0===o.x?o.x=-a:o.x===2*Math.PI&&(o.x=-l)),s.y===2*Math.PI?0===o.y?o.y=a:o.y===2*Math.PI&&(o.y=l):s.y===2*-Math.PI&&(0===o.y?o.y=-a:o.y===2*Math.PI&&(o.y=-l)),s.z===2*Math.PI?0===o.z?o.z=a:o.z===2*Math.PI&&(o.z=l):s.z===2*-Math.PI&&(0===o.z?o.z=-a:o.z===2*Math.PI&&(o.z=-l));const c=(new t.Quaternion).setFromEuler(o);null===(n=this._animation)||void 0===n||n.add({targets:i,t:1,update:()=>{!function(e,t,r,i){if(0===i)return r.copy(e);if(1===i)return r.copy(t);const n=e.w*t.w+e.x*t.x+e.y*t.y+e.z*t.z;if(n>=1)return r.copy(e);const s=1-n*n;if(s<=Number.EPSILON){const n=1-i;return r.w=n*e.w+i*t.w,r.x=n*e.x+i*t.x,r.y=n*e.y+i*t.y,r.z=n*e.z+i*t.z,r.normalize(),r}const o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-i)*a)/o,c=Math.sin(i*a)/o;r.w=e.w*l+t.w*c,r.x=e.x*l+t.x*c,r.y=e.y*l+t.y*c,r.z=e.z*l+t.z*c}(r,c,this.object.quaternion,i.t)}},0)}const o=new t.Vector3,a=new t.Quaternion,l=new t.Vector3;if(e.hiddenMatrix.decompose(o,a,l),"hiddenMatrix"in this.object){const r=new t.Vector3,i=new t.Quaternion,n=new t.Vector3;if(this.object.hiddenMatrix.decompose(r,i,n),!1===this.object.hiddenMatrix.equals(e.hiddenMatrix)){const e=new t.Vector3,c=new t.Quaternion,h=new t.Vector3,u={t:0},d=this.object.hiddenMatrix;null===(s=this._animation)||void 0===s||s.add({targets:u,t:1,update:()=>{c.slerpQuaternions(i,a,u.t),e.lerpVectors(r,o,u.t),h.lerpVectors(n,l,u.t),d.compose(e,c,h)}},0)}}}animateGeometry(e){var t;if("geometry"in this.object&&void 0!==e.geometry){const r=this.object.geometry.userData.parameters,i=e.geometry;if(i.width!==r.width||i.height!==r.height||i.depth!==r.depth){const e=this.object;null===(t=this._animation)||void 0===t||t.add({targets:r,width:i.width,height:i.height,depth:i.depth,update:()=>{e.updateGeometry({parameters:{width:r.width,height:r.height,depth:r.depth}})}},0)}}}animateMaterial(e){if("material"in this.object)if(this.object.material instanceof Array)for(let t=0,r=this.object.material.length;t{r.updateProjectionMatrix()}},0))}}}const Rn=e=>class extends e{hasEntityChild(){return this.children.some((e=>qe(e)))}attach(e,r){this.updateWorldMatrix(!0,!1);const i=(new t.Matrix4).copy(this.matrixWorld).invert();return null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),i.multiply(e.parent.matrixWorld)),qe(e)?e.hiddenMatrix.premultiply(i):e.applyMatrix4(i),e.updateWorldMatrix(!1,!1),this.add(e),void 0!==r&&(this.children.pop(),this.children.splice(r,0,e)),this}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.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,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.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0){n.children=[];for(const r of this.children)(qe(r)||r instanceof t.Light)&&n.children.push(r.toJSON(e).object)}if(r){const t=In(e.geometries),r=In(e.materials),n=In(e.textures),s=In(e.images),o=In(e.interactionStates),a=function(e){const t=[];for(const r in e)t.push(e[r]);return t}(e.nodes);t.length>0&&(i.geometries=t),r.length>0&&(i.materials=r),n.length>0&&(i.textures=n),s.length>0&&(i.images=s),o.length>0&&(i.interactionStates=o),a.length>0&&(i.nodes=a)}return i.object=n,i}fromJSON(e){return this.uuid=e.uuid,void 0!==e.name&&(this.name=e.name),void 0!==e.matrix?(this.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(this.matrixAutoUpdate=e.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(void 0!==e.position&&this.position.fromArray(e.position),void 0!==e.rotation&&this.rotation.fromArray(e.rotation),void 0!==e.quaternion&&this.quaternion.fromArray(e.quaternion),void 0!==e.scale&&this.scale.fromArray(e.scale)),this.castShadow=void 0!==e.castShadow,this.receiveShadow=void 0!==e.receiveShadow,void 0!==e.visible&&(this.visible=e.visible),void 0!==e.frustumCulled&&(this.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(this.renderOrder=e.renderOrder),void 0!==e.layers&&(this.layers.mask=e.layers),void 0!==e.userData&&(this.userData=e.userData),this}},Fn=e=>"isEntity"in e,Un=e=>"isAbstractMesh"in e,zn=e=>"objectHelper"in e,kn=e=>class extends(Rn(e)){constructor(){super(...arguments),this.objectType="",this.isEntity=!0,this.raycastLock=!1,this.scaleLock=!1,this.hiddenMatrix=new t.Matrix4,this.interaction=new Pn(this),this.forceComputeSize=!1}set visibility(e){this.visible=e;for(const t of this.children)Fn(t)&&t.traverseEntity((t=>{zn(t)&&t.visible&&(t.objectHelper.visible=e)}))}get visibility(){return this.visible}get interactionCache(){return void 0===this.interaction.cache&&this.interaction.computeCache(),this.interaction.cache}traverseEntity(e){e(this);for(const t of this.children)Fn(t)&&t.traverseEntity(e)}computeSingleBoundingBox(){this.singleBoundingBox||(this.singleBoundingBox=new st),this.singleBoundingBox.setFromObjectSize(this,!1),this.singleBoundingBox.computeVertices(),this.singleBoundingBox.computeEdges(),this.singleBoundingBox.computeFaces()}computeComplexBoundingBox(e){this.complexBoundingBox||(this.complexBoundingBox=new st),this.complexBoundingBox.setFromObjectSize(this,e),this.complexBoundingBox.computeVertices(),this.complexBoundingBox.computeEdges(),this.complexBoundingBox.computeFaces()}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);for(const t of this.children)t.updateMatrixWorld(e)}updateWorldMatrix(e,t){const r=this.parent;if(e&&null!==r&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),t)for(const e of this.children)e.updateWorldMatrix(!1,!0)}shallowClone(e){return(new this.constructor).shallowCopy(this,e)}shallowCopy(e,t=!0){if(super.copy(e,!1),this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),void 0!==e.interaction&&this.interaction.copy(e.interaction),!0===t)for(const t of e.children)Fn(t)&&this.add(t.shallowClone());return this}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(super.copy(e,!1),this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),void 0!==e.interaction&&this.interaction.copy(e.interaction),!0===t)for(const t of e.children)Fn(t)&&this.add(t.clone());return this}keepChildrenMatrixWorld(){const e=new t.Matrix4,r=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),e.copy(this.matrixWorld).invert(),e.multiply(r);for(const t of this.children)Fn(t)&&t.hiddenMatrix.premultiply(e)}toJSON(e){const t=super.toJSON(e),r=t.object;return!0===this.raycastLock&&(r.raycastLock=!0),!0===this.scaleLock&&(r.scaleLock=!0),r.hiddenMatrix=this.hiddenMatrix.toArray(),void 0!==this.interaction&&(r.interaction=this.interaction.toJSON(e)),t}fromJSON(e){return super.fromJSON(e),void 0!==e.raycastLock&&(this.raycastLock=e.raycastLock),void 0!==e.scaleLock&&(this.scaleLock=e.scaleLock),this.hiddenMatrix.fromArray(e.hiddenMatrix),this}fromObject3D(e){const r=e.children;return e.children=[],Object.assign(e,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new t.Matrix4}),this.copy(e),e.children=r,this}};class Gn extends t.Object3D{constructor(e,r={}){super(),this.object=e,e.computeComplexBoundingBox(!0);const i=e.complexBoundingBox.getSize(new t.Vector3),n=.1;this.parameters={type:void 0!==r.type?r.type:"radial",hideBase:void 0!==r.hideBase&&r.hideBase,count:void 0!==r.count?r.count:3,ra_radius:void 0!==r.ra_radius?r.ra_radius:2*Math.max(i.x,i.y),ra_startAngle:void 0!==r.ra_startAngle?r.ra_startAngle:0,ra_endAngle:void 0!==r.ra_endAngle?r.ra_endAngle:360,ra_align:void 0!==r.ra_align&&r.ra_align,ra_axis:void 0!==r.ra_axis?r.ra_axis:"y",ra_scale:void 0!==r.ra_scale?r.ra_scale.clone():new t.Vector3,ra_rotation:void 0!==r.ra_rotation?r.ra_rotation.clone():new t.Euler,ra_position:void 0!==r.ra_position?r.ra_position.clone():new t.Vector3,li_scale:void 0!==r.li_scale?r.li_scale.clone():new t.Vector3,li_rotation:void 0!==r.li_rotation?r.li_rotation.clone():new t.Euler,li_position:void 0!==r.li_position?r.li_position.clone():new t.Vector3(i.x+i.x*n,0,0).round(),gr_count:void 0!==r.gr_count?r.gr_count.clone():new t.Vector3(2,2,2),gr_size:void 0!==r.gr_size?r.gr_size.clone():new t.Vector3(i.x+i.x*n,i.y+i.y*n,i.z+i.z*n).round(),gr_fromCenter:void 0===r.gr_fromCenter||r.gr_fromCenter},this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(const e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(const e of this.object.material)e.visible=!0;if(e){const e=this.object.material.map((e=>e.clone()));for(const t of this.children)t.material=e}else for(const e of this.children)e.material=this.object.material}for(const t of this.object.material)t.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){const e=this.object.material.clone();for(const t of this.children)t.material=e}else for(const e of this.children)e.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}}_updateCount(){const e="grid"===this.parameters.type?this.parameters.gr_count.x*this.parameters.gr_count.y*this.parameters.gr_count.z:this.parameters.count;if(this.children.length!==e)if(this.children.length{t=Math.abs(t),r=Math.abs(r),i=Math.abs(i);const n=e.userData.parameters;let s,o,a;0===t?(t=n.width,s=1):s=t/n.width,0===r?(r=n.height,o=1):o=r/n.height,0===i?(i=n.depth,a=1):a=i/n.depth,e.scale(s,o,a),n.width=t,n.height=r,n.depth=i})(this.geometry,{width:e,height:t,depth:r})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){const t="NonParametric"===this.objectType?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,r=Ke(t),i=Array.isArray(this.material)?this.material.map((e=>e.clone())):this.material.clone();return new this.constructor(r,i).copy(this,e)}copy(e,t=!0){return super.copy(e,t),e.cloner&&(this.cloner=new Gn(e,e.cloner.parameters),this.add(this.cloner)),this}toJSON(e){const t=super.toJSON(e),r=t.object;if(void 0!==this.cloner&&(r.cloner=this.cloner.toJSON()),r.geometry=function(e,t,r){if(void 0===e[t.uuid])if("SubdivGeometry"===t.userData.type&&_n&&0===(t=Be.create({geometry:t.clone()})).userData.parameters.subdivisions&&(delete t.attributes.color,delete t.attributes.faceMap),"NonParametricGeometry"===t.userData.type||"SubdivGeometry"===t.userData.type){const r=t.originalGeometry;if(void 0!==r){const e=t.userData;(t=r).userData=e}e[t.uuid]=t.toJSON()}else{let r=t.userData;if("VectorGeometry"===r.type){const e=t.userData.shape;r=Object.assign({},r,{shape:e.toJSON()})}e[t.uuid]={uuid:t.uuid,userData:r}}return t.uuid}(e.geometries,this.geometry,this.material),Array.isArray(this.material)){const t=[];for(let r=0,i=this.material.length;r{var r;return(r=class extends e{constructor(){super(...arguments),this.isObjectHelper=!0}}).geometryHelper=new t.BoxBufferGeometry(30,30,30),r},Hn=new t.Ray,Jn=new t.Sphere,Qn=new t.Matrix4,Yn=(e,r,i,n)=>{const s=r,o=e.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),Jn.copy(s.boundingSphere),Jn.applyMatrix4(o),!1===i.ray.intersectsSphere(Jn))return;if(Qn.copy(o).invert(),Hn.copy(i.ray).applyMatrix4(Qn),null!==s.boundingBox&&!1===Hn.intersectsBox(s.boundingBox))return;let a,l,c,h;const u=s.index,d=s.attributes.position,p=s.drawRange;let f,m;for(f=Math.max(0,p.start),m=Math.min(u.count,p.start+p.count);fr.far?null:{faceIndex:1,distance:p,point:d.clone(),object:e}}};class Wn extends(Vn(t.CameraHelper)){constructor(e){super(e),this.object=e;const r=new t.SphereGeometry(15,4,2),i=new t.MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),n=new t.Mesh(r,i);this.add(n),this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}raycast(e,t){Yn(this.object,Wn.geometryHelper,e,t)}}class Xn extends(Vn(t.DirectionalLightHelper)){constructor(e,t=15,r=10066329){super(e,t,r),this.object=e,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){Yn(this.object,Xn.geometryHelper,e,t)}}class Kn extends(Vn(t.AxesHelper)){constructor(e,t=15){super(t),this.object=e,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,t){Yn(this.object,Kn.geometryHelper,e,t)}update(){}}class qn extends(Vn(t.PointLightHelper)){constructor(e,t=15,r=6710886){super(e,t,r),this.object=e,this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){Yn(this.object,qn.geometryHelper,e,t)}}class Zn extends(Vn(t.SpotLightHelper)){constructor(e,t=6710886){super(e,t),this.object=e,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){Yn(this.object,Zn.geometryHelper,e,t)}update(){if(void 0!==this.object){const e=Zn._vector,t=this.object.distance?this.object.distance:1e3,r=t*Math.tan(this.object.angle);this.cone.scale.set(r,r,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);const i=void 0!==this.color?this.color:this.light.color;if(this.cone.material instanceof Array)for(let e=0,t=this.cone.material.length;e{if(this.geometry instanceof se){if(this.geometry.updateFromShape()){const e=this.geometry.drawCount,t=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(t.parameters,{surfaceMaxCount:e+1e3})}))}}else this.updateGeometry({});this.computeSingleBoundingBox(),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()},this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,null===(i=this.shape.eventDispatcher)||void 0===i||i.addEventListener("update",this._onShapeUpdate)}toJSON(e){const t=super.toJSON(e);return t.object.objectType="VectorObject",t}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){const e=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:e})}}setShape(e){var t,r;this.shape&&(null===(t=this.shape.eventDispatcher)||void 0===t||t.removeEventListener("update",this._onShapeUpdate)),this.shape=e,null===(r=this.shape.eventDispatcher)||void 0===r||r.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),rs.getNormalMatrix(this.matrixWorld),es.copy($n).applyMatrix3(rs).normalize(),ts.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(es,ts)}clone(e){const t=this.shape.clone(),r=this.material.clone(),i=this.geometry.userData,n=ce.create(Object.assign({},i,{shape:t})),s=new is(n,r).copy(this,e);return s.shape=t,t.update(),s}raycast(e,t){jn.prototype.raycast.call(this,e,t)}}new t.TextureLoader,new t.Vector2,new t.Vector2,new t.Vector2,new t.LineBasicMaterial({linewidth:1,depthTest:!0,depthWrite:!1,side:t.FrontSide,transparent:!1,vertexColors:!0}),new t.MeshBasicMaterial({opacity:.2,transparent:!0,vertexColors:!0,side:t.DoubleSide}),new t.PointsMaterial({size:3,color:new t.Color("hsl(0, 0%, 70%)"),sizeAttenuation:!1});const ns=(e,t)=>class extends e{constructor(){super(...arguments),this.objectHelper=new t(this),this.enableHelper=!1}set visibility(e){this.visible=e,this.setHelperVisibility(e),this.setHelperChildrenVisibility(e)}get visibility(){return this.visible}get geometryHelper(){return t.geometryHelper}setHelperVisibility(e){this.objectHelper.visible=e}setHelperChildrenVisibility(e){for(const t of this.children)Fn(t)&&t.traverseEntity((t=>{zn(t)&&t.visible&&(t.objectHelper.visible=e)}))}raycast(e,t){this.objectHelper.raycast(e,t)}copy(e,t=!0){return super.copy(e,t),void 0!==e.enableHelper&&(this.enableHelper=e.enableHelper),void 0!==e.objectHelper&&(this.objectHelper.visible=e.objectHelper.visible),this}toJSON(e){const t=super.toJSON(e);return t.object.enableHelper=this.enableHelper,t}fromJSON(e){return super.fromJSON(e),void 0!==e.enableHelper&&(this.enableHelper=!0),this}};class ss extends(ns(kn(t.Camera),Wn)){constructor(e=100,r=100,i=45,n=50,s=5e4){super(),this.objectType="CombinedCamera",this.width=window.innerWidth,this.height=window.innerHeight,this.orthoCamera=new t.OrthographicCamera(-.5*e,.5*e,.5*r,-.5*r,n,s),this.perspCamera=new t.PerspectiveCamera(i,e/r,n,s),this._cameraType="OrthographicCamera",this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.targetOffset=1e3,this.toOrthographic(!0)}setDefault(){this.name="Default Camera",this.isEntity=!1,this.enableHelper=!1,this.objectHelper.visible=!1}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set cameraType(e){"PerspectiveCamera"===e?this.toPerspective():"OrthographicCamera"===e&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(e){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}getTarget(e){const r=this.getWorldDirection(new t.Vector3).multiplyScalar(this.targetOffset);return e.copy(this.position).add(r),e}getViewFrontToObject(e){const r=e.getWorldPosition(new t.Vector3),i=e.getWorldDirection(new t.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().add(i),target:r}}getViewToObject(e){const r=e.getWorldPosition(new t.Vector3),i=this.getWorldDirection(new t.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().sub(i),target:r}}setViewplaneSize(e,t){this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t,this.aspect=e/t,this.updateProjectionMatrix()}toOrthographic(e){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",!0!==this.enableHelper&&!0!==e||this.objectHelper.update()}toPerspective(e){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",!0!==this.enableHelper&&!0!==e||this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,r,i,n,s){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(e,t,r,i,n,s):this.orthoCamera.setViewOffset(e,t,r,i,n,s)}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){"PerspectiveCamera"===this._cameraType?this.toPerspective(e):"OrthographicCamera"===this._cameraType&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}raycast(e,t){this.enableHelper&&this.objectHelper.visible&&this.objectHelper.raycast(e,t)}copy(e,t){return super.copy(e,t),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=null===e.view?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){const t={near:this.orthoCamera.near,far:this.orthoCamera.far},r={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.isEntity=!0,this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=t.near,this.orthoCamera.far=t.far,this.perspCamera.near=r.near,this.perspCamera.far=r.far,this.updateProjectionMatrix(),this}toJSON(e){const t=super.toJSON(e),r=t.object;return r.objectType="CombinedCamera",r.cameraType=this.cameraType,r.targetOffset=this.targetOffset,r.left=this.left,r.right=this.right,r.top=this.top,r.bottom=this.bottom,null!==this.view&&(r.view=Object.assign({},this.view)),r.zoomOrtho=this.orthoCamera.zoom,r.nearOrtho=this.orthoCamera.near,r.far=this.far,r.aspect=this.aspect,r.fov=this.fov,r.focus=this.focus,r.filmGauge=this.filmGauge,r.filmOffset=this.filmOffset,r.zoomPersp=this.perspCamera.zoom,r.nearPersp=this.perspCamera.near,t}fromJSON(e){return super.fromJSON(e),this.cameraType=e.cameraType,void 0!==e.targetOffset&&(this.targetOffset=e.targetOffset),void 0!==e.left&&(this.left=e.left),void 0!==e.right&&(this.right=e.right),void 0!==e.top&&(this.top=e.top),void 0!==e.bottom&&(this.bottom=e.bottom),void 0!==e.view&&(this.view=Object.assign({},e.view)),void 0!==e.zoomOrtho&&(this.orthoCamera.zoom=e.zoomOrtho),void 0!==e.nearOrtho&&(this.orthoCamera.near=e.nearOrtho),void 0!==e.far&&(this.far=e.far),void 0!==e.aspect&&(this.aspect=e.aspect),void 0!==e.fov&&(this.fov=e.fov),void 0!==e.focus&&(this.focus=e.focus),void 0!==e.filmGauge&&(this.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(this.filmOffset=e.filmOffset),void 0!==e.zoomPersp&&(this.perspCamera.zoom=e.zoomPersp),void 0!==e.nearPersp&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}}class os extends(ns(kn(t.Group),Kn)){constructor(){super(...arguments),this.objectType="EmptyObject"}toJSON(e){const t=super.toJSON(e);return t.object.objectType="EmptyObject",t}}class as extends(ns(kn(t.DirectionalLight),Xn)){constructor(...e){super(...e),this.objectType="LightDirectional",this._gizmos={},this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;const r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=1,r.far=2500;const i=new t.CameraHelper(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}get gizmos(){return this._gizmos}showGizmos(){for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.CameraHelper&&(r.visible=!0)}}hideGizmos(){for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.CameraHelper&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.CameraHelper&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),!0===this.enableHelper&&!0===this.objectHelper.visible&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e),r=t.object;return r.objectType="LightDirectional",r.color=this.color.getHex(),r.intensity=this.intensity,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var t;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=null!==(t=e.shadow.normalBias)&&void 0!==t?t:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);const r=this.shadow.camera,i=e.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.left=i.left,r.right=i.right,r.top=i.top,r.bottom=i.bottom,void 0!==i.view&&(r.view=Object.assign({},i.view)),this}}class ls extends(ns(kn(t.PointLight),qn)){constructor(...e){super(...e),this.objectType="LightPoint",this._gizmos={},this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;const r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;const i=new t.Vector3(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),n=new t.Vector3(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z),s=new t.Box3(i,n),o=new t.Box3Helper(s,new t.Color(16755200));o.visible=!1,this._gizmos.shadowmap=o,this.update()}get gizmos(){return this._gizmos}showGizmos(){for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.Box3Helper&&(r.visible=!0)}}hideGizmos(){for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.Box3Helper&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(const e in this._gizmos){const r=this._gizmos[e];if(r instanceof t.Box3Helper){const e=this.shadow.camera,i=new t.Vector3(-e.far+this.position.x,-e.far+this.position.y,-e.far+this.position.z),n=new t.Vector3(e.far+this.position.x,e.far+this.position.y,e.far+this.position.z);r.box.set(i,n),r.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),!0===this.enableHelper&&!0===this.objectHelper.visible&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e),r=t.object;return r.objectType="LightPoint",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.decay=this.decay,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var t;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=null!==(t=e.shadow.normalBias)&&void 0!==t?t:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);const r=this.shadow.camera,i=e.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.fov=i.fov,r.focus=i.focus,r.aspect=i.aspect,r.filmGauge=i.filmGauge,r.filmOffset=i.filmOffset,void 0!==i.view&&(r.view=Object.assign({},i.view)),this}}const cs=new t.Vector3,hs=new t.Vector3,us=new t.Quaternion;class ds extends(ns(kn(t.SpotLight),Zn)){constructor(...e){super(...e),this.objectType="LightSpot",this._gizmos={},this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;const r=this.shadow.camera;r.fov=2*t.MathUtils.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;const i=new t.CameraHelper(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}get gizmos(){return this._gizmos}showGizmos(){for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.CameraHelper&&(r.visible=!0)}}hideGizmos(){for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.CameraHelper&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(const e in this._gizmos){const r=this._gizmos[e];r instanceof t.CameraHelper&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),hs.setFromMatrixPosition(this.matrixWorld),us.setFromRotationMatrix(this.matrixWorld),cs.copy(this.up).applyQuaternion(us).negate().multiplyScalar(this.distance),this.target.position.copy(hs).add(cs),this.target.updateMatrixWorld(),!0===this.enableHelper&&!0===this.objectHelper.visible&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e),r=t.object;return r.objectType="LightSpot",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.angle=this.angle,r.decay=this.decay,r.penumbra=this.penumbra,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var t;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=null!==(t=e.shadow.normalBias)&&void 0!==t?t:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);const r=this.shadow.camera,i=e.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.fov=i.fov,r.focus=i.focus,r.aspect=i.aspect,r.filmGauge=i.filmGauge,r.filmOffset=i.filmOffset,void 0!==i.view&&(r.view=Object.assign({},i.view)),this}}const ps=e=>"VIDEO"===e.tagName;class fs{static resize(e,t,r){const i=e/t;let n;if(!r.image)return;const s=r.image;n=ps(s)?s.videoWidth/s.videoHeight:s.width/s.height,i>n&&("WEBCAM"==r.imageType?r.repeat.set(-1,1*n/i):r.repeat.set(1,1*n/i)),in?{x:1,y:n/i}:is&&("WEBCAM"==r.imageType?r.repeat.set(1/e*-1,1/t*s/n):r.repeat.set(1/e,1/t*s/n)),ns&&("WEBCAM"==r.imageType?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseDownEvent()},this._onMouseUp=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseUpEvent()},this._onMouseMove=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent()},this._onTouchStart=e=>{1===e.touches.length&&(e.preventDefault(),this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseDownEvent(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())},this._onTouchEnd=()=>{this._handleMouseUpEvent(),this._handleMouseHoverEvent(!0)},this._onTouchMove=e=>{1===e.touches.length&&(e.preventDefault(),e.stopPropagation(),this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())},this._onKeyDown=e=>{this._handleKeyDownEvent(e.key)},this._onKeyUp=e=>{this._handleKeyUpEvent(e.key)},this._domElement=e,this._scene=i,this._camera=n}activate(){this.isEnable=!0,this._scene.traverseEntity((e=>{if(void 0!==e.interaction){e.interaction.start();for(const t of e.interaction.events){const r=t.type;this._enableEvent[r]=!0,r!==jr.KEY_DOWN&&r!==jr.KEY_UP&&r!==jr.START&&r!==jr.LOOK_AT&&r!==jr.FOLLOW||(void 0===this._map[r]&&(this._map[r]=[]),this._map[r].push(e))}}})),void 0!==this._enableEvent[jr.START]&&this._handleStartEvent(),void 0!==this._enableEvent[jr.MOUSE_DOWN]&&(this._domElement.addEventListener("pointerdown",this._onMouseDown,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1)),void 0!==this._enableEvent[jr.MOUSE_UP]&&(this._domElement.addEventListener("pointerup",this._onMouseUp,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1)),void 0===this._enableEvent[jr.MOUSE_HOVER]&&void 0===this._enableEvent[jr.LOOK_AT]&&void 0===this._enableEvent[jr.FOLLOW]||(this._domElement.addEventListener("pointermove",this._onMouseMove,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1),this._domElement.addEventListener("touchmove",this._onTouchMove,!1)),void 0!==this._enableEvent[jr.KEY_DOWN]&&document.addEventListener("keydown",this._onKeyDown,!1),void 0!==this._enableEvent[jr.KEY_UP]&&document.addEventListener("keyup",this._onKeyUp,!1)}deactivate(){this._scene.traverseEntity((e=>{void 0!==e.interaction&&e.interaction.end(),e.interaction.cache=void 0})),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._enableEvent={},this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity((e=>{e.interaction.start()})),this._handleStartEvent()}_getPointer(e,t){const r=this._domElement.getBoundingClientRect();return{x:(e-r.left)/r.width*2-1,y:-(t-r.top)/r.height*2+1}}_handleStartEvent(){var e;null===(e=this._map[jr.START])||void 0===e||e.forEach((e=>{var t;null===(t=e.interactionCache.start)||void 0===t||t.dispatch()}))}_handleMouseDownEvent(){var e;const t=this._raycastMesh(this._raycaster);for(let r=0,i=t.length;r{var t;e instanceof os&&(null===(t=e.interactionCache.mouseDown)||void 0===t||t.dispatch())})),!i.interactionCache.follow)break}}_handleMouseUpEvent(){var e;const t=this._raycastMesh(this._raycaster);for(let r=0,i=t.length;r{var t;e instanceof os&&(null===(t=e.interactionCache.mouseUp)||void 0===t||t.dispatch())})),!i.interactionCache.follow)break}}_handleMouseHoverEvent(e=!1){var t,r;if(void 0!==this._enableEvent[jr.MOUSE_HOVER]){let i;if(!e){const e=this._raycastMesh(this._raycaster).find((e=>!e.object.interactionCache.follow));i=e?e.object:void 0}if(this._prevObject!==i){void 0!==this._prevObject&&(null===(t=this._prevObject.interactionCache.mouseHover)||void 0===t||t.dispatchReverse()),void 0!==i&&(null===(r=i.interactionCache.mouseHover)||void 0===r||r.dispatch());const e=[];null==i||i.traverseAncestors((t=>{t instanceof os&&t.interactionCache.mouseHover&&e.push(t)})),this._prevAncestors.filter((t=>{var r;return!e.includes(t)&&(null===(r=t.interactionCache.mouseHover)||void 0===r||r.dispatchReverse(),!0)}));const n=e.filter((e=>{var t;return!this._prevAncestors.includes(e)&&(null===(t=e.interactionCache.mouseHover)||void 0===t||t.dispatch(),!0)})),s=this._prevAncestors.filter((t=>e.includes(t)));this._prevAncestors=[...s,...n]}this._prevObject=i}}_handleLookAtEvent(){var e;null===(e=this._map[jr.LOOK_AT])||void 0===e||e.forEach((e=>{var t;const r=null===(t=e.interactionCache.lookAt)||void 0===t?void 0:t.distance;void 0!==r&&(this._plane.set(this._normal,-r),this._raycaster.ray.intersectPlane(this._plane,this._intersection),e.interaction.lookAt(this._intersection))}))}_handleFollowEvent(){var e;null===(e=this._map[jr.FOLLOW])||void 0===e||e.forEach((e=>{this._plane.setFromNormalAndCoplanarPoint(this._normal,e.getWorldPosition(this._position)),this._raycaster.ray.intersectPlane(this._plane,this._intersection),e.interaction.follow(this._intersection)}))}_handleKeyDownEvent(e){var t;null===(t=this._map[jr.KEY_DOWN])||void 0===t||t.forEach((t=>{var r;const i=null===(r=t.interactionCache.keyDown)||void 0===r?void 0:r.find((t=>t.key===e));null==i||i.dispatch()}))}_handleKeyUpEvent(e){var t;null===(t=this._map[jr.KEY_UP])||void 0===t||t.forEach((t=>{var r;const i=null===(r=t.interactionCache.keyUp)||void 0===r?void 0:r.find((t=>t.key===e));null==i||i.dispatch()}))}_raycastMesh(e){const t=[],r=i=>{for(const n of i.children)Fn(n)&&!n.raycastLock&&n.visible&&(Un(n)&&e.intersectObject(n,!1,t),r(n))};return r(this._scene),t}} +/** + * postprocessing v6.22.3 build Sat Jul 31 2021 + * https://github.com/vanruesc/postprocessing + * Copyright 2021 Raoul van Rüschen + * @license Zlib + */var As=0,ws=1,xs="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",bs=class extends t.ShaderMaterial{constructor(e=!1,r=!1){super({type:"BokehMaterial",defines:{PASS:e?"2":"1"},uniforms:{kernel64:new t.Uniform(null),kernel16:new t.Uniform(null),inputBuffer:new t.Uniform(null),cocBuffer:new t.Uniform(null),texelSize:new t.Uniform(new t.Vector2),scale:new t.Uniform(1)},fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;\n#if PASS == 1\nuniform vec4 kernel64[32];\n#else\nuniform vec4 kernel16[8];\n#endif\nvarying vec2 vUv;void main(){\n#ifdef FOREGROUND\nvec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale;\n#else\nfloat CoC=texture2D(cocBuffer,vUv).g*scale;\n#endif\nif(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{\n#ifdef FOREGROUND\nvec2 step=texelSize*max(CoC,CoCNearFar.g*scale);\n#else\nvec2 step=texelSize*CoC;\n#endif\n#if PASS == 1\nvec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;\n#else\nvec4 maxValue=texture2D(inputBuffer,vUv);for(int i=0;i<8;++i){vec4 kernel=kernel16[i];vec2 uv=step*kernel.xy+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);uv=step*kernel.zw+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);}gl_FragColor=maxValue;\n#endif\n}}",vertexShader:xs,blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,r&&(this.defines.FOREGROUND="1"),this.generateKernel()}generateKernel(){const e=new Float32Array(128),r=new Float32Array(32);let i=0,n=0;for(let t=0;t<80;++t){const s=2.39996323*t,o=Math.sqrt(t)/Math.sqrt(80),a=o*Math.cos(s),l=o*Math.sin(s);t%5==0?(r[n++]=a,r[n++]=l):(e[i++]=a,e[i++]=l)}const s=[],o=[];for(let r=0;r<128;)s.push(new t.Vector4(e[r++],e[r++],e[r++],e[r++]));for(let e=0;e<32;)o.push(new t.Vector4(r[e++],r[e++],r[e++],r[e++]));this.uniforms.kernel64.value=s,this.uniforms.kernel16.value=o}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}},Ss=class extends t.ShaderMaterial{constructor(e){super({type:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new t.Uniform(null),focusDistance:new t.Uniform(0),focalLength:new t.Uniform(0),cameraNear:new t.Uniform(.3),cameraFar:new t.Uniform(1e3)},fragmentShader:"#include \n#include \n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float focusDistance;uniform float focalLength;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}void main(){float depth=readDepth(vUv);\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar);\n#else\nfloat linearDepth=depth;\n#endif\nfloat signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focalLength,abs(signedDistance));gl_FragColor.rg=vec2(step(signedDistance,0.0)*magnitude,step(0.0,signedDistance)*magnitude);}",vertexShader:xs,blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.adoptCameraSettings(e)}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}adoptCameraSettings(e=null){null!==e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof t.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},Es=class extends t.ShaderMaterial{constructor(e=new t.Vector2){super({type:"ConvolutionMaterial",uniforms:{inputBuffer:new t.Uniform(null),texelSize:new t.Uniform(new t.Vector2),halfTexelSize:new t.Uniform(new t.Vector2),kernel:new t.Uniform(0),scale:new t.Uniform(1)},fragmentShader:"#include \n#include \n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include \n}",vertexShader:"uniform vec2 texelSize;uniform vec2 halfTexelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize*vec2(kernel)+halfTexelSize)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.setTexelSize(e.x,e.y),this.kernelSize=Ts.LARGE}getKernel(){return Cs[this.kernelSize]}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}},Cs=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],Ts={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},Os=class extends t.ShaderMaterial{constructor(){super({type:"CopyMaterial",uniforms:{inputBuffer:new t.Uniform(null),opacity:new t.Uniform(1)},fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include \n}",vertexShader:xs,blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1}},Ds=class extends t.ShaderMaterial{constructor(e=new t.Vector2,r=Ms.COLOR){super({type:"EdgeDetectionMaterial",defines:{LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new t.Uniform(null),depthBuffer:new t.Uniform(null),predicationBuffer:new t.Uniform(null),texelSize:new t.Uniform(e)},fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include \n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=linearToRelativeLuminance(texture2D(inputBuffer,vUv).rgb);float lLeft=linearToRelativeLuminance(texture2D(inputBuffer,vUv0).rgb);float lTop=linearToRelativeLuminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=linearToRelativeLuminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=linearToRelativeLuminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=linearToRelativeLuminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=linearToRelativeLuminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}",blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.setEdgeDetectionMode(r)}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setEdgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}setLocalContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}setEdgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}setPredicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}setPredicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}setPredicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}},Ms={DEPTH:0,LUMA:1,COLOR:2},_s=1,Ns=class extends t.ShaderMaterial{constructor(e=null,r=null,i=null,n,s=!1){super({type:"EffectMaterial",defines:{DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new t.Uniform(null),depthBuffer:new t.Uniform(null),resolution:new t.Uniform(new t.Vector2),texelSize:new t.Uniform(new t.Vector2),cameraNear:new t.Uniform(.3),cameraFar:new t.Uniform(1e3),aspect:new t.Uniform(1),time:new t.Uniform(0)},blending:t.NoBlending,depthWrite:!1,depthTest:!1,dithering:s}),this.toneMapped=!1,null!==e&&this.setShaderParts(e),null!==r&&this.setDefines(r),null!==i&&this.setUniforms(i),this.adoptCameraSettings(n)}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setShaderParts(e){return this.fragmentShader="#include \n#include \n#include \n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include \n#endif\n#include \n}".replace(Ls.FRAGMENT_HEAD,e.get(Ls.FRAGMENT_HEAD)).replace(Ls.FRAGMENT_MAIN_UV,e.get(Ls.FRAGMENT_MAIN_UV)).replace(Ls.FRAGMENT_MAIN_IMAGE,e.get(Ls.FRAGMENT_MAIN_IMAGE)),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}".replace(Ls.VERTEX_HEAD,e.get(Ls.VERTEX_HEAD)).replace(Ls.VERTEX_MAIN_SUPPORT,e.get(Ls.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(e){for(const t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(const t of e.entries())this.uniforms[t[0]]=t[1];return this}adoptCameraSettings(e=null){null!==e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof t.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const r=Math.max(e,1),i=Math.max(t,1);this.uniforms.resolution.value.set(r,i),this.uniforms.texelSize.value.set(1/r,1/i),this.uniforms.aspect.value=r/i}},Ls={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},Bs=class extends t.ShaderMaterial{constructor(e=!1,r=null){const i=null!==r;super({type:"LuminanceMaterial",uniforms:{inputBuffer:new t.Uniform(null),threshold:new t.Uniform(0),smoothing:new t.Uniform(1),range:new t.Uniform(i?r:new t.Vector2)},fragmentShader:"#include \n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=linearToRelativeLuminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:xs,blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.colorOutput=e,this.useThreshold=!0,this.useRange=i}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.uniforms.threshold.value=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.uniforms.smoothing.value=e}get useThreshold(){return void 0!==this.defines.THRESHOLD}set useThreshold(e){e?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.needsUpdate=!0}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return void 0!==this.defines.RANGE}set useRange(e){e?this.defines.RANGE="1":delete this.defines.RANGE,this.needsUpdate=!0}get luminanceRange(){return this.useRange}set luminanceRange(e){this.useRange=e}setLuminanceRangeEnabled(e){this.useRange=e}},Is=class extends t.ShaderMaterial{constructor(e=null){super({type:"MaskMaterial",uniforms:{maskTexture:new t.Uniform(e),inputBuffer:new t.Uniform(null),strength:new t.Uniform(1)},fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef MASK_PRECISION_HIGH\nuniform mediump sampler2D maskTexture;\n#else\nuniform lowp sampler2D maskTexture;\n#endif\n#if MASK_FUNCTION != 0\nuniform float strength;\n#endif\nvarying vec2 vUv;void main(){\n#if COLOR_CHANNEL == 0\nfloat mask=texture2D(maskTexture,vUv).r;\n#elif COLOR_CHANNEL == 1\nfloat mask=texture2D(maskTexture,vUv).g;\n#elif COLOR_CHANNEL == 2\nfloat mask=texture2D(maskTexture,vUv).b;\n#else\nfloat mask=texture2D(maskTexture,vUv).a;\n#endif\n#if MASK_FUNCTION == 0\n#ifdef INVERTED\nmask=step(mask,0.0);\n#else\nmask=1.0-step(mask,0.0);\n#endif\n#else\nmask=clamp(mask*strength,0.0,1.0);\n#ifdef INVERTED\nmask=1.0-mask;\n#endif\n#endif\n#if MASK_FUNCTION == 2\ngl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);\n#else\ngl_FragColor=mask*texture2D(inputBuffer,vUv);\n#endif\n}",vertexShader:xs,blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.colorChannel=As,this.maskFunction=Ps.DISCARD}set maskTexture(e){this.uniforms.maskTexture.value=e,delete this.defines.MASK_PRECISION_HIGH,e.type!==t.UnsignedByteType&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}set colorChannel(e){this.defines.COLOR_CHANNEL=e.toFixed(0),this.needsUpdate=!0}set maskFunction(e){this.defines.MASK_FUNCTION=e.toFixed(0),this.needsUpdate=!0}get inverted(){return void 0!==this.defines.INVERTED}set inverted(e){this.inverted&&!e?delete this.defines.INVERTED:e&&(this.defines.INVERTED="1"),this.needsUpdate=!0}get strength(){return this.uniforms.strength.value}set strength(e){this.uniforms.strength.value=e}},Ps={DISCARD:0,MULTIPLY:1,MULTIPLY_RGB_SET_ALPHA:2},Rs=class extends t.ShaderMaterial{constructor(e=new t.Vector2,r=new t.Vector2){super({type:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new t.Uniform(null),areaTexture:new t.Uniform(null),searchTexture:new t.Uniform(null),texelSize:new t.Uniform(e),resolution:new t.Uniform(r)},fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;iend&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;iend&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}",blending:t.NoBlending,depthWrite:!1,depthTest:!1}),this.toneMapped=!1}setOrthogonalSearchSteps(e){const t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){const t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setCornerRounding(e){const t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}get cornerRounding(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerRounding(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}},Fs=new t.Camera,Us=null;var zs=class{constructor(e="Pass",r=new t.Scene,i=Fs){this.name=e,this.scene=r,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.getFullscreenMaterial();null!==t&&(t.needsUpdate=!0),this.rtt=!e}}getFullscreenMaterial(){return null!==this.screen?this.screen.material:null}setFullscreenMaterial(e){let r=this.screen;null!==r?r.material=e:(r=new t.Mesh(function(){if(null===Us){const e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),r=new Float32Array([0,0,2,0,0,2]);void 0!==(Us=new t.BufferGeometry).setAttribute?(Us.setAttribute("position",new t.BufferAttribute(e,3)),Us.setAttribute("uv",new t.BufferAttribute(r,2))):(Us.addAttribute("position",new t.BufferAttribute(e,3)),Us.addAttribute("uv",new t.BufferAttribute(r,2)))}return Us}(),e),r.frustumCulled=!1,null===this.scene&&(this.scene=new t.Scene),this.scene.add(r),this.screen=r)}getDepthTexture(){return null}setDepthTexture(e,t=0){}render(e,t,r,i,n){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,r){}dispose(){const e=this.getFullscreenMaterial();null!==e&&e.dispose();for(const e of Object.keys(this)){const r=this[e];if(null!==r&&"function"==typeof r.dispose){if(r instanceof t.Scene)continue;this[e].dispose()}}}},ks=-1,Gs=class{constructor(e,r=-1,i=-1,n=1){this.resizable=e,this.base=new t.Vector2(1,1),this.target=new t.Vector2(r,i),this.s=n}get scale(){return this.s}set scale(e){this.s=e,this.target.x=ks,this.target.y=ks,this.resizable.setSize(this.base.x,this.base.y)}get width(){const e=this.base,t=this.target;let r;return r=t.x!==ks?t.x:t.y!==ks?Math.round(t.y*(e.x/e.y)):Math.round(e.x*this.s),r}set width(e){this.target.x=e,this.resizable.setSize(this.base.x,this.base.y)}get height(){const e=this.base,t=this.target;let r;return r=t.y!==ks?t.y:t.x!==ks?Math.round(t.x/(e.x/e.y)):Math.round(e.y*this.s),r}set height(e){this.target.y=e,this.resizable.setSize(this.base.x,this.base.y)}static get AUTO_SIZE(){return ks}},js=class extends zs{constructor({resolutionScale:e=.5,width:r=Gs.AUTO_SIZE,height:i=Gs.AUTO_SIZE,kernelSize:n=Ts.LARGE}={}){super("BlurPass"),this.renderTargetA=new t.WebGLRenderTarget(1,1,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B",this.resolution=new Gs(this,r,i,e),this.convolutionMaterial=new Es,this.ditheredConvolutionMaterial=new Es,this.ditheredConvolutionMaterial.dithering=!0,this.dithering=!1,this.kernelSize=n}get width(){return this.resolution.width}set width(e){this.resolution.width=e}get height(){return this.resolution.height}set height(e){this.resolution.height=e}get scale(){return this.convolutionMaterial.uniforms.scale.value}set scale(e){this.convolutionMaterial.uniforms.scale.value=e,this.ditheredConvolutionMaterial.uniforms.scale.value=e}get kernelSize(){return this.convolutionMaterial.kernelSize}set kernelSize(e){this.convolutionMaterial.kernelSize=e,this.ditheredConvolutionMaterial.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,r,i,n){const s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB;let c=this.convolutionMaterial,h=c.uniforms;const u=c.getKernel();let d,p,f,m=t;for(this.setFullscreenMaterial(c),p=0,f=u.length-1;p=0;l?(Hs.copy(e.getClearColor(Hs)),e.setClearColor(s,c?o:a)):c&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(Hs,a):c&&e.setClearAlpha(a)}},Qs=!1,Ys=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let r;if(e.material.flatShading)switch(e.material.side){case t.DoubleSide:r=this.materialsFlatShadedDoubleSide;break;case t.BackSide:r=this.materialsFlatShadedBackSide;break;default:r=this.materialsFlatShaded}else switch(e.material.side){case t.DoubleSide:r=this.materialsDoubleSide;break;case t.BackSide:r=this.materialsBackSide;break;default:r=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=r[2]:e.isInstancedMesh?e.material=r[1]:e.material=r[0],++this.meshCount}}}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){const r=this.materials=[e.clone(),e.clone(),e.clone()];for(const i of r)i.uniforms=Object.assign({},e.uniforms),i.side=t.FrontSide;r[2].skinning=!0,this.materialsBackSide=r.map((r=>{const i=r.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=t.BackSide,i})),this.materialsDoubleSide=r.map((r=>{const i=r.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=t.DoubleSide,i})),this.materialsFlatShaded=r.map((t=>{const r=t.clone();return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r})),this.materialsFlatShadedBackSide=r.map((r=>{const i=r.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=t.BackSide,i})),this.materialsFlatShadedDoubleSide=r.map((r=>{const i=r.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=t.DoubleSide,i}))}}render(e,t,r){const i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,Qs){const i=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,r);for(const e of i)e[0].material=e[1];this.meshCount!==i.size&&i.clear()}else{const i=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,r),t.overrideMaterial=i}e.shadowMap.enabled=i}disposeMaterials(){if(null!==this.material){const e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return Qs}static set workaroundEnabled(e){Qs=e}},Ws=class extends zs{constructor(e,t,r=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new Js,this.overrideMaterialManager=null===r?null:new Ys(r)}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){const e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){const t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new Ys(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}render(e,t,r,i,n){const s=this.scene,o=this.camera,a=s.background,l=this.renderToScreen?null:t;this.clear&&(null!==this.clearPass.overrideClearColor&&(s.background=null),this.clearPass.render(e,t)),e.setRenderTarget(l),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,s,o):e.render(s,o),s.background!==a&&(s.background=a)}},Xs=class extends zs{constructor(e,r,{resolutionScale:i=1,width:n=Gs.AUTO_SIZE,height:s=Gs.AUTO_SIZE,renderTarget:o}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new Ws(e,r,new t.MeshDepthMaterial({depthPacking:t.RGBADepthPacking}));const a=this.renderPass.getClearPass();a.overrideClearColor=new t.Color(16777215),a.overrideClearAlpha=1,this.renderTarget=o,void 0===this.renderTarget&&(this.renderTarget=new t.WebGLRenderTarget(1,1,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target"),this.resolution=new Gs(this,n,s,i)}get texture(){return this.renderTarget.texture}getResolutionScale(){return this.resolutionScale}setResolutionScale(e){this.resolutionScale=e,this.setSize(this.resolution.base.x,this.resolution.base.y)}render(e,t,r,i,n){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s)}setSize(e,t){const r=this.resolution;r.base.set(e,t),this.renderTarget.setSize(r.width,r.height)}},Ks=0,qs=13,Zs=14,$s=16,eo=new Map([[Ks,null],[1,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}"],[2,"vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}"],[3,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}"],[4,"float blend(const in float x,const in float y){return(y==0.0)? y : max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[5,"float blend(const in float x,const in float y){return(y==1.0)? y : min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[6,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[7,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[8,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}"],[9,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[10,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[11,"float blend(const in float x,const in float y){return(y>0.0)? min(x/y,1.0): 1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[12,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}"],[qs,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}"],[Zs,"float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[15,"float blend(const in float x,const in float y){return(y==1.0)? y : min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[$s,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}"],[17,"float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[18,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}"]]),to=class extends t.EventDispatcher{constructor(e,r=1){super(),this.blendFunction=e,this.opacity=new t.Uniform(r)}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e,this.dispatchEvent({type:"change"})}getShaderCode(){return eo.get(this.blendFunction)}},ro=class extends t.EventDispatcher{constructor(e,t,{attributes:r=io.NONE,blendFunction:i=$s,defines:n=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}={}){super(),this.name=e,this.attributes=r,this.fragmentShader=t,this.vertexShader=a,this.defines=n,this.uniforms=s,this.extensions=o,this.blendMode=new to(i),this.blendMode.addEventListener("change",(e=>this.setChanged()))}setChanged(){this.dispatchEvent({type:"change"})}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setDepthTexture(e,t=0){}update(e,t,r){}setSize(e,t){}initialize(e,t,r){}dispose(){for(const e of Object.keys(this)){const r=this[e];if(null!==r&&"function"==typeof r.dispose){if(r instanceof t.Scene)continue;this[e].dispose()}}}},io={NONE:0,DEPTH:1,CONVOLUTION:2};function no(e,t){const r=[];let i;for(;null!==(i=e.exec(t));)r.push(i[1]);return r}function so(e,t,r){let i,n;for(const s of t){i="$1"+e+s.charAt(0).toUpperCase()+s.slice(1),n=new RegExp("([^\\.])(\\b"+s+"\\b)","g");for(const e of r.entries())null!==e[1]&&r.set(e[0],e[1].replace(n,i))}}function oo(e,t,r,i,n,s,o){const a=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,l=/(?:varying\s+\w+\s+(\w*))/g,c=t.blendMode,h=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),u=void 0!==h.get("fragment")&&/mainImage/.test(h.get("fragment")),d=void 0!==h.get("fragment")&&/mainUv/.test(h.get("fragment"));let p=[],f=[],m=!1,g=!1;if(void 0===h.get("fragment"))console.error("Missing fragment shader",t);else if(d&&0!=(o&io.CONVOLUTION))console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(u||d){if(d&&(r.set(Ls.FRAGMENT_MAIN_UV,r.get(Ls.FRAGMENT_MAIN_UV)+"\t"+e+"MainUv(UV);\n"),m=!0),null!==h.get("vertex")&&/mainSupport/.test(h.get("vertex"))){let t="\t"+e+"MainSupport(";/mainSupport *\([\w\s]*?uv\s*?\)/.test(h.get("vertex"))&&(t+="vUv"),t+=");\n",r.set(Ls.VERTEX_MAIN_SUPPORT,r.get(Ls.VERTEX_MAIN_SUPPORT)+t),p=p.concat(no(l,h.get("vertex"))),f=f.concat(p).concat(no(a,h.get("vertex")))}if(f=f.concat(no(a,h.get("fragment"))).concat(Array.from(t.defines.keys()).map((e=>e.replace(/\([\w\s,]*\)/g,"")))).concat(Array.from(t.uniforms.keys())),t.uniforms.forEach(((t,r)=>s.set(e+r.charAt(0).toUpperCase()+r.slice(1),t))),t.defines.forEach(((t,r)=>n.set(e+r.charAt(0).toUpperCase()+r.slice(1),t))),so(e,f,n),so(e,f,h),i.set(c.blendFunction,c),u){const t=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;let i=e+"MainImage(color0, UV, ";0!=(o&io.DEPTH)&&t.test(h.get("fragment"))&&(i+="depth, ",g=!0),i+="color1);\n\t";const n=e+"BlendOpacity";s.set(n,c.opacity),i+="color0 = blend"+c.getBlendFunction()+"(color0, color1, "+n+");\n\n\t",r.set(Ls.FRAGMENT_MAIN_IMAGE,r.get(Ls.FRAGMENT_MAIN_IMAGE)+i),r.set(Ls.FRAGMENT_HEAD,r.get(Ls.FRAGMENT_HEAD)+"uniform float "+n+";\n\n")}r.set(Ls.FRAGMENT_HEAD,r.get(Ls.FRAGMENT_HEAD)+h.get("fragment")+"\n"),null!==h.get("vertex")&&r.set(Ls.VERTEX_HEAD,r.get(Ls.VERTEX_HEAD)+h.get("vertex")+"\n")}else console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);return{varyings:p,transformedUv:m,readDepth:g}}var ao,lo,co,ho,uo=class extends zs{constructor(e,...t){super("EffectPass"),this.setFullscreenMaterial(new Ns(null,null,null,e)),this.effects=t.sort(((e,t)=>t.attributes-e.attributes)),this.skipRendering=!1,this.uniforms=0,this.varyings=0,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY}get encodeOutput(){return void 0!==this.getFullscreenMaterial().defines.ENCODE_OUTPUT}set encodeOutput(e){if(this.encodeOutput!==e){const t=this.getFullscreenMaterial();t.needsUpdate=!0,e?t.defines.ENCODE_OUTPUT="1":delete t.defines.ENCODE_OUTPUT}}get dithering(){return this.getFullscreenMaterial().dithering}set dithering(e){const t=this.getFullscreenMaterial();t.dithering!==e&&(t.dithering=e,t.needsUpdate=!0)}verifyResources(e){const t=e.capabilities;let r=Math.min(t.maxFragmentUniforms,t.maxVertexUniforms);this.uniforms>r&&console.warn("The current rendering context doesn't support more than "+r+" uniforms, but "+this.uniforms+" were defined"),r=t.maxVaryings,this.varyings>r&&console.warn("The current rendering context doesn't support more than "+r+" varyings, but "+this.varyings+" were defined")}updateMaterial(){const e=/\bblend\b/g,t=new Map([[Ls.FRAGMENT_HEAD,""],[Ls.FRAGMENT_MAIN_UV,""],[Ls.FRAGMENT_MAIN_IMAGE,""],[Ls.VERTEX_HEAD,""],[Ls.VERTEX_MAIN_SUPPORT,""]]),r=new Map,i=new Map,n=new Map,s=new Set;let o,a=0,l=0,c=0,h=!1,u=!1;for(const e of this.effects)if(e.blendMode.getBlendFunction()===Ks)c|=e.getAttributes()&io.DEPTH;else if(0!=(c&io.CONVOLUTION)&&0!=(e.getAttributes()&io.CONVOLUTION))console.error("Convolution effects cannot be merged",e);else if(c|=e.getAttributes(),o=oo("e"+a++,e,t,r,i,n,c),l+=o.varyings.length,h=h||o.transformedUv,u=u||o.readDepth,null!==e.extensions)for(const t of e.extensions)s.add(t);for(const i of r.values())t.set(Ls.FRAGMENT_HEAD,t.get(Ls.FRAGMENT_HEAD)+i.getShaderCode().replace(e,"blend"+i.getBlendFunction())+"\n");0!=(c&io.DEPTH)?(u&&t.set(Ls.FRAGMENT_MAIN_IMAGE,"float depth = readDepth(UV);\n\n\t"+t.get(Ls.FRAGMENT_MAIN_IMAGE)),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,h?(t.set(Ls.FRAGMENT_MAIN_UV,"vec2 transformedUv = vUv;\n"+t.get(Ls.FRAGMENT_MAIN_UV)),i.set("UV","transformedUv")):i.set("UV","vUv"),t.forEach(((e,t,r)=>r.set(t,e.trim().replace(/^#/,"\n#")))),this.uniforms=n.size,this.varyings=l,this.skipRendering=0===a,this.needsSwap=!this.skipRendering;const d=this.getFullscreenMaterial();if(d.setShaderParts(t).setDefines(i).setUniforms(n),d.extensions={},s.size>0)for(const e of s)d.extensions[e]=!0;this.needsUpdate=!1}recompile(e){this.updateMaterial(),void 0!==e&&this.verifyResources(e)}getDepthTexture(){return this.getFullscreenMaterial().uniforms.depthBuffer.value}setDepthTexture(e,r=t.BasicDepthPacking){const i=this.getFullscreenMaterial();i.uniforms.depthBuffer.value=e,i.depthPacking=r,i.needsUpdate=!0;for(const t of this.effects)t.setDepthTexture(e,r)}render(e,t,r,i,n){const s=this.getFullscreenMaterial(),o=s.uniforms.time.value+i;this.needsUpdate&&this.recompile(e);for(const r of this.effects)r.update(e,t,i);this.skipRendering&&!this.renderToScreen||(s.uniforms.inputBuffer.value=t.texture,s.uniforms.time.value=o<=this.maxTime?o:this.minTime,e.setRenderTarget(this.renderToScreen?null:r),e.render(this.scene,this.camera))}setSize(e,t){this.getFullscreenMaterial().setSize(e,t);for(const r of this.effects)r.setSize(e,t)}initialize(e,r,i){for(const t of this.effects)t.initialize(e,r,i),t.addEventListener("change",(e=>this.handleEvent(e)));if(this.updateMaterial(),this.verifyResources(e),void 0!==i&&i!==t.UnsignedByteType){this.getFullscreenMaterial().defines.FRAMEBUFFER_PRECISION_HIGH="1"}}dispose(){super.dispose();for(const e of this.effects)e.dispose()}handleEvent(e){switch(e.type){case"change":this.needsUpdate=!0}}},po=class extends zs{constructor({width:e=Gs.AUTO_SIZE,height:r=Gs.AUTO_SIZE,renderTarget:i,luminanceRange:n,colorOutput:s}={}){super("LuminancePass"),this.setFullscreenMaterial(new Bs(s,n)),this.needsSwap=!1,this.renderTarget=i,void 0===this.renderTarget&&(this.renderTarget=new t.WebGLRenderTarget(1,1,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:s?t.RGBAFormat:t.LuminanceFormat,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1),this.resolution=new Gs(this,e,r)}get texture(){return this.renderTarget.texture}render(e,t,r,i,n){this.getFullscreenMaterial().uniforms.inputBuffer.value=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const r=this.resolution;r.base.set(e,t),this.renderTarget.setSize(r.width,r.height)}initialize(e,r,i){if(void 0!==i&&i!==t.UnsignedByteType){this.getFullscreenMaterial().defines.FRAMEBUFFER_PRECISION_HIGH="1"}}},fo=class extends zs{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new Js(!1,!1,!0),this.inverse=!1}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}render(e,t,r,i,n){const s=e.getContext(),o=e.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,h=this.inverse?0:1,u=1-h;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,h,4294967295),o.stencil.setClear(u),o.stencil.setLocked(!0),this.clear&&(this.renderToScreen?c.render(e,null):(c.render(e,t),c.render(e,r))),this.renderToScreen?(e.setRenderTarget(null),e.render(a,l)):(e.setRenderTarget(t),e.render(a,l),e.setRenderTarget(r),e.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}},mo=class extends zs{constructor(e,t="inputBuffer"){super("ShaderPass"),this.setFullscreenMaterial(e),this.uniform=null,this.setInput(t)}setInput(e){const t=this.getFullscreenMaterial();if(this.uniform=null,null!==t){const r=t.uniforms;void 0!==r&&void 0!==r[e]&&(this.uniform=r[e])}}render(e,t,r,i,n){null!==this.uniform&&null!==t&&(this.uniform.value=t.texture),e.setRenderTarget(this.renderToScreen?null:r),e.render(this.scene,this.camera)}initialize(e,r,i){if(void 0!==i&&i!==t.UnsignedByteType){this.getFullscreenMaterial().defines.FRAMEBUFFER_PRECISION_HIGH="1"}}},go=class extends ro{constructor({blendFunction:e=$s,luminanceThreshold:r=.9,luminanceSmoothing:i=.025,resolutionScale:n=.5,intensity:s=1,width:o=Gs.AUTO_SIZE,height:a=Gs.AUTO_SIZE,kernelSize:l=Ts.LARGE}={}){super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=clamp(texture2D(map,uv)*intensity,0.0,1.0);}",{blendFunction:e,uniforms:new Map([["map",new t.Uniform(null)],["intensity",new t.Uniform(s)]])}),this.renderTarget=new t.WebGLRenderTarget(1,1,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.renderTarget.texture.generateMipmaps=!1,this.uniforms.get("map").value=this.renderTarget.texture,this.blurPass=new js({resolutionScale:n,width:o,height:a,kernelSize:l}),this.blurPass.resolution.resizable=this,this.luminancePass=new po({renderTarget:this.renderTarget,colorOutput:!0}),this.luminancePass.resolution=this.resolution,this.luminanceMaterial.threshold=r,this.luminanceMaterial.smoothing=i}get texture(){return this.renderTarget.texture}get luminanceMaterial(){return this.luminancePass.getFullscreenMaterial()}get resolution(){return this.blurPass.resolution}get width(){return this.resolution.width}set width(e){this.resolution.width=e}get height(){return this.resolution.height}set height(e){this.resolution.height=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"The distinction field has been removed, use luminanceMaterial.threshold and luminanceMaterial.smoothing instead."),1}set distinction(e){console.warn(this.name,"The distinction field has been removed, use luminanceMaterial.threshold and luminanceMaterial.smoothing instead.")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,r){const i=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(e,t,i),this.blurPass.render(e,i,i)):this.blurPass.render(e,t,i)}setSize(e,t){this.blurPass.setSize(e,t),this.renderTarget.setSize(this.resolution.width,this.resolution.height)}initialize(e,r,i){this.blurPass.initialize(e,r,i),r||i!==t.UnsignedByteType||(this.renderTarget.texture.format=t.RGBFormat),void 0!==i&&(this.renderTarget.texture.type=i)}},vo=class extends ro{constructor({blendFunction:e=qs,brightness:r=0,contrast:i=0}={}){super("BrightnessContrastEffect","uniform float brightness;uniform float contrast;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=inputColor.rgb+vec3(brightness-0.5);if(contrast>0.0){color/=vec3(1.0-contrast);}else{color*=vec3(1.0+contrast);}outputColor=vec4(min(color+vec3(0.5),1.0),inputColor.a);}",{blendFunction:e,uniforms:new Map([["brightness",new t.Uniform(r)],["contrast",new t.Uniform(i)]])})}},yo=class extends ro{constructor(e=qs){super("ColorAverageEffect","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){float sum=inputColor.r+inputColor.g+inputColor.b;outputColor=vec4(vec3(sum/3.0),inputColor.a);}",{blendFunction:e})}},Ao=class extends ro{constructor({blendFunction:e=qs,offset:r=new t.Vector2(.001,5e-4)}={}){super("ChromaticAberrationEffect","varying vec2 vUvR;varying vec2 vUvB;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 color=inputColor;\n#ifdef ALPHA\nvec2 ra=texture2D(inputBuffer,vUvR).ra;vec2 ba=texture2D(inputBuffer,vUvB).ba;color.r=ra.x;color.b=ba.x;color.a=max(max(ra.y,ba.y),inputColor.a);\n#else\ncolor.r=texture2D(inputBuffer,vUvR).r;color.b=texture2D(inputBuffer,vUvB).b;\n#endif\noutputColor=color;}",{vertexShader:"uniform vec2 offset;varying vec2 vUvR;varying vec2 vUvB;void mainSupport(const in vec2 uv){vUvR=uv+offset;vUvB=uv-offset;}",blendFunction:e,attributes:io.CONVOLUTION,uniforms:new Map([["offset",new t.Uniform(r)]])})}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}initialize(e,t,r){t?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA")}},wo=class extends ro{constructor(e,{blendFunction:r=qs,focusDistance:i=0,focalLength:n=.1,bokehScale:s=1,width:o=Gs.AUTO_SIZE,height:a=Gs.AUTO_SIZE}={}){super("DepthOfFieldEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer;\n#else\nuniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer;\n#endif\nuniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);float CoCNear=texture2D(nearCoCBuffer,uv).r;CoCNear=min(CoCNear*scale,1.0);vec4 result=inputColor*(1.0-colorFar.a)+colorFar;result=mix(result,colorNear,CoCNear);outputColor=result;}",{blendFunction:r,attributes:io.DEPTH,uniforms:new Map([["nearColorBuffer",new t.Uniform(null)],["farColorBuffer",new t.Uniform(null)],["nearCoCBuffer",new t.Uniform(null)],["scale",new t.Uniform(1)]])}),this.camera=e,this.renderTarget=new t.WebGLRenderTarget(1,1,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTarget.texture.generateMipmaps=!1,this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.format=t.RGBFormat,this.renderTargetCoC.texture.name="DoF.CoC",this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new mo(new Ss(e));const l=this.circleOfConfusionMaterial;l.uniforms.focusDistance.value=i,l.uniforms.focalLength.value=n,this.blurPass=new js({width:o,height:a,kernelSize:Ts.MEDIUM}),this.blurPass.resolution.resizable=this,this.maskPass=new mo(new Is(this.renderTargetCoC.texture));const c=this.maskPass.getFullscreenMaterial();c.maskFunction=Ps.MULTIPLY,c.colorChannel=ws,this.bokehNearBasePass=new mo(new bs(!1,!0)),this.bokehNearFillPass=new mo(new bs(!0,!0)),this.bokehFarBasePass=new mo(new bs(!1,!1)),this.bokehFarFillPass=new mo(new bs(!0,!1)),this.bokehScale=s,this.target=null}get circleOfConfusionMaterial(){return this.cocPass.getFullscreenMaterial()}get resolution(){return this.blurPass.resolution}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(e){[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].map((e=>e.getFullscreenMaterial().uniforms.scale)).forEach((t=>{t.value=e})),this.maskPass.getFullscreenMaterial().uniforms.strength.value=e,this.uniforms.get("scale").value=e}calculateFocusDistance(e){const t=this.camera,r=t.far-t.near,i=t.position.distanceTo(e);return Math.min(Math.max(i/r,0),1)}setDepthTexture(e,r=t.BasicDepthPacking){const i=this.circleOfConfusionMaterial;i.uniforms.depthBuffer.value=e,i.depthPacking=r}update(e,t,r){const i=this.renderTarget,n=this.renderTargetCoC,s=this.renderTargetCoCBlurred,o=this.renderTargetMasked,a=this.bokehFarBasePass,l=this.bokehFarFillPass,c=a.getFullscreenMaterial().uniforms,h=l.getFullscreenMaterial().uniforms,u=this.bokehNearBasePass,d=this.bokehNearFillPass,p=u.getFullscreenMaterial().uniforms,f=d.getFullscreenMaterial().uniforms;if(null!==this.target){const e=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.uniforms.focusDistance.value=e}this.cocPass.render(e,null,n),this.blurPass.render(e,n,s),this.maskPass.render(e,t,o),c.cocBuffer.value=h.cocBuffer.value=n.texture,a.render(e,o,i),l.render(e,i,this.renderTargetFar),p.cocBuffer.value=f.cocBuffer.value=s.texture,u.render(e,t,i),d.render(e,i,this.renderTargetNear)}setSize(e,t){const r=this.resolution;let i=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];i.push(this.renderTargetCoC,this.renderTargetMasked),i.forEach((r=>r.setSize(e,t)));const n=r.width,s=r.height;i=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred],i.forEach((e=>e.setSize(n,s)));[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach((e=>e.getFullscreenMaterial().setTexelSize(1/n,1/s)))}initialize(e,r,i){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach((t=>t.initialize(e,r,i))),this.blurPass.initialize(e,r,t.UnsignedByteType),r||i!==t.UnsignedByteType||(this.renderTargetNear.texture.type=t.RGBFormat),void 0!==i&&(this.renderTarget.texture.type=i,this.renderTargetNear.texture.type=i,this.renderTargetFar.texture.type=i,this.renderTargetMasked.texture.type=i)}},xo=(new t.Vector3,new t.Matrix4,class extends ro{constructor({blendFunction:e=qs,hue:r=0,saturation:i=0}={}){super("HueSaturationEffect","uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",{blendFunction:e,uniforms:new Map([["hue",new t.Uniform(new t.Vector3)],["saturation",new t.Uniform(i)]])}),this.setHue(r)}setHue(e){const t=Math.sin(e),r=Math.cos(e);this.uniforms.get("hue").value.set(2*r,-Math.sqrt(3)*t-r,Math.sqrt(3)*t-r).addScalar(1).divideScalar(3)}}),bo=(new t.Color,class extends ro{constructor({blendFunction:e=$s,premultiply:t=!1}={}){super("NoiseEffect","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time));\n#ifdef PREMULTIPLY\noutputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a);\n#else\noutputColor=vec4(noise,inputColor.a);\n#endif\n}",{blendFunction:e}),this.premultiply=t}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(e){this.premultiply!==e&&(e?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}}),So=class extends ro{constructor(e=30){super("PixelationEffect","uniform bool active;uniform vec2 d;void mainUv(inout vec2 uv){if(active){uv=vec2(d.x*(floor(uv.x/d.x)+0.5),d.y*(floor(uv.y/d.y)+0.5));}}",{uniforms:new Map([["active",new t.Uniform(!1)],["d",new t.Uniform(new t.Vector2)]])}),this.resolution=new t.Vector2,this.granularity=e}getGranularity(){return this.granularity}setGranularity(e){(e=Math.floor(e))%2>0&&(e+=1);const t=this.uniforms;t.get("active").value=e>0,t.get("d").value.set(e,e).divide(this.resolution),this.granularity=e}setSize(e,t){this.resolution.set(e,t),this.setGranularity(this.granularity)}},Eo=(new t.Vector3,new t.Vector3,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC"),Co="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlAQiIK1wRfSJTx+i4JX7vKIigs8HXpXvqVcvrcC9agQ7IDTSSWgqCQQliDRBJKkkhDSkqVPNqVOnP+8b//rH3P+eZ+199tlznVTlvVrft7+1T7OaueZY42/m37QALKNk2wHg1pITlB17mC+Pp11W3X/LHyT32vhg48/5SOv+PnwpsHA70JoGlueB1iKApeqzvOzn44GatTB76Xzhd7suBR7+WWADgDEAwwCG/L54b/poDLrHuvvm70Z2Avhsc+PVcxscBU8F8C8ADg5+ipIjD/PlGwfgju8B924E5seARUfLsiNmqQW0IjL8+7L2NYD/7COBzfcCm+aB8SVgdAkYIRCXKyDax4EdAanL5PuNPllNvXDlAHwFgP8AcC2AhRIoDXbsYb48dl5WkVFTE3LGDcC9m4CZCWBuFFgeAZaGAYJQQCRqDHT+McJrVb8zwATUXH02MHYfMHEIGFsAxgjApQqACYQORjtd/B7Axt/z79sC0+cMPgjjlwPwVwHcA+DfAHzTxcVgWBroqMN8+cYBeM71wH0TwKExYHYUWCIAHYRLTlkCYgcIBcAgU/n3qy8GRu4HRgnAOWBkERhddPAJhGJDBxkvw7cqimr+zFM/ZLnZF64cgL8BYD+AWwB8x/dlWuWagHiYL984AJ/0RWBy1AE4AizyM1yxYAcTigW55xMbAkxEiwEdkJ/ZCQxPAiOHgBECc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xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC",To=class extends ro{constructor(e,r,i=Oo.HIGH,n=Ms.COLOR){super("SMAAEffect","uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:qs,attributes:io.CONVOLUTION|io.DEPTH,uniforms:new Map([["weightMap",new t.Uniform(null)]])}),this.renderTargetEdges=new t.WebGLRenderTarget(1,1,{minFilter:t.LinearFilter,stencilBuffer:!1,depthBuffer:!1,format:t.RGBFormat}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.renderTargetWeights.texture.format=t.RGBAFormat,this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new Js(!0,!1,!1),this.clearPass.overrideClearColor=new t.Color(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new mo(new Ds(new t.Vector2,n)),this.weightsPass=new mo(new Rs);const s=new t.Texture(e);s.name="SMAA.Search",s.magFilter=t.NearestFilter,s.minFilter=t.NearestFilter,s.format=t.RGBAFormat,s.generateMipmaps=!1,s.needsUpdate=!0,s.flipY=!0;const o=new t.Texture(r);o.name="SMAA.Area",o.magFilter=t.LinearFilter,o.minFilter=t.LinearFilter,o.format=t.RGBAFormat,o.generateMipmaps=!1,o.needsUpdate=!0,o.flipY=!1;const a=this.weightsPass.getFullscreenMaterial();a.uniforms.searchTexture.value=s,a.uniforms.areaTexture.value=o,this.applyPreset(i)}get edgeDetectionMaterial(){return this.edgeDetectionPass.getFullscreenMaterial()}get colorEdgesMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.getFullscreenMaterial()}setEdgeDetectionThreshold(e){this.edgeDetectionPass.getFullscreenMaterial().setEdgeDetectionThreshold(e)}setOrthogonalSearchSteps(e){this.weightsPass.getFullscreenMaterial().setOrthogonalSearchSteps(e)}applyPreset(e){const t=this.edgeDetectionMaterial,r=this.weightsMaterial;switch(e){case Oo.LOW:t.setEdgeDetectionThreshold(.15),r.setOrthogonalSearchSteps(4),r.diagonalDetection=!1,r.cornerRounding=!1;break;case Oo.MEDIUM:t.setEdgeDetectionThreshold(.1),r.setOrthogonalSearchSteps(8),r.diagonalDetection=!1,r.cornerRounding=!1;break;case Oo.HIGH:t.setEdgeDetectionThreshold(.1),r.setOrthogonalSearchSteps(16),r.setDiagonalSearchSteps(8),r.setCornerRounding(25),r.diagonalDetection=!0,r.cornerRounding=!0;break;case Oo.ULTRA:t.setEdgeDetectionThreshold(.05),r.setOrthogonalSearchSteps(32),r.setDiagonalSearchSteps(16),r.setCornerRounding(25),r.diagonalDetection=!0,r.cornerRounding=!0}}setDepthTexture(e,r=t.BasicDepthPacking){const i=this.edgeDetectionMaterial;i.uniforms.depthBuffer.value=e,i.depthPacking=r}update(e,t,r){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){const r=this.edgeDetectionPass.getFullscreenMaterial(),i=this.weightsPass.getFullscreenMaterial();this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t),i.uniforms.resolution.value.set(e,t),i.uniforms.texelSize.value.set(1/e,1/t),r.uniforms.texelSize.value.copy(i.uniforms.texelSize.value)}dispose(){const e=this.weightsPass.getFullscreenMaterial().uniforms;e.searchTexture.value.dispose(),e.areaTexture.value.dispose(),super.dispose()}static get searchImageDataURL(){return Eo}static get areaImageDataURL(){return Co}},Oo={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3},Do=class extends ro{constructor(e={}){const r=Object.assign({blendFunction:qs,eskil:!1,offset:.5,darkness:.5},e);super("VignetteEffect","uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb;\n#ifdef ESKIL\nvec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));\n#else\nfloat d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));\n#endif\noutputColor=vec4(color,inputColor.a);}",{blendFunction:r.blendFunction,uniforms:new Map([["offset",new t.Uniform(r.offset)],["darkness",new t.Uniform(r.darkness)]])}),this.eskil=r.eskil}get eskil(){return this.defines.has("ESKIL")}set eskil(e){this.eskil!==e&&(e?this.defines.set("ESKIL","1"):this.defines.delete("ESKIL"),this.setChanged())}},Mo=class extends t.Loader{load(e=(()=>{}),r=null){4===arguments.length?(e=arguments[1],r=arguments[3]):3!==arguments.length&&"function"==typeof arguments[0]||(e=arguments[1],r=null);const i=this.manager,n=new t.LoadingManager;return new Promise(((t,s)=>{const o=new Image,a=new Image;n.onError=e=>{i.itemError(e),null!==r?(r(`Failed to load ${e}`),t()):s(`Failed to load ${e}`)},n.onLoad=()=>{const r=[o,a];e(r),t(r)},o.addEventListener("error",(e=>{n.itemError("smaa-search")})),a.addEventListener("error",(e=>{n.itemError("smaa-area")})),o.addEventListener("load",(()=>{i.itemEnd("smaa-search"),n.itemEnd("smaa-search")})),a.addEventListener("load",(()=>{i.itemEnd("smaa-area"),n.itemEnd("smaa-area")})),i.itemStart("smaa-search"),i.itemStart("smaa-area"),n.itemStart("smaa-search"),n.itemStart("smaa-area"),o.src=Eo,a.src=Co}))}};class _o{constructor(e,t){this.enabled=!1,this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(e){this.effect.blendMode.opacity.value=e},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(e){this.effect.blendMode.setBlendFunction(Number(e))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=qs}toJSON(){const e=Object.assign({},this),t=Object.getPrototypeOf(this),r=Object.getOwnPropertyNames(t);for(const i of r){const r=Object.getOwnPropertyDescriptor(t,i);r&&"function"==typeof r.get&&(e[i]=this[i])}return["constructor","effect","subscriptions"].forEach((t=>delete e[t])),e}}class No extends _o{constructor(){super(go),this.blendFunction=$s}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}}class Lo extends _o{constructor(){super(vo)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}}class Bo extends _o{constructor(){super(Ao),this.effect.offset=new t.Vector2(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[1e3*this.effect.offset.x,1e3*this.effect.offset.y]}}class Io extends _o{constructor(){super(yo)}}class Po extends _o{constructor(){super(xo),this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}}class Ro extends _o{constructor(){super(bo),this.blendFunction=Zs}}class Fo extends _o{constructor(){super(Do)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}}class Uo extends _o{constructor(e){super(wo,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}}class zo extends _o{constructor(){super(So)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}}function ko(e,t){return t&&t.enabled&&e.push(t.effect),e}class Go{constructor(){this.effects=new Map,this.loadingManager=new t.LoadingManager,this.smaaImageLoader=new Mo(this.loadingManager),this.renderPass=new Ws,this.depthPass=new Xs,this.clock=new t.Clock,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new No),this.effects.set("chromaticAberration",new Bo),this.effects.set("vignette",new Fo),this.effects.set("noise",new Ro),this.effects.set("colorAverage",new Io),this.effects.set("hueSaturation",new Po),this.effects.set("brightnessContrast",new Lo),this.effects.set("depthOfField",new Uo),this.effects.set("pixelation",new zo)}reinit(){if(this.effectComposer=new class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:r=!1,alpha:i=!1,multisampling:n=0,frameBufferType:s}={}){this.renderer=e,this.inputBuffer=null,this.outputBuffer=null,null!==this.renderer&&(this.renderer.autoClear=!1,this.inputBuffer=this.createBuffer(t,r,s,n),this.outputBuffer=this.inputBuffer.clone()),this.copyPass=new mo(new Os),this.alpha=i,this.depthTexture=null,this.passes=[],this.autoRenderToScreen=!0}get multisampling(){return this.inputBuffer instanceof t.WebGLMultisampleRenderTarget?this.inputBuffer.samples:0}set multisampling(e){const t=this.inputBuffer,r=this.multisampling;r>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e):r!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getRenderer(){return this.renderer}replaceRenderer(e,r=!0){const i=this.renderer;if(null!==i&&i!==e){const n=i.getSize(new t.Vector2),s=e.getSize(new t.Vector2),o=i.domElement.parentNode;this.renderer=e,this.renderer.autoClear=!1,n.equals(s)||this.setSize(),r&&null!==o&&(o.removeChild(i.domElement),o.appendChild(e.domElement))}return i}createDepthTexture(){const e=this.depthTexture=new t.DepthTexture;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=t.DepthStencilFormat,e.type=t.UnsignedInt248Type):e.type=t.UnsignedIntType,e}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const e of this.passes)e.setDepthTexture(null)}}createBuffer(e,r,i,n){const s=this.renderer,o=s.getContext(),a=s.getDrawingBufferSize(new t.Vector2),l={format:this.alpha||o.getContextAttributes().alpha||i!==t.UnsignedByteType?t.RGBAFormat:t.RGBFormat,minFilter:t.LinearFilter,magFilter:t.LinearFilter,stencilBuffer:r,depthBuffer:e,type:i},c=n>0?new t.WebGLMultisampleRenderTarget(a.width,a.height,l):new t.WebGLRenderTarget(a.width,a.height,l);return n>0&&(c.samples=n),c.texture.name="EffectComposer.Buffer",c.texture.generateMipmaps=!1,c}addPass(e,r){const i=this.passes,n=this.renderer,s=n.getDrawingBufferSize(new t.Vector2),o=n.getContext().getContextAttributes().alpha,a=this.inputBuffer.texture.type;if(e.setSize(s.width,s.height),e.initialize(n,o,a),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==r?i.splice(r,0,e):i.push(e),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const t=this.createDepthTexture();for(e of i)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}removePass(e){const t=this.passes,r=t.indexOf(e);if(-1!==r&&t.splice(r,1).length>0){if(null!==this.depthTexture){const r=(e,t)=>e||t.needsDepthTexture;t.reduce(r,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&r===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,r=this.copyPass;let i,n,s,o=this.inputBuffer,a=this.outputBuffer,l=!1;for(const c of this.passes)c.enabled&&(c.render(t,o,a,e,l),c.needsSwap&&(l&&(r.renderToScreen=c.renderToScreen,i=t.getContext(),n=t.state.buffers.stencil,n.setFunc(i.NOTEQUAL,1,4294967295),r.render(t,o,a,e,l),n.setFunc(i.EQUAL,1,4294967295)),s=o,o=a,a=s),c instanceof fo?l=!0:c instanceof Vs&&(l=!1))}setSize(e,r,i){const n=this.renderer;if(void 0===e||void 0===r){const i=n.getSize(new t.Vector2);e=i.width,r=i.height}else n.setSize(e,r,i);const s=n.getDrawingBufferSize(new t.Vector2);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height);for(const e of this.passes)e.setSize(s.width,s.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose()}}(this.renderer),this.renderPass=new Ws(this.scene,this.camera),this.enabled){const e=new To(this.search,this.area,Oo.ULTRA,Ms.COLOR);e.edgeDetectionMaterial.setPredicationMode(_s),e.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),e.edgeDetectionMaterial.setPredicationThreshold(.002),e.edgeDetectionMaterial.setPredicationScale(1),this.depthPass=new Xs(this.scene,this.camera),this.effectComposer.addPass(this.renderPass),this.effectComposer.addPass(this.depthPass),this.effectComposer.addPass(new uo(this.camera,e));const t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(ko,[]),r=[this.effects.get("pixelation")].reduce(ko,[]);r.length>0&&this.effectComposer.addPass(new uo(this.camera,...r)),this.effectComposer.addPass(new uo(this.camera,...t))}else this.effectComposer.addPass(this.renderPass)}init({renderer:e,camera:t,scene:r}){return this.renderer=e,this.scene=r,this.camera=t,this.smaaImageLoader.load((([e,t])=>{this.search=e,this.area=t,this.reinit()}))}setInternalSize(e,t){const{renderer:r,effectComposer:i}=this;if(!r)return;e=Math.round(e),t=Math.round(t);const n=r.getPixelRatio(),{width:s,height:o}=i.inputBuffer;if(s/n!==e||o/n!==t){i.inputBuffer.setSize(e*n,t*n),i.outputBuffer.setSize(e*n,t*n);for(const r of i.passes)r.setSize(e*n,t*n)}}fromJSON(e){e&&(Object.keys(e).forEach((t=>{const r=e[t],i=this.effects.get(t);Object.keys(r).forEach((e=>{i[e]=r[e]}))})),this.enabled=e.enabled)}toJSON(){const e={};return this.effects.forEach(((t,r)=>{e[r]=t.toJSON()}),e),Object.assign({enabled:this.enabled},e)}render(){var e;null===(e=this.effectComposer)||void 0===e||e.render(this.clock.getDelta())}}class jo extends(Rn(t.Scene)){constructor(){super(),this.objectType="Scene",this.alpha=1,this.backupFog=new t.Fog(16777215,.1,2e3),this.fogUseBGColor=!1,this.directionalLightState=!0,this.ambientLightState=!0,this.wireframeState=!1,this._color=new t.Color(1644825),this.canvas={mode:1,preset:"fullscreen",size:{width:512,height:512},editorSize:{width:1,height:1},color:[0,0,0,.5]},this.name="Untitled"}get color(){return this._color}set color(e){!0===this.fogUseBGColor&&this.backupFog.color.copy(e),this._color.copy(e)}get enableFog(){return null!==this.fog}set enableFog(e){this.fog=!0===e?this.backupFog:null}init(e,r){this.camera=new ss(e,r),this.camera.setDefault(),this.camera.orthoCamera.near=-5e4,this.camera.perspCamera.near=50,this.camera.orthoCamera.far=1e5,this.camera.perspCamera.far=1e5,this.camera.updateProjectionMatrix(),this.camera.position.set(0,0,this.camera.targetOffset),this.camera.lookAt(new t.Vector3(0,0,-1)),this.add(this.camera),this.canvas.size.width=e,this.canvas.size.height=r,this.ambientLight=new t.HemisphereLight(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.add(this.ambientLight),this.directionalLight=new t.DirectionalLight(16777215,.75),this.directionalLight.name="Default Directional Light",this.directionalLight.position.set(85e4,13e5,1e6),this.activeCamera=this.camera,this.activeCamera.add(this.directionalLight),this.postprocessing=new Go}initFromObjectLoader(e){return this.traverse((t=>{t.uuid===e.ambientLight?this.ambientLight=t:t.uuid===e.directionalLight?this.directionalLight=t:(t.uuid===e.activeCamera&&(this.activeCamera=t),t.uuid===e.camera&&(this.camera=t,this.camera.setDefault()))})),this}addDefaultChild(){const e=new Er,t=e.userData.layers,r=t.head.id;t.getLayer(r).uniforms[`f${r}_color`].value.setRGB(1,1,1);const i=new ms(Ue.create({parameters:{width:320,height:320}}),e);return i.position.z=-1,this.add(i),i}raycast(e){const t=[],r=i=>{for(const n of i.children)Fn(n)&&!n.raycastLock&&n.visible&&((Ze(n)||$e(n)&&n.enableHelper)&&e.intersectObject(n,!1,t),r(n))};return r(this),t}traverseEntity(e){for(const t of this.children)Fn(t)&&this.camera!==t&&t.traverseEntity(e)}toJSON(e){var r,i,n,s,o;const a=super.toJSON(e),l=a.object;return l.objectType="Scene",l.activeCamera=null===(r=this.activeCamera)||void 0===r?void 0:r.uuid,l.camera=null===(i=this.camera)||void 0===i?void 0:i.uuid,l.directionalLight=null===(n=this.directionalLight)||void 0===n?void 0:n.uuid,l.ambientLight=null===(s=this.ambientLight)||void 0===s?void 0:s.uuid,l.color=this.color.toArray(),l.alpha=this.alpha,this.background instanceof t.Texture?l.background=this.background.toJSON(e):this.background instanceof t.Color&&(l.background=this.background.toArray()),null!==this.environment&&(l.environment=this.environment.toJSON(e)),!0===this.enableFog&&(l.enableFog=!0,!0===this.fogUseBGColor&&(l.fogUseBGColor=!0),null!==this.fog&&(l.fog=this.fog.toJSON())),!0===this.directionalLightState&&(l.directionalLightState=!0),!0===this.ambientLightState&&(l.ambientLightState=!0),!0===this.wireframeState&&(l.wireframeState=!0),l.canvas={mode:this.canvas.mode,preset:this.canvas.preset,editorSize:{width:window.innerWidth,height:window.innerHeight},color:this.canvas.color},1!==this.canvas.mode&&(l.canvas.size={width:this.canvas.size.width,height:this.canvas.size.height}),l.postprocessing=null===(o=this.postprocessing)||void 0===o?void 0:o.toJSON(),a}fromJSON(e){var r,i,n,s,o;super.fromJSON(e),this.postprocessing=new Go,this.color.fromArray(e.color),this.alpha=e.alpha,void 0!==e.background&&Array.isArray(e.background)&&(this.background=(new t.Color).fromArray(e.background)),void 0!==e.fog&&("FogExp2"===e.fog.type?this.backupFog=new t.FogExp2(e.fog.color,e.fog.density):this.backupFog=new t.Fog(e.fog.color,e.fog.near,e.fog.far)),this.fogUseBGColor=null!==(r=e.fogUseBGColor)&&void 0!==r&&r,this.enableFog=null!==(i=e.enableFog)&&void 0!==i&&i,this.directionalLightState=null!==(n=e.directionalLightState)&&void 0!==n&&n,this.ambientLightState=null!==(s=e.ambientLightState)&&void 0!==s&&s,this.wireframeState=null!==(o=e.wireframeState)&&void 0!==o&&o;const a=e.canvas;return this.canvas.mode=a.mode,a.size&&(this.canvas.size={width:a.size.width,height:a.size.height}),this.canvas.editorSize=a.editorSize?{width:a.editorSize.width,height:a.editorSize.height}:{width:window.innerWidth,height:window.innerHeight},a.color&&(this.canvas.color=[...a.color]),this.postprocessing.fromJSON(e.postprocessing),this}dispose(){this.traverseEntity((e=>{"geometry"in e&&e.geometry.dispose(),"material"in e&&(e.material instanceof Array?e.material.forEach((e=>e.dispose())):e.material.dispose())}))}}!function(e){e[e.STANDARD=1]="STANDARD",e[e.UPPERCASE=2]="UPPERCASE",e[e.LOWERCASE=3]="LOWERCASE"}(ao||(ao={})),function(e){e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM"}(lo||(lo={})),function(e){e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.CENTER=3]="CENTER",e[e.JUSTIFY=4]="JUSTIFY"}(co||(co={})),function(e){e[e.TO_RIGHT=1]="TO_RIGHT",e[e.TO_LEFT=-1]="TO_LEFT"}(ho||(ho={}));const Vo=new t.Vector2;class Ho{constructor(e,r,i){this.message=[],this.endLine=!0,this.yLinePos=e,this.lineHeight=r,this.maxCharSize=i,this.nextChar3DPos=new t.Vector2(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=co.LEFT}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){const t=this.message[e];return t?(this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t):void 0}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,i=this.message.length;r=0;){if(" "!==this.message[r].char){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(" "===this.message[t].char)return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(" "===this.message[t].char)return!0;return!1}popWord(e=this.message.length-1){let t,r=[],i=!0;for(t=e;t>=0;t-=1){if(" "===this.message[t].char){i=!1,0===r.length&&(t-=1,r.splice(0,0,this.message[t]));break}r.splice(0,0,this.message[t])}return i?r=[]:this.message.splice(t+1,r.length),r}getWord(e=0,t=1){const r=[];let i=e;for(i=e;;i+=t){if(!this.message[i]||" "===this.message[i].char){0===r.length&&this.message[i]&&(r.push(this.message[i]),this.message.splice(i,1));break}t>0?(r.push(this.message[i]),this.message.splice(i,1),i-=t):(r.splice(0,0,this.message[i]),this.message.splice(i,1))}return r}getWordAtIndex(e){const t=[];for(let r=e;r=0&&" "!==this.message[r].char;r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,i=e;for(;i>=0&&i=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:0===r?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let i=t;i<=r;i+=1)this.message[i].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t{Jo.fontCache[e]=t,r(t)}),void 0,i)}}))}static loadChar(e,r,i){if(Jo.charCache[e]){if(Jo.charCache[e][i]&&Jo.charCache[e][i].fontFamily===r)return Jo.charCache[e][i]}else Jo.charCache[e]={};const n=Jo.fontCache[r],s=n.generateShapes(e,1);return Jo.charCache[e][i]={geometry:new t.ShapeBufferGeometry(s,i),fontFamily:r,resolution:n.data.resolution,glyphsHa:n.data.glyphs[e].ha},Jo.charCache[e][i]}}Jo.charCache={},Jo.fontCache={},Jo._fontPath="/_assets/_fonts/";class Qo extends jn{constructor(e,r=new Er({transparent:!0,opacity:1,visible:!1,side:t.DoubleSide})){super(e,r),this.objectType="TextFrame",this.material.visible=!1,this._geometryUserData=e.userData,this.userData.textFrame={hexColor:6974058,opacity:1,visible:!0,fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:ao.STANDARD,horizontalAlignment:1,verticalAlignment:lo.TOP,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new t.Vector3(-.5*this._geometryUserData.parameters.width,.5*this._geometryUserData.parameters.height,0),textLines:[]},this.createTextLine()}raycast(e,t){const r=[];if(super.raycast(e,r),r.length>0)return void t.push(r[0]);const i=[];for(let r=0,n=this.children.length;r0))return i[0].object=this,void t.push(i[0])}updateGeometry(e){var t,r;const i=this.userData,n=this.geometry.userData,s=n.parameters.width,o=null===(t=e.parameters)||void 0===t?void 0:t.width,a=null===(r=e.parameters)||void 0===r?void 0:r.height,l=n.parameters.height,c=i.textFrame;super.updateGeometry(e),c.maxLineSize=n.parameters.width,c.textOrigin.set(-.5*n.parameters.width,.5*n.parameters.height,0),void 0!==a&&l!==a?(this.checkOverFlow(),this.checkCapacity()):void 0!==o&&(so&&this.checkOverFlow())}checkOverFlow(e=0){const t=this.userData,r=t.textFrame.textOrigin,i=t.textFrame.textLines;for(let n=e;n0){void 0===i[n+1]&&(i[n].isEndLine(!1),this.createTextLine());let t=0;for(let s=0;si?this.checkOverFlow():e{const t=e.message.map((e=>({char:e.char,originalChar:e.originalChar,fontFamily:e.fontFamily,letterSpacing:e.letterSpacing,fontSize:e.fontSize,LOD:e.LOD})));return{align:e.align,endLine:e.endLine,lineHeight:e.lineHeight,maxCharSize:e.maxCharSize,yLinePos:e.yLinePos,message:t}}));return r.userData.textFrame.textLinesData=i,t}fromJSONasync(e){const r=Object.create(null,{fromJSON:{get:()=>super.fromJSON}});return er(this,void 0,void 0,(function*(){if(r.fromJSON.call(this,e),void 0!==e.userData){const r=e.userData.textFrame;yield Jo.loadFont(r.fontFamily),r.textOrigin=new t.Vector3(r.textOrigin.x,r.textOrigin.y,r.textOrigin.z);const i=new t.MeshBasicMaterial({color:r.hexColor,opacity:r.opacity,visible:r.visible,transparent:!0,side:t.DoubleSide});r.textLinesData&&(r.textLines=r.textLinesData.map(((e,t)=>{const n=new Ho(Number(e.yLinePos),Number(e.lineHeight),Number(e.maxCharSize)),s=e.message.map(((e,s)=>{if(void 0===e.char){const i=r.textLines[t].message[s];if("geometries"in i){const t=i.geometries[0].userData.parameters;Object.assign(e,{LOD:t.lod,char:t.char,fontFamily:t.fontFamily,fontSize:t.fontSize,letterSpacing:t.letterSpacing,originalChar:t.char})}}const o={char:e.char,fontFamily:e.fontFamily,letterSpacing:Number(e.letterSpacing),fontSize:Number(e.fontSize),LOD:e.LOD},a=new Jo(o,i.clone());return n.addChar3D(a,r.textOrigin),this.add(a),a}));return n.message=s,n})),this.userData.textFrame=r),this.textFullUpdate()}return this}))}}Qo.VERTICAL_ALIGN=lo,Qo.HORIZONTAL_ALIGN=co,Qo.TEXT_TRANSFORM=ao,Qo.TRAVEL_DIRECTION=ho;var Yo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Wo(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')} +/*! + + pica + https://github.com/nodeca/pica + + */var Xo;!function(e){var t={exports:{}};e(t,t.exports)}((function(e,t){e.exports=function(){function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){if(!a&&Wo)return Wo(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return n(t[o][1][e]||e)}),c,c.exports,e,t,r,i)}return r[o].exports}for(var s=Wo,o=0;o=0,wasm:t.indexOf("wasm")>=0};n.call(this,r),this.features={js:r.js,wasm:r.wasm&&this.has_wasm()},this.use(s),this.use(o)}i(a,n),a.prototype.resizeAndUnsharp=function(e,t){var r=this.resize(e,t);return e.unsharpAmount&&this.unsharp_mask(r,e.toWidth,e.toHeight,e.unsharpAmount,e.unsharpRadius,e.unsharpThreshold),r},t.exports=a},{"./mm_resize":4,"./mm_unsharp_mask":9,inherits:19,multimath:20}],2:[function(e,t,r){function i(e){return e<0?0:e>255?255:e}function n(e,t,r,n,s,o){var a,l,c,h,u,d,p,f,m,g,v,y=0,A=0;for(m=0;m0;p--)h=h+(v=o[u++])*e[f+3]|0,c=c+v*e[f+2]|0,l=l+v*e[f+1]|0,a=a+v*e[f]|0,f=f+4|0;t[A+3]=i(h+8192>>14),t[A+2]=i(c+8192>>14),t[A+1]=i(l+8192>>14),t[A]=i(a+8192>>14),A=A+4*n|0}A=4*(m+1)|0,y=(m+1)*r*4|0}}function s(e,t,r,n,s,o){var a,l,c,h,u,d,p,f,m,g,v,y=0,A=0;for(m=0;m0;p--)h=h+(v=o[u++])*e[f+3]|0,c=c+v*e[f+2]|0,l=l+v*e[f+1]|0,a=a+v*e[f]|0,f=f+4|0;t[A+3]=i(h+8192>>14),t[A+2]=i(c+8192>>14),t[A+1]=i(l+8192>>14),t[A]=i(a+8192>>14),A=A+4*n|0}A=4*(m+1)|0,y=(m+1)*r*4|0}}t.exports={convolveHorizontally:n,convolveVertically:s}},{}],3:[function(e,t,r){t.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAEXA2AAAGAGf39/f39/AGAHf39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMEAwABAgYGAX8AQQALB1cFEV9fd2FzbV9jYWxsX2N0b3JzAAAIY29udm9sdmUAAQpjb252b2x2ZUhWAAIMX19kc29faGFuZGxlAwAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAK7AMDAwABC8YDAQ9/AkAgA0UNACAERQ0AA0AgDCENQQAhE0EAIQcDQCAHQQJqIQYCfyAHQQF0IAVqIgcuAQIiFEUEQEGAwAAhCEGAwAAhCUGAwAAhCkGAwAAhCyAGDAELIBIgBy4BAGohCEEAIQsgFCEHQQAhDiAGIQlBACEPQQAhEANAIAUgCUEBdGouAQAiESAAIAhBAnRqKAIAIgpBGHZsIBBqIRAgCkH/AXEgEWwgC2ohCyAKQRB2Qf8BcSARbCAPaiEPIApBCHZB/wFxIBFsIA5qIQ4gCEEBaiEIIAlBAWohCSAHQQFrIgcNAAsgC0GAQGshCCAOQYBAayEJIA9BgEBrIQogEEGAQGshCyAGIBRqCyEHIAEgDUECdGogCUEOdSIGQf8BIAZB/wFIGyIGQQAgBkEAShtBCHRBgP4DcSAKQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EQdEGAgPwHcSALQQ51IgZB/wEgBkH/AUgbIgZBACAGQQBKG0EYdHJyIAhBDnUiBkH/ASAGQf8BSBsiBkEAIAZBAEobcjYCACADIA1qIQ0gE0EBaiITIARHDQALIAxBAWoiDCACbCESIAMgDEcNAAsLCx4AQQAgAiADIAQgBSAAEAEgAkEAIAQgBSAGIAEQAQs="},{}],4:[function(e,t,r){t.exports={name:"resize",fn:e("./resize"),wasm_fn:e("./resize_wasm"),wasm_src:e("./convolve_wasm_base64")}},{"./convolve_wasm_base64":3,"./resize":5,"./resize_wasm":8}],5:[function(e,t,r){var i=e("./resize_filter_gen"),n=e("./convolve").convolveHorizontally,s=e("./convolve").convolveVertically;function o(e,t,r){for(var i=3,n=t*r*4|0;i>1]+=s(1-y),w=0;w0&&0===p[x];)x--;if(b=c+w,S=x-w+1,M[_++]=b,M[_++]=S,N)for(g=w;g<=x;g++)M[_++]=p[g];else M.set(p.subarray(w,x+1),_),_+=S}else M[_++]=0,M[_++]=0}return M}},{"./resize_filter_info":7}],7:[function(e,t,r){t.exports=[{win:.5,filter:function(e){return e>=-.5&&e<.5?1:0}},{win:1,filter:function(e){if(e<=-1||e>=1)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*(.54+.46*Math.cos(t/1))}},{win:2,filter:function(e){if(e<=-2||e>=2)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*Math.sin(t/2)/(t/2)}},{win:3,filter:function(e){if(e<=-3||e>=3)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*Math.sin(t/3)/(t/3)}}]},{}],8:[function(e,t,r){var i=e("./resize_filter_gen");function n(e,t,r){for(var i=3,n=t*r*4|0;i>8&255}}t.exports=function(e){var t=e.src,r=e.width,s=e.height,o=e.toWidth,l=e.toHeight,c=e.scaleX||e.toWidth/e.width,h=e.scaleY||e.toHeight/e.height,u=e.offsetX||0,d=e.offsetY||0,p=e.dest||new Uint8Array(o*l*4),f=void 0===e.quality?3:e.quality,m=e.alpha||!1,g=i(f,r,o,c,u),v=i(f,s,l,h,d),y=0,A=this.__align(y+Math.max(t.byteLength,p.byteLength)),w=this.__align(A+s*o*4),x=this.__align(w+g.byteLength),b=x+v.byteLength,S=this.__instance("resize",b),E=new Uint8Array(this.__memory.buffer),C=new Uint32Array(this.__memory.buffer),T=new Uint32Array(t.buffer);return C.set(T),a(g,E,w),a(v,E,x),(S.exports.convolveHV||S.exports._convolveHV)(w,x,A,r,s,o,l),new Uint32Array(p.buffer).set(new Uint32Array(this.__memory.buffer,0,l*o)),m||n(p,o,l),p}},{"./resize_filter_gen":6}],9:[function(e,t,r){t.exports={name:"unsharp_mask",fn:e("./unsharp_mask"),wasm_fn:e("./unsharp_mask_wasm"),wasm_src:e("./unsharp_mask_wasm_base64")}},{"./unsharp_mask":10,"./unsharp_mask_wasm":11,"./unsharp_mask_wasm_base64":12}],10:[function(e,t,r){var i=e("glur/mono16");function n(e,t,r){for(var i,n,s,o,a=t*r,l=new Uint16Array(a),c=0;c=n&&i>=s?i:n>=s&&n>=i?n:s,l[c]=o<<8;return l}t.exports=function(e,t,r,s,o,a){var l,c,h,u,d;if(!(0===s||o<.5)){o>2&&(o=2);var p=n(e,t,r),f=new Uint16Array(p);i(f,t,r,o);for(var m=s/100*4096+.5|0,g=a<<8,v=t*r,y=0;y=g&&(h=((c=(c=(c=l+(m*u+2048>>12))>65280?65280:c)<0?0:c)<<12)/(l=0!==l?l:1)|0,e[d=4*y]=e[d]*h+2048>>12,e[d+1]=e[d+1]*h+2048>>12,e[d+2]=e[d+2]*h+2048>>12)}}},{"glur/mono16":18}],11:[function(e,t,r){t.exports=function(e,t,r,i,n,s){if(!(0===i||n<.5)){n>2&&(n=2);var o=t*r,a=4*o,l=2*o,c=2*o,h=4*Math.max(t,r),u=32,d=0,p=a,f=p+l,m=f+c,g=m+c,v=g+h,y=this.__instance("unsharp_mask",a+l+2*c+h+u,{exp:Math.exp}),A=new Uint32Array(e.buffer);new Uint32Array(this.__memory.buffer).set(A);var w=y.exports.hsv_v16||y.exports._hsv_v16;w(d,p,t,r),(w=y.exports.blurMono16||y.exports._blurMono16)(p,f,m,g,v,t,r,n),(w=y.exports.unsharp||y.exports._unsharp)(d,d,p,f,t,r,i,s),A.set(new Uint32Array(this.__memory.buffer,0,o))}}},{}],12:[function(e,t,r){t.exports="AGFzbQEAAAAADAZkeWxpbmsAAAAAAAE0B2AAAGAEf39/fwBgBn9/f39/fwBgCH9/f39/f39/AGAIf39/f39/f30AYAJ9fwBgAXwBfAIZAgNlbnYDZXhwAAYDZW52Bm1lbW9yeQIAAAMHBgAFAgQBAwYGAX8AQQALB4oBCBFfX3dhc21fY2FsbF9jdG9ycwABFl9fYnVpbGRfZ2F1c3NpYW5fY29lZnMAAg5fX2dhdXNzMTZfbGluZQADCmJsdXJNb25vMTYABAdoc3ZfdjE2AAUHdW5zaGFycAAGDF9fZHNvX2hhbmRsZQMAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwABCsUMBgMAAQvWAQEHfCABRNuGukOCGvs/IAC7oyICRAAAAAAAAADAohAAIgW2jDgCFCABIAKaEAAiAyADoCIGtjgCECABRAAAAAAAAPA/IAOhIgQgBKIgAyACIAKgokQAAAAAAADwP6AgBaGjIgS2OAIAIAEgBSAEmqIiB7Y4AgwgASADIAJEAAAAAAAA8D+gIASioiIItjgCCCABIAMgAkQAAAAAAADwv6AgBKKiIgK2OAIEIAEgByAIoCAFRAAAAAAAAPA/IAahoCIDo7Y4AhwgASAEIAKgIAOjtjgCGAuGBQMGfwl8An0gAyoCDCEVIAMqAgghFiADKgIUuyERIAMqAhC7IRACQCAEQQFrIghBAEgiCQRAIAIhByAAIQYMAQsgAiAALwEAuCIPIAMqAhi7oiIMIBGiIg0gDCAQoiAPIAMqAgS7IhOiIhQgAyoCALsiEiAPoqCgoCIOtjgCACACQQRqIQcgAEECaiEGIAhFDQAgCEEBIAhBAUgbIgpBf3MhCwJ/IAQgCmtBAXFFBEAgDiENIAgMAQsgAiANIA4gEKIgFCASIAAv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HZB/wFxIgIgAiAEQQh2Qf8BcSIDIAMgBEH/AXEiBEkbIAIgA0sbIgYgBiAEIAIgBEsbIAMgBEsbQQh0OwEAIAFBAmohASAAQQRqIQAgBUEBayIFDQALCwuZAgIDfwF8IAQgBWwhBAJ/IAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6AiC5lEAAAAAAAA4EFjBEAgC6oMAQtBgICAgHgLIQUgBARAIAdBCHQhCUEAIQYDQCAJIAIgBkEBdCIHai8BACIBIAMgB2ovAQBrIgcgB0EfdSIIaiAIc00EQCAAIAZBAnQiCGoiCiAFIAdsQYAQakEMdSABaiIHQYD+AyAHQYD+A0gbIgdBACAHQQBKG0EMdCABQQEgARtuIgEgCi0AAGxBgBBqQQx2OgAAIAAgCEEBcmoiByABIActAABsQYAQakEMdjoAACAAIAhBAnJqIgcgASAHLQAAbEGAEGpBDHY6AAALIAZBAWoiBiAERw0ACwsL"},{}],13:[function(e,t,r){var i=100;function n(e,t){this.create=e,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=t||2e3}n.prototype.acquire=function(){var e,t=this;return 0!==this.available.length?e=this.available.pop():((e=this.create()).id=this.lastId++,e.release=function(){return t.release(e)}),this.acquired[e.id]=e,e},n.prototype.release=function(e){var t=this;delete this.acquired[e.id],e.lastUsed=Date.now(),this.available.push(e),0===this.timeoutId&&(this.timeoutId=setTimeout((function(){return t.gc()}),i))},n.prototype.gc=function(){var e=this,t=Date.now();this.available=this.available.filter((function(r){return!(t-r.lastUsed>e.idle&&(r.destroy(),1))})),0!==this.available.length?this.timeoutId=setTimeout((function(){return e.gc()}),i):this.timeoutId=0},t.exports=n},{}],14:[function(e,t,r){var i=2;t.exports=function(e,t,r,n,s,o){var a=r/e,l=n/t,c=(2*o+i+1)/s;if(c>.5)return[[r,n]];var h=Math.ceil(Math.log(Math.min(a,l))/Math.log(c));if(h<=1)return[[r,n]];for(var u=[],d=0;d=e.toWidth&&(a=e.toWidth-t),(r=o-e.destTileBorder)<0&&(r=0),r+(l=o+d+e.destTileBorder-r)>=e.toHeight&&(l=e.toHeight-r),p={toX:t,toY:r,toWidth:a,toHeight:l,toInnerX:i,toInnerY:o,toInnerWidth:u,toInnerHeight:d,offsetX:t/c-n(t/c),offsetY:r/h-n(r/h),scaleX:c,scaleY:h,x:n(t/c),y:n(r/h),width:s(a/c),height:s(l/h)},f.push(p);return f}},{}],16:[function(e,t,r){function i(e){return Object.prototype.toString.call(e)}t.exports.isCanvas=function(e){var t=i(e);return"[object HTMLCanvasElement]"===t||"[object OffscreenCanvas]"===t||"[object Canvas]"===t},t.exports.isImage=function(e){return"[object HTMLImageElement]"===i(e)},t.exports.isImageBitmap=function(e){return"[object ImageBitmap]"===i(e)},t.exports.limiter=function(e){var t=0,r=[];function i(){t=0;m--)l=a*g+o*v+c*y+h*A,h=c,c=l,o=a,a=e[u],t[d]=r[p]+c,u--,p--,d-=s}}function u(e,t,r,i){if(i){var n=new Uint16Array(e.length),s=new Float32Array(Math.max(t,r)),o=c(i);h(e,n,s,o,t,r),h(n,e,s,o,r,t)}}t.exports=u},{}],19:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],20:[function(e,t,r){var i=e("object-assign"),n=e("./lib/base64decode"),s=e("./lib/wa_detect"),o={js:!0,wasm:!0};function a(e){if(!(this instanceof a))return new a(e);var t=i({},o,e||{});if(this.options=t,this.__cache={},this.__init_promise=null,this.__modules=t.modules||{},this.__memory=null,this.__wasm={},this.__isLE=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0],!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}a.prototype.has_wasm=s,a.prototype.use=function(e){return this.__modules[e.name]=e,this.options.wasm&&this.has_wasm()&&e.wasm_fn?this[e.name]=e.wasm_fn:this[e.name]=e.fn,this},a.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error('mathlib: only "wasm" was enabled, but it\'s not supported'));var e=this;return this.__init_promise=Promise.all(Object.keys(e.__modules).map((function(t){var r=e.__modules[t];return e.options.wasm&&e.has_wasm()&&r.wasm_fn?e.__wasm[t]?null:WebAssembly.compile(e.__base64decode(r.wasm_src)).then((function(r){e.__wasm[t]=r})):null}))).then((function(){return e})),this.__init_promise},a.prototype.__base64decode=n,a.prototype.__reallocate=function(e){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(e/65536)}),this.__memory;var t=this.__memory.buffer.byteLength;return t>2),s=0,o=0,a=0;a>16&255,n[o++]=s>>8&255,n[o++]=255&s),s=s<<6|i.indexOf(t.charAt(a));var l=r%4*6;return 0===l?(n[o++]=s>>16&255,n[o++]=s>>8&255,n[o++]=255&s):18===l?(n[o++]=s>>10&255,n[o++]=s>>2&255):12===l&&(n[o++]=s>>4&255),n}},{}],22:[function(e,t,r){var i;t.exports=function(){if(void 0!==i)return i;if(i=!1,"undefined"==typeof WebAssembly)return i;try{var e=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),t=new WebAssembly.Module(e);return 0!==new WebAssembly.Instance(t,{}).exports.test(4)&&(i=!0),i}catch(e){}return i}},{}],23:[function(e,t,r){var i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function a(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}t.exports=a()?Object.assign:function(e,t){for(var r,a,l=o(e),c=1;ce.length)&&(t=e.length);for(var r=0,i=new Array(t);r=0)}catch(e){}var A=1;"undefined"!=typeof navigator&&(A=Math.min(navigator.hardwareConcurrency||1,4));var w={tile:1024,concurrency:A,features:["js","wasm","ww"],idle:2e3,createCanvas:function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,r}},x={quality:3,alpha:!1,unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0},b=!1,S=!1,E=!1,C=!1,T=!1;function O(){return{value:h(f),destroy:function(){if(this.value.terminate(),"undefined"!=typeof window){var e=window.URL||window.webkitURL||window.mozURL||window.msURL;e&&e.revokeObjectURL&&this.value.objectURL&&e.revokeObjectURL(this.value.objectURL)}}}}function D(e){if(!(this instanceof D))return new D(e);this.options=c({},w,e||{});var t="lk_".concat(this.options.concurrency);this.__limit=v[t]||p.limiter(this.options.concurrency),v[t]||(v[t]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}D.prototype.init=function(){var t=this;if(this.__initPromise)return this.__initPromise;if("undefined"!=typeof ImageData&&"undefined"!=typeof Uint8ClampedArray)try{new ImageData(new Uint8ClampedArray(400),10,10),b=!0}catch(e){}"undefined"!=typeof ImageBitmap&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?S=!0:this.debug("ImageBitmap does not support .close(), disabled"));var r=this.options.features.slice();if(r.indexOf("all")>=0&&(r=["cib","wasm","js","ww"]),this.__requested_features=r,this.__mathlib=new u(r),r.indexOf("ww")>=0&&"undefined"!=typeof window&&"Worker"in window)try{e("webworkify")((function(){})).terminate(),this.features.ww=!0;var i="wp_".concat(JSON.stringify(this.options));v[i]?this.__workersPool=v[i]:(this.__workersPool=new d(O,this.options.idle),v[i]=this.__workersPool)}catch(e){}var n,s,o=this.__mathlib.init().then((function(e){c(t.features,e.features)}));n=S?p.cib_support(this.options.createCanvas).then((function(e){t.features.cib&&r.indexOf("cib")<0?t.debug("createImageBitmap() resize supported, but disabled by config"):r.indexOf("cib")>=0&&(t.features.cib=e)})):Promise.resolve(!1),E=p.can_use_canvas(this.options.createCanvas),s=(s=S&&b&&-1!==r.indexOf("ww")?p.worker_offscreen_canvas_support():Promise.resolve(!1)).then((function(e){C=e}));var a=p.cib_can_use_region().then((function(e){T=e}));return this.__initPromise=Promise.all([o,n,s,a]).then((function(){return t})),this.__initPromise},D.prototype.__invokeResize=function(e,t){var r=this;return t.__mathCache=t.__mathCache||{},Promise.resolve().then((function(){return r.features.ww?new Promise((function(i,n){var s=r.__workersPool.acquire();t.cancelToken&&t.cancelToken.catch((function(e){return n(e)})),s.value.onmessage=function(e){s.release(),e.data.err?n(e.data.err):i(e.data)};var o=[];e.src&&o.push(e.src.buffer),e.srcBitmap&&o.push(e.srcBitmap),s.value.postMessage({opts:e,features:r.__requested_features,preload:{wasm_nodule:r.__mathlib.__}},o)})):{data:r.__mathlib.resizeAndUnsharp(e,t.__mathCache)}}))},D.prototype.__extractTileData=function(e,t,r,i,n){if(this.features.ww&&C&&(p.isCanvas(t)||T))return this.debug("Create tile for OffscreenCanvas"),createImageBitmap(i.srcImageBitmap||t,e.x,e.y,e.width,e.height).then((function(e){return n.srcBitmap=e,n}));if(p.isCanvas(t))return i.srcCtx||(i.srcCtx=t.getContext("2d",{alpha:Boolean(r.alpha)})),this.debug("Get tile pixel data"),n.src=i.srcCtx.getImageData(e.x,e.y,e.width,e.height).data,n;this.debug("Draw tile imageBitmap/image to temporary canvas");var s=this.options.createCanvas(e.width,e.height),o=s.getContext("2d",{alpha:Boolean(r.alpha)});return o.globalCompositeOperation="copy",o.drawImage(i.srcImageBitmap||t,e.x,e.y,e.width,e.height,0,0,e.width,e.height),this.debug("Get tile pixel data"),n.src=o.getImageData(0,0,e.width,e.height).data,s.width=s.height=0,n},D.prototype.__landTileData=function(e,t,r){var i;if(this.debug("Convert raw rgba tile result to ImageData"),t.bitmap)return r.toCtx.drawImage(t.bitmap,e.toX,e.toY),null;if(b)i=new ImageData(new Uint8ClampedArray(t.data),e.toWidth,e.toHeight);else if((i=r.toCtx.createImageData(e.toWidth,e.toHeight)).data.set)i.data.set(t.data);else for(var n=i.data.length-1;n>=0;n--)i.data[n]=t.data[n];return this.debug("Draw tile"),y?r.toCtx.putImageData(i,e.toX,e.toY,e.toInnerX-e.toX,e.toInnerY-e.toY,e.toInnerWidth+1e-5,e.toInnerHeight+1e-5):r.toCtx.putImageData(i,e.toX,e.toY,e.toInnerX-e.toX,e.toInnerY-e.toY,e.toInnerWidth,e.toInnerHeight),null},D.prototype.__tileAndResize=function(e,t,r){var i=this,n={srcCtx:null,srcImageBitmap:null,isImageBitmapReused:!1,toCtx:null},s=function(t){return i.__limit((function(){if(r.canceled)return r.cancelToken;var s={width:t.width,height:t.height,toWidth:t.toWidth,toHeight:t.toHeight,scaleX:t.scaleX,scaleY:t.scaleY,offsetX:t.offsetX,offsetY:t.offsetY,quality:r.quality,alpha:r.alpha,unsharpAmount:r.unsharpAmount,unsharpRadius:r.unsharpRadius,unsharpThreshold:r.unsharpThreshold};return i.debug("Invoke resize math"),Promise.resolve(s).then((function(s){return i.__extractTileData(t,e,r,n,s)})).then((function(e){return i.debug("Invoke resize math"),i.__invokeResize(e,r)})).then((function(e){return r.canceled?r.cancelToken:(n.srcImageData=null,i.__landTileData(t,e,n))}))}))};return Promise.resolve().then((function(){if(n.toCtx=t.getContext("2d",{alpha:Boolean(r.alpha)}),p.isCanvas(e))return null;if(p.isImageBitmap(e))return n.srcImageBitmap=e,n.isImageBitmapReused=!0,null;if(p.isImage(e))return S?(i.debug("Decode image via createImageBitmap"),createImageBitmap(e).then((function(e){n.srcImageBitmap=e})).catch((function(e){return null}))):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')})).then((function(){if(r.canceled)return r.cancelToken;i.debug("Calculate tiles");var e=g({width:r.width,height:r.height,srcTileSize:i.options.tile,toWidth:r.toWidth,toHeight:r.toHeight,destTileBorder:r.__destTileBorder}).map((function(e){return s(e)}));function o(e){e.srcImageBitmap&&(e.isImageBitmapReused||e.srcImageBitmap.close(),e.srcImageBitmap=null)}return i.debug("Process tiles"),Promise.all(e).then((function(){return i.debug("Finished!"),o(n),t}),(function(e){throw o(n),e}))}))},D.prototype.__processStages=function(e,t,r,n){var s=this;if(n.canceled)return n.cancelToken;var o,a=i(e.shift(),2),l=a[0],h=a[1],u=0===e.length;return n=c({},n,{toWidth:l,toHeight:h,quality:u?n.quality:Math.min(1,n.quality)}),u||(o=this.options.createCanvas(l,h)),this.__tileAndResize(t,u?r:o,n).then((function(){return u?r:(n.width=l,n.height=h,s.__processStages(e,o,r,n))})).then((function(e){return o&&(o.width=o.height=0),e}))},D.prototype.__resizeViaCreateImageBitmap=function(e,t,r){var i=this,n=t.getContext("2d",{alpha:Boolean(r.alpha)});return this.debug("Resize via createImageBitmap()"),createImageBitmap(e,{resizeWidth:r.toWidth,resizeHeight:r.toHeight,resizeQuality:p.cib_quality_name(r.quality)}).then((function(e){if(r.canceled)return r.cancelToken;if(!r.unsharpAmount)return n.drawImage(e,0,0),e.close(),n=null,i.debug("Finished!"),t;i.debug("Unsharp result");var s=i.options.createCanvas(r.toWidth,r.toHeight),o=s.getContext("2d",{alpha:Boolean(r.alpha)});o.drawImage(e,0,0),e.close();var a=o.getImageData(0,0,r.toWidth,r.toHeight);return i.__mathlib.unsharp_mask(a.data,r.toWidth,r.toHeight,r.unsharpAmount,r.unsharpRadius,r.unsharpThreshold),n.putImageData(a,0,0),s.width=s.height=0,a=o=s=n=null,i.debug("Finished!"),t}))},D.prototype.resize=function(e,t,r){var i=this;this.debug("Start resize...");var n=c({},x);if(isNaN(r)?r&&(n=c(n,r)):n=c(n,{quality:r}),n.toWidth=t.width,n.toHeight=t.height,n.width=e.naturalWidth||e.width,n.height=e.naturalHeight||e.height,0===t.width||0===t.height)return Promise.reject(new Error("Invalid output size: ".concat(t.width,"x").concat(t.height)));n.unsharpRadius>2&&(n.unsharpRadius=2),n.canceled=!1,n.cancelToken&&(n.cancelToken=n.cancelToken.then((function(e){throw n.canceled=!0,e}),(function(e){throw n.canceled=!0,e})));var s=3;return n.__destTileBorder=Math.ceil(Math.max(s,2.5*n.unsharpRadius|0)),this.init().then((function(){if(n.canceled)return n.cancelToken;if(i.features.cib)return i.__resizeViaCreateImageBitmap(e,t,n);if(!E){var r=new Error("Pica: cannot use getImageData on canvas, make sure fingerprinting protection isn't enabled");throw r.code="ERR_GET_IMAGE_DATA",r}var s=m(n.width,n.height,n.toWidth,n.toHeight,i.options.tile,n.__destTileBorder);return i.__processStages(s,e,t,n)}))},D.prototype.resizeBuffer=function(e){var t=this,r=c({},x,e);return this.init().then((function(){return t.__mathlib.resizeAndUnsharp(r)}))},D.prototype.toBlob=function(e,t,r){return t=t||"image/png",new Promise((function(i){if(e.toBlob)e.toBlob((function(e){return i(e)}),t,r);else if(e.convertToBlob)i(e.convertToBlob({type:t,quality:r}));else{for(var n=atob(e.toDataURL(t,r).split(",")[1]),s=n.length,o=new Uint8Array(s),a=0;aclass{constructor(r=t.DefaultLoadingManager){this.manager=r,this.loader=new e(r)}};function qo(e){!function(e){var t;if(void 0!==e)for(const r of e)if(void 0!==(null===(t=r.userData)||void 0===t?void 0:t.type)){const e=r.userData.parameters;"extrudeDepth"in e||Object.assign(e,{extrudeDepth:0}),"extrudeBevelSize"in e||Object.assign(e,{extrudeBevelSize:0}),"extrudeBevelSegments"in e||Object.assign(e,{extrudeBevelSegments:1})}}(e.geometries),function(e){if(void 0!==e)for(const r of e)if(void 0!==r.quaternion){const e=(new t.Quaternion).fromArray(r.quaternion);Object.assign(r,{rotation:(new t.Euler).setFromQuaternion(e).toArray()})}}(e.interactionStates),Zo(e.object),function(e){if(void 0!==e)for(const t of e){let e=t.userData.layers.head;for(;e;){for(const t in e.uniforms){const r=`f${e.id}_tex`,i=`f${e.id}_texture`;t===r&&(e.uniforms[i]=e.uniforms[r],delete e.uniforms[r])}e=e.next}}}(e.materials)}function Zo(e){var r,i,n,s;if(void 0===(null===(r=e.userData)||void 0===r?void 0:r.type))if("OrthographicCamera"===e.type||"PerspectiveCamera"===e.type){const r=e;Object.assign(e,{objectType:"CombinedCamera",cameraType:r.type,isDefaultCamera:!0,hiddenMatrix:(new t.Matrix4).toArray(),name:"Default Camera",far:1e5,zoomOrtho:r.zoom,zoomPersp:1,nearOrtho:-5e4,nearPersp:50}),delete e.type,void 0!==r.typeCamera&&(Object.assign(e,{cameraType:r.typeCamera}),delete e.typeCamera)}else"Scene"===e.type?(Object.assign(e,{objectType:e.type}),delete e.type):"HemisphereLight"===e.type?Object.assign(e,{isDefaultAmbientLight:!0}):"DirectionalLight"===e.type&&Object.assign(e,{isDefaultDirectionalLight:!0});if(void 0!==e.userData){const r=e.userData;void 0!==r.type&&(Object.assign(e,{objectType:r.type}),delete r.type),void 0!==r.interaction&&(Object.assign(e,{interaction:r.interaction}),delete r.interaction),!0===r.isDefaultAmbientLight?(Object.assign(e,{isDefaultAmbientLight:!0}),delete r.isDefaultAmbientLight):!0===r.isDefaultDirectionalLight?(Object.assign(e,{isDefaultDirectionalLight:!0}),delete r.isDefaultDirectionalLight):!0===r.isDefaultCamera&&(Object.assign(e,{isDefaultCamera:!0}),delete r.isDefaultCamera),Object.assign(e,{raycastLock:r.lock,scaleLock:r.scaleLock,hiddenMatrix:null!==(n=null===(i=r.hiddenMatrix)||void 0===i?void 0:i.elements)&&void 0!==n?n:(new t.Matrix4).toArray()}),delete r.lock,delete r.scaleLock,delete r.hiddenMatrix,delete r.isEntity}if(void 0!==(null===(s=e.interaction)||void 0===s?void 0:s.events))for(const t of e.interaction.events)if(void 0!==t.targets)for(const e of t.targets)void 0!==e.springControls&&(Object.assign(e,{springParameters:{mass:e.springControls[0],stiffness:e.springControls[1],damping:e.springControls[2],velocity:e.springControls[3]}}),delete e.springControls);if(void 0!==e.children)for(const t of e.children)Zo(t)}function $o(e){ea(e.object,e.object)}function ea(e,t){var r;if("HemisphereLight"===e.type||!0===e.isDefaultAmbientLight?t.ambientLight=e.uuid:!0===(null===(r=e.userData)||void 0===r?void 0:r.isDefaultDirectionalLight)||!0===e.isDefaultDirectionalLight?t.directionalLight=e.uuid:!0===e.isDefaultCamera&&(t.camera=e.uuid,t.activeCamera=e.uuid,Object.assign(e,{name:"Default Camera"})),void 0!==e.children)for(const r of e.children)ea(r,t)}function ta(e){!function(e){var r,i,n,s,o,a,l;if("Scene"===e.objectType){const c=e.userData,h=null!==(r=c.rgb)&&void 0!==r?r:{r:25,g:25,b:25},u=null!==(i=c.fogColor)&&void 0!==i?i:{r:25,g:25,b:25};Object.assign(e,{color:[h.r/255,h.g/255,h.b/255],alpha:c.alpha,enableFog:c.fogEnable,fogUseBGColor:c.fogUseBGColor,fog:{color:(new t.Color).setRGB(u.r/255,u.g/255,u.b/255).getHex(),near:c.fogNear,far:c.fogFar},directionalLightState:c.directionalLightState,ambientLightState:c.ambientLightState,shadowsState:c.shadowsState,wireframeState:c.wireframeState,canvas:{mode:null!==(n=c.canvasMode)&&void 0!==n?n:1,size:{width:null!==(o=null===(s=c.canvasCustomSize)||void 0===s?void 0:s.width)&&void 0!==o?o:512,height:null!==(l=null===(a=c.canvasCustomSize)||void 0===a?void 0:a.height)&&void 0!==l?l:512}}}),delete c.rgb,delete c.alpha,delete c.fogEnable,delete c.fogUseBGColor,delete c.fogColor,delete c.fogNear,delete c.fogFar,delete c.directionalLightState,delete c.ambientLightState,delete c.shadowsState,delete c.wireframeState,delete c.canvasMode,delete c.canvasFullScreen,delete c.canvasCustomSize}}(e.object)}function ra(e,r){const i=(new t.Color).set(e);return{uuid:t.MathUtils.generateUUID(),type:"c",r:i.r,g:i.g,b:i.b,value:e,alpha:null==r?void 0:r.uuid,nodeType:"Color"}}function ia(e){return{uuid:t.MathUtils.generateUUID(),type:"f",value:e,nodeType:"Float"}}function na(e){return{uuid:t.MathUtils.generateUUID(),type:"i",value:e,nodeType:"Int"}}function sa(e){const{x:r,y:i}=e;return{uuid:t.MathUtils.generateUUID(),type:"v2",x:r,y:i,nodeType:"Vector2"}}function oa(e){const{x:r,y:i,z:n}=e;return{uuid:t.MathUtils.generateUUID(),type:"v3",x:r,y:i,z:n,nodeType:"Vector3"}}function aa(e,r){const i={uuid:t.MathUtils.generateUUID(),type:"v3",nodeType:"Blend",a:null==e?void 0:e.uuid,b:r.uuid};return"mode"in r&&(i.mode=r.mode),i}function la(e,t){const r=e.uniforms,i=e.id,n=na(r[`f${i}_mode`].value),s=ia(r[`f${i}_alpha`].value),o=ra(r[`f${i}_color`].value,s);return[o,s,n].forEach((e=>t[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${i}_color`]:o.uuid,[`f${i}_alpha`]:s.uuid,[`f${i}_mode`]:n.uuid}}),o}function ca(e,r){const i=e.uniforms,n=e.id,s=na(i[`f${n}_mode`].value),o=ia(i[`f${n}_alpha`].value),a=na(i[`f${n}_gl_type`].value),l=na(i[`f${n}_num`].value),c=(h=i[`f${n}_smooth`].value,{uuid:t.MathUtils.generateUUID(),type:"b",value:h,nodeType:"Bool"});var h;const u=function(e,r){return{uuid:t.MathUtils.generateUUID(),type:"v4[]",size:e,value:r,nodeType:"Vector4Array"}}(10,i[`f${n}_colors`].value),d=function(e,r){return{uuid:t.MathUtils.generateUUID(),type:"f[]",size:e,value:r,nodeType:"FloatArray"}}(10,i[`f${n}_steps`].value),p=sa(i[`f${n}_offset`].value),f=sa(i[`f${n}_morph`].value),m=ia(i[`f${n}_angle`].value);return[a,l,c,u,d,p,f,m,o,s].forEach((e=>r[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${n}_gl_type`]:a.uuid,[`f${n}_num`]:l.uuid,[`f${n}_smooth`]:c.uuid,[`f${n}_colors`]:u.uuid,[`f${n}_steps`]:d.uuid,[`f${n}_offset`]:p.uuid,[`f${n}_morph`]:f.uuid,[`f${n}_angle`]:m.uuid,[`f${n}_alpha`]:o.uuid,[`f${n}_mode`]:s.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"v3",nodeType:"Gradient",gl_type:a.uuid,num:l.uuid,smooth:c.uuid,colors:u.uuid,steps:d.uuid,offset:p.uuid,morph:f.uuid,angle:m.uuid,alpha:o.uuid,mode:s.uuid}}function ha(e,r){const i=e.uniforms,n=e.id,s=t.MathUtils.generateUUID(),o=na(i[`f${n}_mode`].value),a=ia(i[`f${n}_alpha`].value),l=ia(i[`f${n}_crop`].value),c=(h=0,{uuid:t.MathUtils.generateUUID(),type:"v2",index:h,nodeType:"UV"});var h;const u=(d=i[`f${n}_texture`].value,p=c,{uuid:t.MathUtils.generateUUID(),type:"v4",value:d,uv:p.uuid,project:!1,nodeType:"Texture"});var d,p;const f=function(e){return{uuid:t.MathUtils.generateUUID(),type:"m3",elements:e.elements,nodeType:"Matrix3"}}(i[`f${n}_mat`].value);return[u,c,f,l,a,o].forEach((e=>r[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${n}_texture`]:u.uuid,[`f${n}_mat`]:f.uuid,[`f${n}_crop`]:l.uuid,[`f${n}_alpha`]:a.uuid,[`f${n}_mode`]:o.uuid}}),{uuid:s,type:"v3",nodeType:"CustomTexture",texture:u.uuid,crop:l.uuid,alpha:a.uuid,mode:o.uuid}}function ua(e,r,i){const n=r.uniforms,s=r.id,o=ia(n[`f${s}_alpha`].value),a=na(n[`f${s}_mode`].value);return[o,a].forEach((e=>i[e.uuid]=e)),Object.assign(r,{uniforms:{[`f${s}_alpha`]:o.uuid,[`f${s}_mode`]:a.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"basic",nodeType:"Basic",shadingAlpha:o.uuid,shadingBlend:a.uuid}}const da=new t.Matrix4,pa=["RectangleGeometry","TriangleGeometry","PolygonGeometry","StarGeometry"];function fa(e){const r={};!function(e,t){if(void 0!==e)for(const r of e){const{beforeLayers:e,lightingLayer:i,afterLayers:n}=ga(r.userData.layers);if(!i){console.error("Material upgrade: could not find a ligthing layer");continue}const s=va(r,i,t);if(t[s.uuid]=s,e.length>0){let r=ya(e[0],t);t[r.uuid]=r;for(let i=1,n=e.length;i0){let e;for(const r of n){const i=ya(r,t),n=aa(e,i);t[n.uuid]=n,t[i.uuid]=i,e=n}s.afterColor=null==e?void 0:e.uuid}Object.assign(r,{type:"ShaderMaterial",wireframeLinecap:"",wireframeLinejoin:"",vertex:null==s?void 0:s.uuid,fragment:null==s?void 0:s.uuid}),delete r.color,delete r.emissive,delete r.specular,delete r.shininess,delete r.roughness,delete r.metalness}}(e.materials,r),function(e,t){if(void 0!==e)for(const r of e)if(r.material)if(Array.isArray(r.material))for(const e of r.material)for(const r of e.layersList)ya(r,t);else for(const e of r.material.layersList)ya(e,t)}(e.interactionStates,r),function(e,r){var i;if(void 0!==e)for(const n of e)if(n.userData&&pa.includes(null===(i=n.userData)||void 0===i?void 0:i.type)){const e=n.userData.parameters,i=e.extrudeBevelSize;if(i>0){e.width+=2*i,e.height+=2*i,e.extrudeDepth+=2*i;const s=ma(r,n.uuid);if(void 0!==s){const e=new t.Object3D;da.fromArray(s.matrix),e.applyMatrix4(da),e.position.z-=i,e.updateMatrix(),s.matrix=e.matrix.toArray()}}}}(e.geometries,e.object),r!=={}&&(e.nodes=function(e){const t=[];for(const r in e)t.push(e[r]);return t}(r))}function ma(e,t){const r=e.geometry;if(r&&r===t)return e;const i=e.children;if(i)for(let e=0,r=i.length;ei[e.uuid]=e)),Object.assign(r,{uniforms:{[`f${a}_alpha`]:h.uuid,[`f${a}_mode`]:u.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"phong",nodeType:"Phong",specular:l.uuid,shininess:c.uuid,shadingAlpha:h.uuid,shadingBlend:u.uuid}}(e,r,i),s="PhongNodeMaterial";break;case"LambertMaterial":n=function(e,r,i){var n,s;const o=r.uniforms,a=r.id,l=ra(null!==(n=e.emissive)&&void 0!==n?n:0),c=ia(null!==(s=e.emissiveIntensity)&&void 0!==s?s:1),h=ia(o[`f${a}_alpha`].value),u=na(o[`f${a}_mode`].value);return[c,l,h,u].forEach((e=>i[e.uuid]=e)),Object.assign(r,{uniforms:{[`f${a}_alpha`]:h.uuid,[`f${a}_mode`]:u.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"lambert",nodeType:"Lambert",emissiveIntensity:c.uuid,emissive:l.uuid,shadingAlpha:h.uuid,shadingBlend:u.uuid}}(e,r,i),s="LambertNodeMaterial";break;case"ToonMaterial":n=function(e,r,i){var n,s;const o=r.uniforms,a=r.id,l=ra(null!==(n=e.specular)&&void 0!==n?n:69905),c=ia(null!==(s=e.shininess)&&void 0!==s?s:30),h=ia(o[`f${a}_alpha`].value),u=na(o[`f${a}_mode`].value);return[l,c,h,u].forEach((e=>i[e.uuid]=e)),Object.assign(r,{uniforms:{[`f${a}_alpha`]:h.uuid,[`f${a}_mode`]:u.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"toon",nodeType:"Toon",specular:l.uuid,shininess:c.uuid,shadingAlpha:h.uuid,shadingBlend:u.uuid}}(e,r,i),s="ToonNodeMaterial";break;case"PhysicalMaterial":n=function(e,r,i){var n,s,o;const a=r.uniforms,l=r.id,c=ia(null!==(n=e.roughness)&&void 0!==n?n:.3),h=ia(null!==(s=e.metalness)&&void 0!==s?s:0),u=ia(null!==(o=e.reflectivity)&&void 0!==o?o:.5),d=ia(a[`f${l}_alpha`].value),p=na(a[`f${l}_mode`].value);return[c,h,u,d,p].forEach((e=>i[e.uuid]=e)),Object.assign(r,{uniforms:{[`f${l}_alpha`]:d.uuid,[`f${l}_mode`]:p.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"standard",nodeType:"Standard",roughness:c.uuid,metalness:h.uuid,reflectivity:u.uuid,shadingAlpha:d.uuid,shadingBlend:p.uuid}}(e,r,i),s="StandardNodeMaterial";break;default:console.warn(`Material upgrade: could not find a properly material node to ${e.userData.type}`),n=ua(0,r,i),s="BasicNodeMaterial"}return Object.assign(e.userData,{nodeType:s}),n}function ya(e,r){switch(e.type){case"light":return function(e,r){const i=e.uniforms,n=e.id,s=ia(i[`f${n}_alpha`].value),o=na(i[`f${n}_mode`].value);return[s,o].forEach((e=>r[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${n}_alpha`]:s.uuid,[`f${n}_mode`]:o.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"v3",nodeType:"CustomTexture",alpha:s.uuid,mode:o.uuid}}(e,r);case"color":return la(e,r);case"depth":return function(e,r){const i=e.uniforms,n=e.id,s=na(i[`f${n}_mode`].value),o=ia(i[`f${n}_alpha`].value),a=ia(i[`f${n}_near`].value),l=ia(i[`f${n}_far`].value),c=ia(i[`f${n}_isVector`].value),h=oa(i[`f${n}_origin`].value),u=ra(i[`f${n}_colorA`].value),d=ra(i[`f${n}_colorB`].value);return[a,l,c,h,u,d,o,s].forEach((e=>r[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${n}_near`]:a.uuid,[`f${n}_far`]:l.uuid,[`f${n}_isVector`]:c.uuid,[`f${n}_origin`]:h.uuid,[`f${n}_colorA`]:u.uuid,[`f${n}_colorB`]:d.uuid,[`f${n}_alpha`]:o.uuid,[`f${n}_mode`]:s.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"v3",nodeType:"Depth",near:a.uuid,far:l.uuid,isVector:c.uuid,origin:h.uuid,colorA:u.uuid,colorB:d.uuid,alpha:o.uuid,mode:s.uuid}}(e,r);case"fresnel":return function(e,r){const i=e.uniforms,n=e.id,s=na(i[`f${n}_mode`].value),o=ia(i[`f${n}_alpha`].value),a=ra(i[`f${n}_color`].value),l=ia(i[`f${n}_bias`].value),c=ia(i[`f${n}_scale`].value),h=ia(i[`f${n}_intensity`].value),u=ia(i[`f${n}_factor`].value);return[a,l,c,h,u,o,s].forEach((e=>r[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${n}_color`]:a.uuid,[`f${n}_bias`]:l.uuid,[`f${n}_scale`]:c.uuid,[`f${n}_intensity`]:h.uuid,[`f${n}_factor`]:u.uuid,[`f${n}_alpha`]:o.uuid,[`f${n}_mode`]:s.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"v3",nodeType:"Fresnel",color:a.uuid,bias:l.uuid,scale:c.uuid,intensity:h.uuid,factor:u.uuid,alpha:o.uuid,mode:s.uuid}}(e,r);case"gradient":return ca(e,r);case"noise":return function(e,r){const i=e.uniforms,n=e.id,s=na(i[`f${n}_mode`].value),o=ia(i[`f${n}_alpha`].value),a=ia(i[`f${n}_scale`].value),l=ia(i[`f${n}_move`].value),c=sa(i[`f${n}_fA`].value),h=sa(i[`f${n}_fB`].value),u=sa(i[`f${n}_distortion`].value),d=ra(i[`f${n}_colorA`].value),p=ra(i[`f${n}_colorB`].value),f=ra(i[`f${n}_colorC`].value),m=ra(i[`f${n}_colorD`].value),g=na(i[`f${n}_intA`].value),v=na(i[`f${n}_intB`].value),y=na(i[`f${n}_intC`].value),A=na(i[`f${n}_intD`].value);return[a,l,c,h,u,d,p,f,m,g,v,y,A,o,s].forEach((e=>r[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${n}_scale`]:a.uuid,[`f${n}_move`]:l.uuid,[`f${n}_fA`]:c.uuid,[`f${n}_fB`]:h.uuid,[`f${n}_distortion`]:u.uuid,[`f${n}_colorA`]:d.uuid,[`f${n}_colorB`]:p.uuid,[`f${n}_colorC`]:f.uuid,[`f${n}_colorD`]:m.uuid,[`f${n}_intA`]:g.uuid,[`f${n}_intB`]:v.uuid,[`f${n}_intC`]:y.uuid,[`f${n}_intD`]:A.uuid,[`f${n}_alpha`]:o.uuid,[`f${n}_mode`]:s.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"v3",nodeType:"Noise",scale:a.uuid,move:l.uuid,fA:c.uuid,fB:h.uuid,distortion:u.uuid,colorA:d.uuid,colorB:p.uuid,colorC:f.uuid,colorD:m.uuid,intA:g.uuid,intB:v.uuid,intC:y.uuid,intD:A.uuid,alpha:o.uuid,mode:s.uuid}}(e,r);case"normal":return function(e,r){const i=e.uniforms,n=e.id,s=na(i[`f${n}_mode`].value),o=ia(i[`f${n}_alpha`].value),a=oa(i[`f${n}_cnormal`].value);return[a,o,s].forEach((e=>r[e.uuid]=e)),Object.assign(e,{uniforms:{[`f${n}_cnormal`]:a.uuid,[`f${n}_alpha`]:o.uuid,[`f${n}_mode`]:s.uuid}}),{uuid:t.MathUtils.generateUUID(),type:"v3",nodeType:"CustomNormal",cnormal:a.uuid,alpha:o.uuid,mode:s.uuid}}(e,r);case"texture":return ha(e,r);default:return console.warn(`Material upgrade: could not find a properly "layer" node to ${e.type}`),la(e,r)}}function Aa(e){const t=e.metadata;return console.info(`File format version ${null==t?void 0:t.version}`),void 0===(null==t?void 0:t.version)?(console.warn("Unknow file version"),!1):((t.version<=1.1||4.5===t.version)&&(qo(e),t.version=1.2,console.warn("File upgraded from v1.1 or inferior to v1.2")),1.2===t.version&&($o(e),t.version=1.3,console.warn("File upgraded from v1.2 to v1.3")),1.3===t.version&&(ta(e),t.version=1.4,console.warn("File upgraded from v1.3 to v1.4")),1.4===t.version&&(fa(e),t.version=1.5,console.warn("File upgraded from v1.4 to v1.5")),!0)}class wa extends jn{constructor(e=We.create({}),t=new Or){super(e,t),this.objectType="SubdivObject",this.resized=!1,this.addToCheckpoints=!1,this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1,this.subdivPointer=We.activeSubdivPtr}toJSON(e){const t=super.toJSON(e);return t.object.objectType="SubdivObject",t}updateGeometry(e){const t=this.geometry,r=Xe[t.userData.type],i="SubdivObject"===this.objectType?Object.assign({},t.userData,{geometry:t,subdivPointer:this.subdivPointer,smoothShading:this.smoothShading}):t.userData,n=r.build(r.normalizeInputs(e,i));this.geometry.dispose(),this.geometry=n}clone(e){var t,r;const i=this.material.clone(),n=We.clone(Object.assign({},this.geometry.userData.parameters),this.subdivPointer,this.smoothShading),s=null!==(t=this.geometry.originalGeometry)&&void 0!==t?t:this.geometry;return(null!==(r=n.originalGeometry)&&void 0!==r?r:n).boundingSphere=s.boundingSphere.clone(),this.subdivPointer=We.activeSubdivPtr,new wa(n,i).copy(this,e)}}var xa;!function(e){e.EQUAL="==",e.NOT_EQUAL="!=",e.GREATER=">",e.GREATER_EQUAL=">=",e.LESS="<",e.LESS_EQUAL="<=",e.AND="&&",e.OR="||"}(xa||(xa={}));class ba extends dt{constructor(e=new ut,t=new ut,r=ba.GREATER,i=new ut,n=new ut){super(),this.nodeType="Cond",this.a=e,this.b=t,this.op=r,this.ifNode=i,this.elseNode=n}getType(e){if(this.ifNode){const t=this.ifNode.getType(e),r=this.elseNode.getType(e);return e.getTypeLength(r)>e.getTypeLength(t)?r:t}return"b"}getCondType(e){return e.getTypeLength(this.b.getType(e))>e.getTypeLength(this.a.getType(e))?this.b.getType(e):this.a.getType(e)}generate(e,t){const r=this.getType(e),i=this.getCondType(e),n=this.a.build(e,i),s=this.b.build(e,i);let o;if(this.type=r,this.ifNode){const t=this.ifNode.build(e,r),i=this.elseNode.build(e,r);o="( "+[n,this.op,s,"?",t,":",i].join(" ")+" )"}else o="( "+n+" "+this.op+" "+s+" )";return e.format(o,this.getType(e),t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.op=e.op,this.ifNode.copy(e.ifNode),this.elseNode.copy(e.elseNode),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,t.b=this.b.toJSON(e).uuid,t.op=this.op,this.ifNode&&(t.ifNode=this.ifNode.toJSON(e).uuid),this.elseNode&&(t.elseNode=this.elseNode.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.op&&(this.op=e.op),e.ifNode&&(this.ifNode=t.getNode(e.ifNode)),e.elseNode&&(this.elseNode=t.getNode(e.elseNode)),this}}ba.EQUAL=xa.EQUAL,ba.NOT_EQUAL=xa.NOT_EQUAL,ba.GREATER=xa.GREATER,ba.GREATER_EQUAL=xa.GREATER_EQUAL,ba.LESS=xa.LESS,ba.LESS_EQUAL=xa.LESS_EQUAL,ba.AND=xa.AND,ba.OR=xa.OR;const Sa={Int:vt,Float:gt,Bool:yt,Vector2:At,Vector3:wt,Vector4:rr,Matrix3:Rt,Matrix4:class extends pt{constructor(e){super("m4"),this.nodeType="Matrix4",this.value=null!=e?e:new t.Matrix4}generateReadonly(e,t,r,i,n,s){return e.format("mat4("+this.value.elements.join(", ")+")",i,t)}copy(e){return super.copy(e),this.elements=e.elements,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.elements=this.value.elements.concat()),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.elements&&(this.elements=e.elements),this}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}},FloatArray:bt,Vector4Array:xt,Normal:hr,Position:ur,Reflect:dr,UV:Et,Attribute:class extends dt{constructor(e="",t){super(t),this.nodeType="Attribute",this.name=e}getAttributeType(e){return"number"==typeof this.type?e.getConstructorFromLength(this.type):this.type}getType(e){const t=this.getAttributeType(e);return e.getTypeByFormat(t)}generate(e,t,r,i,n){i=this.getAttributeType(e);const s=e.getAttribute(this.name,i),o=e.isShader("vertex")?this.name:s.varying.name;return e.format(o,this.getType(e),t)}toJSON(e){const t=super.toJSON(e);return t.nodeType=this.nodeType,t.name=this.name,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),e.name&&(this.name=e.name),this}},Const:Mt,Struct:sr,Varying:class extends ut{constructor(e="",t=0){super(e),this.nodeType="Varying",this.value=t}getType(e){return e.getTypeByFormat(this.type)}generate(e,t,r,i,n){const s=e.getVar(this.uuid,this.type);return this.value&&e.isShader("vertex")&&e.addNodeCode(s.name+" = "+this.value.build(e,this.getType(e))+";"),e.format(s.name,this.getType(e),t)}copy(e){return super.copy(e),this.value=e.value,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.value&&(t.value=this.value)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=e.value),this}},SpecularMIPLevel:Pr,MaxMIPLevel:Ir,ColorSpace:Nt,Noise:Wt,TextureCubeUV:cr,TextureCube:pr,Operator:Xt,Math:lr,Cond:ba,Fresnel:kt,Rainbow:jt,Depth:qt,Blend:Kt,Raw:wr,CubeTexture:fr,Texture:Pt,CustomTexture:zt,VertexDisplacement:Yt,CustomNormal:Vt,Gradient:Ht,Matcap:Zt,Expression:_t,Color:mt,Phong:Cr,Basic:br,Lambert:Dr,Standard:Rr,Toon:Nr};class Ea{constructor(){this._nodes={},this._dataNodes={},this._textures={},this.uuid=t.MathUtils.generateUUID()}init(e,t){this._dataNodes=e,this._textures=t}clear(){this._nodes={},this._dataNodes={},this._textures={}}getNode(e){let t=this._nodes[e];return t||(t=this.createNode(e)),t}getNodeData(e){return this._dataNodes[e]}getTexture(e){const t=this._textures[e];if(!t)throw new Error("This texture does not exist in the library "+e);return t}createNode(e){const t=this._dataNodes[e];if(!t)throw new Error("Failed to create Node from uuid: "+e+", its data does not seem to exist");const r=Sa[t.nodeType];if(!r)throw new Error("Failed to create Node from uuid: "+e+" and nodeType: "+t.nodeType+", constructor for this not is not registered");const i=(new r).fromJSON(t,this);return this._nodes[e]=i,i}}class Ca{constructor(){this._buffers=[]}parse(e){var r;const i=new t.BufferGeometry;if(this._vertexData=e.vertexData,this._loadBuffers(this._vertexData.buffers),i.uuid=e.uuid,this._vertexData.accessors)for(let e=0,t=this._vertexData.accessors.length;e=2.0 are supported.")));const c=new bl(l,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===a[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,n)}}function Ma(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const _a={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class Na{constructor(e){this.parser=e,this.name=_a.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s,o)}}class za{constructor(e){this.parser=e,this.name=_a.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;const s=n.extensions[t],o=i.images[s.source];let a=r.textureLoader;if(o.uri){const e=r.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(n){if(n)return r.loadTextureImage(e,o,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class ka{constructor(e){this.name=_a.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,n.ready]).then((function(t){const r=e.byteOffset||0,i=e.byteLength||0,s=e.count,o=e.byteStride,a=new ArrayBuffer(s*o),l=new Uint8Array(t[0],r,i);return n.decodeGltfBuffer(new Uint8Array(a),s,o,l,e.mode,e.filter),a}))}return null}}const Ga="glTF",ja=1313821514,Va=5130562;class Ha{constructor(e){this.name=_a.KHR_BINARY_GLTF,this.content=null,this.body=null;const r=new DataView(e,0,12);if(this.header={magic:t.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==Ga)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,n=new DataView(e,12);let s=0;for(;s",r).replace("#include ",i).replace("#include ",n).replace("#include ",s).replace("#include ",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(e){a.specular.value=e}},specularMap:{get:function(){return a.specularMap.value},set:function(e){a.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(e){a.glossiness.value=e}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(e){a.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class Wa{constructor(){this.name=_a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return Ya}extendParams(e,r,i){const n=r.extensions[this.name];e.color=new t.Color(1,1,1),e.opacity=1;const s=[];if(Array.isArray(n.diffuseFactor)){const t=n.diffuseFactor;e.color.fromArray(t),e.opacity=t[3]}if(void 0!==n.diffuseTexture&&s.push(i.assignTexture(e,"map",n.diffuseTexture)),e.emissive=new t.Color(0,0,0),e.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,e.specular=new t.Color(1,1,1),Array.isArray(n.specularFactor)&&e.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){const t=n.specularGlossinessTexture;s.push(i.assignTexture(e,"glossinessMap",t)),s.push(i.assignTexture(e,"specularMap",t))}return Promise.all(s)}createMaterial(e){const r=new Ya(e);return r.fog=!0,r.color=e.color,r.map=void 0===e.map?null:e.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===e.aoMap?null:e.aoMap,r.aoMapIntensity=1,r.emissive=e.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,r.bumpMap=void 0===e.bumpMap?null:e.bumpMap,r.bumpScale=1,r.normalMap=void 0===e.normalMap?null:e.normalMap,r.normalMapType=t.TangentSpaceNormalMap,e.normalScale&&(r.normalScale=e.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===e.specularMap?null:e.specularMap,r.specular=e.specular,r.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,r.glossiness=e.glossiness,r.alphaMap=null,r.envMap=void 0===e.envMap?null:e.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}class Xa{constructor(){this.name=_a.KHR_MESH_QUANTIZATION}}class Ka extends t.Interpolant{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i*3+i;for(let e=0;e!==i;e++)t[e]=r[n+e];return t}}Ka.prototype.beforeStart_=Ka.prototype.copySampleValue_,Ka.prototype.afterEnd_=Ka.prototype.copySampleValue_,Ka.prototype.interpolate_=function(e,t,r,i){const n=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-t,h=(r-t)/c,u=h*h,d=u*h,p=e*l,f=p-l,m=-2*d+3*u,g=d-u,v=1-m,y=g-u+h;for(let e=0;e!==o;e++){const t=s[f+e+o],r=s[f+e+a]*c,i=s[p+e+o],l=s[p+e]*c;n[e]=v*t+y*r+m*i+g*l}return n};const qa=0,Za=1,$a=2,el=3,tl=4,rl=5,il=6,nl={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},sl={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},ol={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},al={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ll={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},cl={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},hl={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},ul="OPAQUE",dl="MASK",pl="BLEND";function fl(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function ml(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),e.DefaultMaterial}function gl(e,t,r){for(const i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function vl(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function yl(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,i=t.weights.length;r=2&&f.setY(t,u[e*o+1]),o>=3&&f.setZ(t,u[e*o+2]),o>=4&&f.setW(t,u[e*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f}))}loadTexture(e){const t=this.json,r=this.options,i=t.textures[e],n=t.images[i.source];let s=this.textureLoader;if(n.uri){const e=r.manager.getHandler(n.uri);null!==e&&(s=e)}return this.loadTextureImage(e,n,s)}loadTextureImage(e,r,i){const n=this,s=this.json,o=this.options,a=s.textures[e],l=(r.uri||r.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=self.URL||self.webkitURL;let h=r.uri||"",u=!1,d=!0;const p=h.search(/\.jpe?g($|\?)/i)>0||0===h.search(/^data\:image\/jpeg/);if(("image/jpeg"===r.mimeType||p)&&(d=!1),void 0!==r.bufferView)h=n.getDependency("bufferView",r.bufferView).then((function(e){if("image/png"===r.mimeType){const t=new DataView(e,25,1).getUint8(0,!1);d=6===t||4===t||3===t}u=!0;const t=new Blob([e],{type:r.mimeType});return h=c.createObjectURL(t),h}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const f=Promise.resolve(h).then((function(e){return new Promise((function(r,n){let s=r;!0===i.isImageBitmapLoader&&(s=function(e){const i=new t.Texture(e);i.needsUpdate=!0,r(i)}),i.load(fl(e,o.path),s,void 0,n)}))})).then((function(r){!0===u&&c.revokeObjectURL(h),r.flipY=!1,a.name&&(r.name=a.name),d||(r.format=t.RGBFormat);const i=(s.samplers||{})[a.sampler]||{};return r.magFilter=sl[i.magFilter]||t.LinearFilter,r.minFilter=sl[i.minFilter]||t.LinearMipmapLinearFilter,r.wrapS=ol[i.wrapS]||t.RepeatWrapping,r.wrapT=ol[i.wrapT]||t.RepeatWrapping,n.associations.set(r,{type:"textures",index:e}),r})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",h),null}));return this.textureCache[l]=f,f}assignTexture(e,t,r){const i=this;return this.getDependency("texture",r.index).then((function(n){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),i.extensions[_a.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[_a.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=i.associations.get(n);n=i.extensions[_a.KHR_TEXTURE_TRANSFORM].extendTexture(n,e),i.associations.set(n,t)}}return e[t]=n,n}))}assignFinalMaterial(e){const r=e.geometry;let i=e.material;const n=void 0!==r.attributes.tangent,s=void 0!==r.attributes.color,o=void 0===r.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+i.uuid;let r=this.cache.get(e);r||(r=new t.PointsMaterial,t.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(e,r)),i=r}else if(e.isLine){const e="LineBasicMaterial:"+i.uuid;let r=this.cache.get(e);r||(r=new t.LineBasicMaterial,t.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(e,r)),i=r}if(n||s||o){let e="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(e+="specular-glossiness:"),n&&(e+="vertex-tangents:"),s&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=i.clone(),s&&(t.vertexColors=!0),o&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(i))),i=t}i.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),e.material=i}getMaterialType(){return t.MeshStandardMaterial}loadMaterial(e){const r=this,i=this.json,n=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[_a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const e=n[_a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];o=e.getMaterialType(),c.push(e.extendParams(a,s,r))}else if(l[_a.KHR_MATERIALS_UNLIT]){const e=n[_a.KHR_MATERIALS_UNLIT];o=e.getMaterialType(),c.push(e.extendParams(a,s,r))}else{const i=s.pbrMetallicRoughness||{};if(a.color=new t.Color(1,1,1),a.opacity=1,Array.isArray(i.baseColorFactor)){const e=i.baseColorFactor;a.color.fromArray(e),a.opacity=e[3]}void 0!==i.baseColorTexture&&c.push(r.assignTexture(a,"map",i.baseColorTexture)),a.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,a.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(c.push(r.assignTexture(a,"metalnessMap",i.metallicRoughnessTexture)),c.push(r.assignTexture(a,"roughnessMap",i.metallicRoughnessTexture))),o=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)}))))}!0===s.doubleSided&&(a.side=t.DoubleSide);const h=s.alphaMode||ul;return h===pl?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===dl&&(a.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&o!==t.MeshBasicMaterial&&(c.push(r.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new t.Vector2(1,-1),void 0!==s.normalTexture.scale&&a.normalScale.set(s.normalTexture.scale,-s.normalTexture.scale)),void 0!==s.occlusionTexture&&o!==t.MeshBasicMaterial&&(c.push(r.assignTexture(a,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(a.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&o!==t.MeshBasicMaterial&&(a.emissive=(new t.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&o!==t.MeshBasicMaterial&&c.push(r.assignTexture(a,"emissiveMap",s.emissiveTexture)),Promise.all(c).then((function(){let i;return i=o===Ya?n[_a.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new o(a),s.name&&(i.name=s.name),i.map&&(i.map.encoding=t.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=t.sRGBEncoding),vl(i,s),r.associations.set(i,{type:"materials",index:e}),s.extensions&&gl(n,i,s),i}))}createUniqueName(e){const r=t.PropertyBinding.sanitizeNodeName(e||"");let i=r;for(let e=1;this.nodeNamesUsed[i];++e)i=r+"_"+e;return this.nodeNamesUsed[i]=!0,i}loadGeometries(e){const r=this,i=this.extensions,n=this.primitiveCache;function s(e){return i[_a.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return El(t,e,r)}))}const o=[];for(let i=0,a=e.length;i0&&yl(d,s),d.name=r.createUniqueName(s.name||"mesh_"+e),vl(d,s),u.extensions&&gl(n,d,u),r.assignFinalMaterial(d),c.push(d)}if(1===c.length)return c[0];const h=new t.Group;for(let e=0,t=c.length;e1?new t.Group:1===r.length?r[0]:new t.Object3D,a!==r[0])for(let e=0,t=r.length;e{const t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(n)}),i,n)}decodeDracoFile(e,t,r,i){const n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){for(const e in t.attributeTypes){const r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}const r=JSON.stringify(t);if(Tl.has(e)){const t=Tl.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const n=this.workerNextTaskID++,s=e.byteLength,o=this._getWorker(n,s).then((r=>(i=r,new Promise(((r,s)=>{i._callbacks[n]={resolve:r,reject:s},i.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&n&&this._releaseTask(i,n)})),Tl.set(e,{key:r,promise:o}),o}_createGeometry(e){const r=new t.BufferGeometry;e.index&&r.setIndex(new t.BufferAttribute(e.index.array,1));for(let i=0;i{i.load(e,t,void 0,r)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=Dl.toString(),n=["/* draco decoder */",r,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e{const t=e.draco,o=new t.Decoder,a=new t.DecoderBuffer;a.Init(new Int8Array(i),i.byteLength);try{const e=function(e,t,i,n){const s=n.attributeIDs,o=n.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeBufferToMesh(i,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeBufferToPointCloud(i,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,u;if(n.useUniqueIDs)u=s[i],c=t.GetAttributeByUniqueId(a,u);else{if(u=t.GetAttributeId(a,e[s[i]]),-1===u)continue;c=t.GetAttribute(a,u)}h.attributes.push(r(e,t,a,i,l,c))}c===e.TRIANGULAR_MESH&&(h.index=function(e,t,r){const i=3*r.num_faces(),n=4*i,s=e._malloc(n);t.GetTrianglesUInt32Array(r,n,s);const o=new Uint32Array(e.HEAPF32.buffer,s,i).slice();return e._free(s),{array:o,itemSize:1}}(e,t,a));return e.destroy(a),h}(t,o,a,s),i=e.attributes.map((e=>e.array.buffer));e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(a),t.destroy(o)}}))}}}var Ml="object"==typeof global&&global&&global.Object===Object&&global,_l="object"==typeof self&&self&&self.Object===Object&&self,Nl=Ml||_l||Function("return this")(),Ll=Nl.Symbol,Bl=Object.prototype,Il=Bl.hasOwnProperty,Pl=Bl.toString,Rl=Ll?Ll.toStringTag:void 0;var Fl=Object.prototype.toString;var Ul=Ll?Ll.toStringTag:void 0;function zl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ul&&Ul in Object(e)?function(e){var t=Il.call(e,Rl),r=e[Rl];try{e[Rl]=void 0;var i=!0}catch(e){}var n=Pl.call(e);return i&&(t?e[Rl]=r:delete e[Rl]),n}(e):function(e){return Fl.call(e)}(e)}function kl(e){return null!=e&&"object"==typeof e}function Gl(e){return"symbol"==typeof e||kl(e)&&"[object Symbol]"==zl(e)}function jl(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}function fc(e){return null!=e&&pc(e.length)&&!Xl(e)}var mc=Object.prototype;function gc(e){return kl(e)&&"[object Arguments]"==zl(e)}var vc=Object.prototype,yc=vc.hasOwnProperty,Ac=vc.propertyIsEnumerable,wc=gc(function(){return arguments}())?gc:function(e){return kl(e)&&yc.call(e,"callee")&&!Ac.call(e,"callee")};var xc="object"==typeof e&&e&&!e.nodeType&&e,bc=xc&&"object"==typeof module&&module&&!module.nodeType&&module,Sc=bc&&bc.exports===xc?Nl.Buffer:void 0,Ec=(Sc?Sc.isBuffer:void 0)||function(){return!1},Cc={};function Tc(e){return function(t){return e(t)}}Cc["[object Float32Array]"]=Cc["[object Float64Array]"]=Cc["[object Int8Array]"]=Cc["[object Int16Array]"]=Cc["[object Int32Array]"]=Cc["[object Uint8Array]"]=Cc["[object Uint8ClampedArray]"]=Cc["[object Uint16Array]"]=Cc["[object Uint32Array]"]=!0,Cc["[object Arguments]"]=Cc["[object Array]"]=Cc["[object ArrayBuffer]"]=Cc["[object Boolean]"]=Cc["[object DataView]"]=Cc["[object Date]"]=Cc["[object Error]"]=Cc["[object Function]"]=Cc["[object Map]"]=Cc["[object Number]"]=Cc["[object Object]"]=Cc["[object RegExp]"]=Cc["[object Set]"]=Cc["[object String]"]=Cc["[object WeakMap]"]=!1;var Oc="object"==typeof e&&e&&!e.nodeType&&e,Dc=Oc&&"object"==typeof module&&module&&!module.nodeType&&module,Mc=Dc&&Dc.exports===Oc&&Ml.process,_c=function(){try{var e=Dc&&Dc.require&&Dc.require("util").types;return e||Mc&&Mc.binding&&Mc.binding("util")}catch(e){}}(),Nc=_c&&_c.isTypedArray,Lc=Nc?Tc(Nc):function(e){return kl(e)&&pc(e.length)&&!!Cc[zl(e)]},Bc=Object.prototype.hasOwnProperty;function Ic(e,t){var r=Vl(e),i=!r&&wc(e),n=!r&&!i&&Ec(e),s=!r&&!i&&!n&&Lc(e),o=r||i||n||s,a=o?function(e,t){for(var r=-1,i=Array(e);++r-1},Kc.prototype.set=function(e,t){var r=this.__data__,i=Wc(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this};var qc=lc(Nl,"Map");function Zc(e,t){var r,i,n=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof t?"string":"hash"]:n.map}function $c(e){var t=-1,r=null==e?0:e.length;for(this.clear();++ta))return!1;var c=s.get(e),h=s.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,p=2&r?new Dh:void 0;for(s.set(e,t),s.set(t,e);++ut||s&&o&&l&&!a&&!c||i&&o&&l||!r&&l||!n)return 1;if(!i&&!s&&!c&&e=a?l:l*("desc"==r[i]?-1:1)}return e.index-t.index}(e,t,r)}))}function ru(e){let t;return e instanceof Array?(t={},e.forEach((e=>{t[e.uuid]=e}))):t=e,t}class iu extends(Ko(t.ObjectLoader)){constructor(){super(...arguments),this.path="",this.resourcePath=""}loadFromFile(e){var t;return er(this,void 0,void 0,(function*(){const r=yield function(e,t,r=Xo.ARRAY_BUFFER){const i=new FileReader;return new Promise(((n,s)=>{const o=()=>{s({error:!0,filename:e.name}),t.itemError(e.name),t.itemEnd(e.name)};switch(i.addEventListener("loadstart",(()=>{t.itemStart(e.name)})),i.addEventListener("load",(e=>{var t;const r=null===(t=e.target)||void 0===t?void 0:t.result;null!=r?n(r):o()}),!1),i.addEventListener("error",o),r){case Xo.TEXT:i.readAsText(e);break;case Xo.BINARY_STRING:if(void 0!==i.readAsBinaryString){i.readAsBinaryString(e);break}case Xo.ARRAY_BUFFER:default:i.readAsArrayBuffer(e)}}))}(e,this.manager,Xo.TEXT),{object:i,materials:n}=this.parse(JSON.parse(r));return i.name=null!==(t=e.name.split(".").shift())&&void 0!==t?t:e.name,this.manager.itemEnd(e.name),{scene:i,materials:n}}))}load(e,r,i,n){const s=""===this.path?t.LoaderUtils.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const o=new t.FileLoader(this.manager);o.setPath(this.path),o.load(e,(t=>{let i=null;try{i=JSON.parse(t)}catch(t){return void 0!==n&&n(t),console.warn(`ObjectLoader > load: can't parse ${e}.`),void console.error(t)}const s=i.metadata;void 0!==s&&void 0!==s.type&&"geometry"!==s.type.toLowerCase()?this.parse(i,r):console.error("ObjectLoader: Can't load "+e)}),i,n)}parse(e,t){var r;if(!1===Aa(e))return console.error("File can not be parser"),{object:new jo,materials:{}};const i={},n=this.parseGeometries(e.geometries),s=this.loader.parseImages(e.images,(()=>{void 0!==t&&t(h)})),o=this.parseTextures(e.textures,s),a=new Ea;a.init(ru(null!==(r=e.nodes)&&void 0!==r?r:[]),ru(o));const l=ru(this.loader.parseMaterials(e.materials,o)),c=this.customParseMaterials(l,e.materials,a),h=this.parseObject(e.object,n,c,i),u=this.parseInteractionStates(e.interactionStates,a);return this.parseInteractions(e.object,i,u),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(h),{object:h,materials:c}}parseGeometries(e){var t,r;const i={};if(void 0!==e)for(let n=0,s=e.length;n parseGeometries: error parsing geometry of type .",null===(r=s.userData)||void 0===r?void 0:r.type),console.error(e)}}return i}parseAsync(e){var t;return er(this,void 0,void 0,(function*(){if(!1===Aa(e))return console.error("File can not be parser"),new jo;const r=new Ea,i={},n=yield this.parseGeometriesAsync(e.geometries),s=this.loader.parseImages(e.images,(()=>{})),o=this.parseTextures(e.textures,s);r.init(ru(null!==(t=e.nodes)&&void 0!==t?t:[]),ru(o));const a=ru(this.loader.parseMaterials(e.materials,o)),l=this.customParseMaterials(a,e.materials,r),c=this.parseObject(e.object,n,l,i),h=this.parseInteractionStates(e.interactionStates,r);return this.parseInteractions(e.object,i,h),c}))}parseGeometriesAsync(e){var t,r;return er(this,void 0,void 0,(function*(){const i={};if(void 0!==e)for(let l=0,c=e.length;l{this.gltfLoader.parse(JSON.stringify(c.gltf),"",e)})),t=[];if(e.scene.traverse((e=>{const r=e;r.isMesh&&t.push(r.geometry)})),1===t.length)h=t[0];else{const e=(s=e=>c.gltf.meshes.findIndex((t=>{const r=t.primitives[0].attributes.POSITION;return c.gltf.accessors[r].count===e.index.count})),o=void 0,a=void 0,null==(n=t)?[]:(Vl(s)||(s=null==s?[]:[s]),Vl(o=a?void 0:o)||(o=null==o?[]:[o]),tu(n,s,o)));h=ke.mergeBufferGeometries(e,!0)}}else h=this.loader.parseGeometries([c])[c.uuid];h.userData={};const e=Object.assign({},c.userData,{geometry:h});h=Be.create(e);break;default:h=Ke(c.userData)}h.uuid=c.uuid,void 0!==c.name&&(h.name=c.name),i[c.uuid]=h}catch(e){console.warn("ObjectLoader > parseGeometries: error parsing geometry of type .",null===(r=c.userData)||void 0===r?void 0:r.type),console.error(e)}}var n,s,o,a;return i}))}parseTextures(e,t){const r=this.loader.parseTextures(e,t);return Object.keys(r).forEach((e=>{const t=(new Lt).copy(r[e]);t.uuid=e,r[e]=t})),r}customParseMaterials(e,t,r){const i={};if(void 0!==t)for(let n=0,s=t.length;n getGeometry: undefined geometry",t),e[t]}(t,e.geometry),s=function(e,t){if(void 0!==t){if(t instanceof Array){const r=[];for(let i=0,n=t.length;i getMaterial: undefined material",n),r.push(e[n])}return r}return void 0===e[t]&&console.warn("ObjectLoader > getMaterial: undefined material",t),e[t]}}(r,e.material);if(i){switch(e.objectType){case"Mesh2D":n=new ms(i,s).fromJSON(e);break;case"Mesh3D":n=new gs(i,s).fromJSON(e);break;case"NonParametric":n=new vs(i,s).fromJSON(e);break;case"TextFrame":n=new Qo(i,s),n.fromJSONasync(e).then((()=>{})).catch((()=>{}));break;case"VectorObject":n=new is(i,s).fromJSON(e);break;case"SubdivObject":n=new wa(i,s).fromJSON(e),n.subdivPointer=i.subdivPointer;break;default:return void console.warn("ObjectLoader > parseObject: unsupported object type",e.objectType)}s||(n.name+=" (Recovered)")}else n=(new os).fromJSON(e),n.name+=" (Recovered)",console.warn("An empty object is created instead")}else switch(e.objectType){case"Scene":n=(new jo).fromJSON(e);break;case"CombinedCamera":n=(new ss).fromJSON(e);break;case"LightDirectional":n=(new as).fromJSON(e);break;case"LightPoint":n=(new ls).fromJSON(e);break;case"LightSpot":n=(new ds).fromJSON(e);break;case"EmptyObject":n=(new os).fromJSON(e);break;default:if("HemisphereLight"!==e.type&&"DirectionalLight"!==e.type)return void console.warn("ObjectLoader > parseObject: unsupported object type",e.objectType);n=this.loader.parseObject(e,t,r)}if(Fn(n)&&(i[e.uuid]=n),void 0!==e.children)for(const s of e.children){const e=this.parseObject(s,t,r,i);void 0!==e&&n.add(e)}return n instanceof jo&&n.initFromObjectLoader(e),n}parseInteractionStates(e,t){const r={};if(void 0!==e)for(let i=0,n=e.length;i=0;class cu extends t.EventDispatcher{constructor(e,r){let i,n,s,o,a;super(),void 0===r&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),r===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=r,this.enabled=!0,this.useKeyEvents=!0,this.target=new t.Vector3,this.object.getTarget(this.target),this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0+1*t.MathUtils.DEG2RAD,this.maxPolarAngle=Math.PI-1*t.MathUtils.DEG2RAD,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.1,this.enableZoom=!0,this.zoomSpeed=2,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.autoRotateClockwise=!0,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:t.MOUSE.ROTATE,MIDDLE:t.MOUSE.DOLLY,RIGHT:t.MOUSE.PAN},this.touches={ONE:t.TOUCH.ROTATE,TWO:t.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return d.phi},this.getAzimuthalAngle=function(){return d.theta},this.saveState=function(){l.target0.copy(l.target),l.position0.copy(l.object.position),l.zoom0=l.object.zoom},this.reset=function(){l.target.copy(l.target0),l.object.position.copy(l.position0),l.object.zoom=l.zoom0,i=0,l.object.updateProjectionMatrix(),l.dispatchEvent(nu),l.update(),h=c.NONE},this.update=function(){const r=new t.Vector3,v=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),y=v.clone().invert(),A=new t.Vector3,w=new t.Quaternion,x=2*Math.PI;return function(){const e=l.object.position;var t;r.copy(e).sub(l.target),r.applyQuaternion(v),d.setFromVector3(r),l.autoRotate&&h===c.NONE&&(!0===l.autoRotateClockwise?M(O()):(t=O(),p.theta+=t)),l.rotationLimitsMode!==l.rotationLimitsOptions.HORIZONTAL&&(d.phi+=p.phi),l.rotationLimitsMode===l.rotationLimitsOptions.VERTICAL&&!0!==l.autoRotate||(d.theta+=p.theta),l.rotationLimitsMode!==l.rotationLimitsOptions.VERTICAL&&l.rotationLimitsMode!==l.rotationLimitsOptions.BOTH||(d.phi=Math.max(n,Math.min(s,d.phi))),l.rotationLimitsMode!==l.rotationLimitsOptions.HORIZONTAL&&l.rotationLimitsMode!==l.rotationLimitsOptions.BOTH||(i+=p.theta,i>l.rotationHorizontalOffset.max?(d.theta=a,i=l.rotationHorizontalOffset.max):i<-l.rotationHorizontalOffset.min&&(d.theta=o,i=-l.rotationHorizontalOffset.min));let b=l.minAzimuthAngle,S=l.maxAzimuthAngle;return isFinite(b)&&isFinite(S)&&(b<-Math.PI?b+=x:b>Math.PI&&(b-=x),S<-Math.PI?S+=x:S>Math.PI&&(S-=x),d.theta=b<=S?Math.max(b,Math.min(S,d.theta)):d.theta>(b+S)/2?Math.max(b,d.theta):Math.min(S,d.theta)),d.phi=Math.max(l.minPolarAngle,Math.min(l.maxPolarAngle,d.phi)),d.makeSafe(),d.radius*=f,d.radius=Math.max(l.minDistance,Math.min(l.maxDistance,d.radius)),l.target.add(m),r.setFromSpherical(d),r.applyQuaternion(y),e.copy(l.target).add(r),l.object.lookAt(l.target),!0===l.enableDamping?(p.theta*=1-l.dampingFactor,p.phi*=1-l.dampingFactor):p.set(0,0,0),m.set(0,0,0),f=1,!!(g||A.distanceToSquared(l.object.position)>u||8*(1-w.dot(l.object.quaternion))>u)&&(l.dispatchEvent(nu),g&&l.dispatchEvent(su),A.copy(l.object.position),w.copy(l.object.quaternion),g=!1,!0)}}(),this.dispose=function(){l.domElement.removeEventListener("contextmenu",se),l.domElement.removeEventListener("pointerdown",X),l.domElement.removeEventListener("wheel",$),l.domElement.removeEventListener("touchstart",re),l.domElement.removeEventListener("touchend",ne),l.domElement.removeEventListener("touchmove",ie),l.domElement.ownerDocument.removeEventListener("pointermove",K),l.domElement.ownerDocument.removeEventListener("pointerup",q),l.domElement.removeEventListener("gesturestart",z),l.domElement.removeEventListener("gesturechange",z),l.domElement.removeEventListener("gestureend",z),window.removeEventListener("keydown",ee,!1),window.removeEventListener("keyup",te,!1)},this.zoomOut=function(){I(D())},this.zoomIn=function(){P(D())},this.setEnableDampingSpeed=function(e){this.enableDamping=e,this.rotateSpeed=!0===e?.2:1},this.resetTo=function(e,t,r){l.target.copy(e),l.object.position.copy(t),l.object.zoom=r,l.object.updateProjectionMatrix(),l.dispatchEvent(nu),l.update(),h=c.NONE},this.updateTarget=function(){this.object.getTarget(this.target),this.update()},this.rotationVerticalOffset={min:.5*Math.PI,max:.5*Math.PI},this.rotationHorizontalOffset={min:.5*Math.PI,max:.5*Math.PI},this.rotationLimitsOptions={DEFAULT:0,VERTICAL:1,HORIZONTAL:2,BOTH:3},this.rotationLimitsMode=this.rotationLimitsOptions.DEFAULT,this.updateRotationOffetLimits=function(){i=0,n=hu(d.phi-l.rotationVerticalOffset.min),s=hu(d.phi+l.rotationVerticalOffset.max),n<0&&(n=l.minPolarAngle),s<0&&(s=l.maxPolarAngle),o=hu(d.theta-l.rotationHorizontalOffset.min),a=hu(d.theta+l.rotationHorizontalOffset.max)},this.toJSON=function(){const e={};return l.useKeyEvents&&(e.useKeyEvents=!0),l.enableDamping&&(e.enableDamping=!0),l.enablePan&&(e.enablePan=!0),l.enableZoom&&(e.enableZoom=!0),l.enableRotate&&(e.enableRotate=!0),e.rotationLimitsMode=l.rotationLimitsMode,l.rotationLimitsMode!==l.rotationLimitsOptions.VERTICAL&&l.rotationLimitsMode!==l.rotationLimitsOptions.BOTH||(e.rotationVerticalOffset={min:l.rotationVerticalOffset.min,max:l.rotationVerticalOffset.max}),l.rotationLimitsMode!==l.rotationLimitsOptions.HORIZONTAL&&l.rotationLimitsMode!==l.rotationLimitsOptions.BOTH||(e.rotationHorizontalOffset={min:l.rotationHorizontalOffset.min,max:l.rotationHorizontalOffset.max}),l.autoRotate&&(e.autoRotate=!0,e.autoRotateSpeed=l.autoRotateSpeed,l.autoRotateClockwise&&(e.autoRotateClockwise=!0)),e},this.fromJSON=function(e){l.useKeyEvents=!0===e.useKeyEvents,l.setEnableDampingSpeed(!0===e.enableDamping),l.enablePan=!0===e.enablePan,l.enableZoom=!0===e.enableZoom,l.enableRotate=!0===e.enableRotate,void 0!==e.rotationLimitsMode&&(l.rotationLimitsMode=e.rotationLimitsMode),e.rotationVerticalOffset&&(l.rotationVerticalOffset={min:e.rotationVerticalOffset.min,max:e.rotationVerticalOffset.max}),e.rotationHorizontalOffset&&(l.rotationHorizontalOffset={min:e.rotationHorizontalOffset.min,max:e.rotationHorizontalOffset.max}),l.autoRotate=!0===e.autoRotate,e.autoRotateSpeed&&(l.autoRotateSpeed=e.autoRotateSpeed),l.autoRotateClockwise=!0===e.autoRotateClockwise,l.updateRotationOffetLimits()};const l=this,c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=c.NONE;const u=1e-6,d=new t.Spherical,p=new t.Spherical;let f=1;const m=new t.Vector3;let g=!1;const v=new t.Vector2,y=new t.Vector2,A=new t.Vector2,w=new t.Vector2,x=new t.Vector2,b=new t.Vector2,S=new t.Vector2,E=new t.Vector2,C=new t.Vector2;let T={};function O(){return 2*Math.PI/60/60*l.autoRotateSpeed}function D(){return Math.pow(.95,l.zoomSpeed)}function M(e){p.theta-=e}function _(e){p.phi-=e}const N=function(){const e=new t.Vector3;return function(t,r){e.setFromMatrixColumn(r,0),e.multiplyScalar(-t),m.add(e)}}(),L=function(){const e=new t.Vector3;return function(t,r){!0===l.screenSpacePanning?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(l.object.up,e)),e.multiplyScalar(t),m.add(e)}}(),B=function(){const e=new t.Vector3;return function(t,r){const i=l.domElement;if(l.object.isPerspectiveCamera){const n=l.object.position;e.copy(n).sub(l.target);let s=e.length();s*=Math.tan(l.object.fov/2*Math.PI/180),N(2*t*s/i.clientHeight,l.object.matrix),L(2*r*s/i.clientHeight,l.object.matrix)}else l.object.isOrthographicCamera?(N(t*(l.object.right-l.object.left)/l.object.zoom/i.clientWidth,l.object.matrix),L(r*(l.object.top-l.object.bottom)/l.object.zoom/i.clientHeight,l.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),l.enablePan=!1)}}();function I(e){l.object.isPerspectiveCamera?f/=e:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom*e)),l.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function P(e){l.object.isPerspectiveCamera?f*=e:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom/e)),l.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function R(e){v.set(e.clientX,e.clientY)}function F(e){w.set(e.clientX,e.clientY)}let U=0;function z(e){if(e.preventDefault(),"gesturechange"===e.type){if(!1===l.enableZoom)return;e.scale>U?P(D()):e.scale0?I(D()):C.y<0&&P(D()),S.copy(E),l.update()}(e);break;case c.PAN:if(!1===l.enablePan)return;!function(e){x.set(e.clientX,e.clientY),b.subVectors(x,w).multiplyScalar(l.panSpeed),B(b.x,b.y),w.copy(x),l.update()}(e)}}(e)}}function q(e){switch(e.pointerType){case"mouse":case"pen":Z()}}function Z(e){l.domElement.ownerDocument.removeEventListener("pointermove",K),l.domElement.ownerDocument.removeEventListener("pointerup",q),!1!==l.enabled&&(l.dispatchEvent(au),h=c.NONE)}function $(e){!1===l.enabled||!1===l.enableZoom||h!==c.NONE&&h!==c.ROTATE||(e.preventDefault(),l.dispatchEvent(ou),function(e){if(j){if(!1===G||(lu?e.metaKey:e.ctrlKey)){if(!1===l.enableZoom)return;e.deltaY<0?P(D()):e.deltaY>0&&I(D())}else{if(!1===l.enablePan)return;b.set(-e.deltaX,-e.deltaY).multiplyScalar(l.panSpeed),e.altKey?B(0,b.y):e.shiftKey?B(b.x,0):B(b.x,b.y)}l.update()}else j=!0,G=function(e){return e.wheelDeltaY?e.wheelDeltaY===-3*e.deltaY:0===e.deltaMode}(e);k&&window.clearTimeout(k),k=window.setTimeout((()=>{j=!1,G=void 0}),200)}(e),l.dispatchEvent(au))}function ee(e){!1!==l.enabled&&(T=e)}function te(){!1!==l.enabled&&(T={},h!==c.NONE&&Z(new PointerEvent("pointerover")))}function re(e){if(!1!==l.enabled){switch(e.preventDefault(),e.touches.length){case 1:switch(l.touches.ONE){case t.TOUCH.ROTATE:if(!1===l.enableRotate)return;V(e),h=c.TOUCH_ROTATE;break;case t.TOUCH.PAN:if(!1===l.enablePan)return;H(e),h=c.TOUCH_PAN;break;default:h=c.NONE}break;case 2:switch(l.touches.TWO){case t.TOUCH.DOLLY_PAN:if(!1===l.enableZoom&&!1===l.enablePan)return;!function(e){l.enableZoom&&J(e),l.enablePan&&H(e)}(e),h=c.TOUCH_DOLLY_PAN;break;case t.TOUCH.DOLLY_ROTATE:if(!1===l.enableZoom&&!1===l.enableRotate)return;!function(e){l.enableZoom&&J(e),l.enableRotate&&V(e)}(e),h=c.TOUCH_DOLLY_ROTATE;break;default:h=c.NONE}break;default:h=c.NONE}h!==c.NONE&&l.dispatchEvent(ou)}}function ie(e){if(!1!==l.enabled)switch(e.preventDefault(),h){case c.TOUCH_ROTATE:if(!1===l.enableRotate)return;Q(e),l.update();break;case c.TOUCH_PAN:if(!1===l.enablePan)return;Y(e),l.update();break;case c.TOUCH_DOLLY_PAN:if(!1===l.enableZoom&&!1===l.enablePan)return;!function(e){l.enableZoom&&W(e),l.enablePan&&Y(e)}(e),l.update();break;case c.TOUCH_DOLLY_ROTATE:if(!1===l.enableZoom&&!1===l.enableRotate)return;!function(e){l.enableZoom&&W(e),l.enableRotate&&Q(e)}(e),l.update();break;default:h=c.NONE}}function ne(e){!1!==l.enabled&&(l.dispatchEvent(au),h=c.NONE)}function se(e){!1!==l.enabled&&e.preventDefault()}l.domElement.addEventListener("contextmenu",se),l.domElement.addEventListener("pointerdown",X),l.domElement.addEventListener("wheel",$,{passive:!1}),l.domElement.addEventListener("touchstart",re,{passive:!1}),l.domElement.addEventListener("touchend",ne),l.domElement.addEventListener("touchmove",ie,{passive:!1}),l.domElement.addEventListener("gesturestart",z),l.domElement.addEventListener("gesturechange",z),l.domElement.addEventListener("gestureend",z),window.addEventListener("keydown",ee,!1),window.addEventListener("keyup",te,!1),this.update(),this.updateRotationOffetLimits(),this.setEnableDampingSpeed(!0)}}function hu(e){const t=2*Math.PI;for(;e<=-Math.PI;)e+=t;for(;e>Math.PI;)e-=t;return e}class uu{constructor(e,r,i,n,s){this._aspect=1,this._renderer=e,this._camera=r,this._frameSize=(new t.Vector2).copy(i),this._editorSize=(new t.Vector2).copy(n),this._fov=null!=s?s:r.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){this._renderer&&this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer)return;if(!this._camera)return;if("PerspectiveCamera"!==this._camera.cameraType)return;const e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y;let n=0,s=0,o=e,a=t;ei){n*=r/i,n*=1-((r-(e=1080))/(2160-e)*(15-(t=1))+t)/100}this._camera.aspect=this._aspect,this._camera.fov=n,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){const e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}}var du=/^\s+|\s+$/g,pu=/^[-+]0x[0-9a-f]+$/i,fu=/^0b[01]+$/i,mu=/^0o[0-7]+$/i,gu=parseInt,vu="object"==typeof Yo&&Yo&&Yo.Object===Object&&Yo,yu="object"==typeof self&&self&&self.Object===Object&&self,Au=vu||yu||Function("return this")(),wu=Object.prototype.toString,xu=Math.max,bu=Math.min,Su=function(){return Au.Date.now()};function Eu(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Cu(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==wu.call(e)}(e))return NaN;if(Eu(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Eu(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(du,"");var r=fu.test(e);return r||mu.test(e)?gu(e.slice(2),r?2:8):pu.test(e)?NaN:+e}var Tu,Ou,Du=function(e,t,r){var i,n,s,o,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=i,s=n;return i=n=void 0,c=t,o=e.apply(s,r)}function f(e){return c=e,a=setTimeout(g,t),h?p(e):o}function m(e){var r=e-l;return void 0===l||r>=t||r<0||u&&e-c>=s}function g(){var e=Su();if(m(e))return v(e);a=setTimeout(g,function(e){var r=t-(e-l);return u?bu(r,s-(e-c)):r}(e))}function v(e){return a=void 0,d&&i?p(e):(i=n=void 0,o)}function y(){var e=Su(),r=m(e);if(i=arguments,n=this,l=e,r){if(void 0===a)return f(l);if(u)return a=setTimeout(g,t),p(l)}return void 0===a&&(a=setTimeout(g,t)),o}return t=Cu(t)||0,Eu(r)&&(h=!!r.leading,s=(u="maxWait"in r)?xu(Cu(r.maxWait)||0,t):s,d="trailing"in r?!!r.trailing:d),y.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=n=a=void 0},y.flush=function(){return void 0===a?o:v(Su())},y};!function(e){e[e.FULLSCREEN=1]="FULLSCREEN",e[e.CUSTOM=2]="CUSTOM"}(Tu||(Tu={}));!function(e){e.ACUTE="´",e.GRAVE="`",e.CIRCUMFLEX="^",e.DIAERESIS="¨",e.TILDE="~"}(Ou||(Ou={}));Object.values(Ou);let Mu;return Jo.FONTS_PATH="_assets/_fonts/",t.ImageUtils.getDataURL=function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Mu&&(Mu=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Mu.width=e.width,Mu.height=e.height;const r=Mu.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=Mu}return t.toDataURL("image/png")},e.Application=class{constructor(){this._viewportMode=Tu.FULLSCREEN,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._running=!1,window.addEventListener("resize",Du(this.resize.bind(this),200))}start(e){fetch(e).then((e=>e.json())).then((e=>{this._editorData=e.editor;return(new iu).parseAsync(e)})).then((e=>{this._scene=e,this._camera=this._scene.activeCamera,this.init(),this._running=!0,this.run(),this.resize()})).catch((e=>{console.error(e)}))}run(){requestAnimationFrame(this.run.bind(this)),this.render()}render(){var e;this._running&&(this._renderer?(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)&&this._controls.update(),this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&((null===(e=this._scene.postprocessing)||void 0===e?void 0:e.enabled)?(this._renderer.autoClear=!0,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera)))):console.error("Application::render >>> tried to renderer without a renderer"))}resize(){var e,r,i;this._running&&this._renderer&&(this._viewportMode===Tu.FULLSCREEN&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new t.Vector2(this._viewportWidth,this._viewportHeight))),null===(e=this._frameView)||void 0===e||e.updateRenderer(),this._viewportMode!==Tu.FULLSCREEN&&(null===(r=this._frameView)||void 0===r||r.updateViewport()),this._camera&&(null===(i=this._frameView)||void 0===i||i.updateCamera(),"PerspectiveCamera"===this._camera.cameraType&&this._viewportMode===Tu.FULLSCREEN&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()))}init(){var e,r,i,n;const s=document.getElementById("canvas3d");this._scene&&this._camera&&((null===(e=this._scene.postprocessing)||void 0===e?void 0:e.enabled)?(this._renderer=new t.WebGLRenderer({canvas:s,antialias:!1,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene})):this._renderer=new t.WebGLRenderer({canvas:s,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._viewportMode=null!==(r=this._scene.canvas.mode)&&void 0!==r?r:Tu.FULLSCREEN,this._viewportWidth=null!==(i=this._scene.canvas.size.width)&&void 0!==i?i:window.innerWidth,this._viewportHeight=null!==(n=this._scene.canvas.size.height)&&void 0!==n?n:window.innerHeight,this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=t.PCFSoftShadowMap,this._renderer.setClearColor(this._scene.color,this._scene.alpha),this._frameView=new uu(this._renderer,this._camera,new t.Vector2(this._viewportWidth,this._viewportHeight),new t.Vector2(this._scene.canvas.editorSize.width,this._scene.canvas.editorSize.height)),this._controls=new cu(this._camera,this._renderer.domElement),this._editorData&&(this._controls.fromJSON(this._editorData.orbitControls),this._controls.useKeyEvents=!1),this._playmode=new ys(this._renderer.domElement,this._scene,this._camera))}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},THREE); diff --git a/spline scenes/4_d_donut_creation/scene.json b/spline scenes/4_d_donut_creation/scene.json new file mode 100644 index 0000000..2c5181b --- /dev/null +++ b/spline scenes/4_d_donut_creation/scene.json @@ -0,0 +1 @@ +{"object":{"uuid":"B6BEBD25-292C-4ECC-9729-2C0233CBC257","objectType":"Scene","name":"4D donut creation","matrix":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],"layers":1,"children":[{"uuid":"1168A5E4-1F23-4A3A-9F63-5B118EC8676C","objectType":"Mesh3D","name":"Sphere copy 4","matrix":[0.34083153191698207,0,0,0,0,1.5262242489177045,0,0,0,0,1.5262242489177045,0,74.12749001885929,-114.35439673407232,-9.068825039976893,1],"castShadow":true,"receiveShadow":true,"layers":1,"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,-64.8613801271451,122.07123984951622,9.068825039976772,1],"interaction":{"uuid":"D8538C91-B5D5-4527-8E1D-0671D71DD2BD"},"geometry":"4938E4E9-7B12-467C-84D1-C3573CD533B5","material":"BA1253EA-EDC7-4166-A815-9C188872B43A"},{"uuid":"BB288605-2A96-4C3D-AB40-524D614753C1","objectType":"Mesh3D","name":"Sphere copy 3","matrix":[-0.7745501956675114,9.485504179031739e-17,0,0,-1.86908564121814e-16,-1.5262242489177045,0,0,0,0,1.5262242489177045,0,98.23645700988851,-65.19105368918977,1.6918717283442817,1],"castShadow":true,"receiveShadow":true,"layers":1,"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,-178.88815961581176,80.42939545250249,-1.6918717283443243,1],"interaction":{"uuid":"AC0C95DA-A885-49CF-A10B-C3C4951E8E40"},"geometry":"41B49896-0268-442F-A0F1-3D09ED41C9D1","material":"D19B7F79-1622-47A0-BF1B-5FC9FDB54797"},{"uuid":"2B9941BA-A028-46EA-B265-F38977F46658","objectType":"Mesh3D","name":"Sphere copy 3","matrix":[-1.1893564898650937,1.4565416183584183e-16,0,0,-1.86908564121814e-16,-1.5262242489177045,0,0,0,0,1.5262242489177045,0,-104.55718087735718,14.78269027586473,27.281509272525398,1],"castShadow":true,"receiveShadow":true,"layers":1,"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,-145.28584793169372,9.890328457197935,-31.531141585666603,1],"interaction":{"uuid":"2595B542-1070-4812-87BE-A353DF553EB1"},"geometry":"6DC9D632-0F0A-4675-8B2E-E122951F499C","material":"ABB5D4AE-9A24-4457-878E-CCDD89C7074E"},{"uuid":"CEC677EB-BAD3-473B-AEAC-A5A728B7EE08","objectType":"Mesh3D","name":"Sphere copy 3","matrix":[-1.5262242489177045,1.86908564121814e-16,0,0,-1.86908564121814e-16,-1.5262242489177045,0,0,0,0,1.5262242489177045,0,-321.4732229957352,49.20964561504492,27.28150927252537,1],"castShadow":true,"receiveShadow":true,"layers":1,"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,-105.7832071224424,-16.819783766538315,-31.531141585665807,1],"interaction":{"uuid":"0695DF2C-F9D2-4D58-AE4C-DF4344B2BF56"},"geometry":"01395562-B5E9-4209-A5E8-BC581B8B88DC","material":"76345115-C351-4339-AC38-E87A15EEC149"},{"uuid":"F7F40090-8010-4257-A676-11F4DF2885D3","objectType":"Mesh3D","name":"Sphere copy 2","matrix":[0.8608695277394341,0,0,0,0,1.5262242489177045,0,0,0,0,1.5262242489177045,0,165.84339183631397,-82.01083745572808,-28.67837030332747,1],"castShadow":true,"receiveShadow":true,"layers":1,"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,-73.10495249336935,97.2491792190408,29.839269857321483,1],"interaction":{"uuid":"2ED8E530-7D2C-4FDC-9C13-3F42F22C92E7"},"geometry":"7DCBBD49-075D-456F-9D8E-18080A7FDBE2","material":"0C7868D3-D9CC-4D03-9835-B01C67EE0B2C"},{"uuid":"BD33FFCA-B823-46C2-841C-922A9F0CE2B8","objectType":"Mesh3D","name":"Sphere copy","matrix":[1.1893564898650937,0,0,0,0,1.5262242489177045,0,0,0,0,1.5262242489177045,0,300.43240635532356,-18.993269108292335,2.842170943040401e-14,1],"castShadow":true,"receiveShadow":true,"layers":1,"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,-39.50264080925132,26.71011222373625,-7.958078640513122e-13,1],"interaction":{"uuid":"FFABB76D-3936-40C8-86C3-CE2666F1D15D"},"geometry":"6B6AE205-1AAE-4DE4-A115-8D11F1C28E8D","material":"BC380370-E6E6-462B-9659-10D032C17662"},{"uuid":"2C24C38F-15B1-41CB-BE37-DFDB1AAE041D","objectType":"Mesh3D","name":"Sphere","matrix":[1.5262242489177045,0,0,0,0,1.5262242489177045,0,0,0,0,1.5262242489177045,0,438.34316685519894,0,0,1],"castShadow":true,"receiveShadow":true,"layers":1,"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],"interaction":{"uuid":"7B9CA1F8-AE17-4632-9126-57E369E18B64"},"geometry":"16468936-F566-4300-8427-27D41A7D0159","material":"707D512F-E466-4656-9872-B3752606A730"},{"uuid":"3B695796-4617-4F45-BF86-E0B33A41DF6B","objectType":"CombinedCamera","name":"Default Camera","matrix":[0.9982466923310594,6.938893903907228e-18,0.05919071929026576,0,0.0348343339320598,0.8084898922536939,-0.5874782236841806,0,-0.0478550982614056,0.5885100628906954,0.8070723607253446,0,-47.855096833870725,588.5100572212864,807.0723591728427,1],"layers":1,"children":[{"uuid":"E3F6D54D-4262-4F48-815D-87A431E15474","type":"DirectionalLight","name":"Default Directional Light","layers":1,"matrix":[1,0,0,0,0,1,0,0,0,0,1,0,850000,1300000,1000000,1],"color":16777215,"intensity":0.75,"shadow":{"camera":{"uuid":"A365B353-F1AA-4566-BF6A-A7B546E473F0","type":"OrthographicCamera","layers":1,"zoom":1,"left":-5,"right":5,"top":5,"bottom":-5,"near":0.5,"far":500}}}],"hiddenMatrix":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],"interaction":{"uuid":"B2468481-CBDD-4F0F-B576-73B5F8EA49C6"},"enableHelper":false,"cameraType":"PerspectiveCamera","targetOffset":1000,"left":-870,"right":870,"top":458.5,"bottom":-458.5,"zoomOrtho":1,"nearOrtho":-50000,"far":50000,"aspect":1.8974918211559433,"fov":45,"focus":10,"filmGauge":35,"filmOffset":0,"zoomPersp":1,"nearPersp":50},{"uuid":"36878CE4-1A1A-40E5-B27A-7718B3714A24","type":"HemisphereLight","name":"Default Ambient Light","layers":1,"matrix":[1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1],"color":13882323,"intensity":0.75,"groundColor":8553090}],"activeCamera":"3B695796-4617-4F45-BF86-E0B33A41DF6B","camera":"3B695796-4617-4F45-BF86-E0B33A41DF6B","directionalLight":"E3F6D54D-4262-4F48-815D-87A431E15474","ambientLight":"36878CE4-1A1A-40E5-B27A-7718B3714A24","color":[0.09803921568627451,0.09803921568627451,0.09803921568627451],"alpha":1,"directionalLightState":true,"ambientLightState":true,"canvas":{"mode":1,"preset":"fullscreen","editorSize":{"width":1740,"height":917},"color":[0,0,0,0.5]},"postprocessing":{"enabled":false,"bloom":{"enabled":false,"opacity":1,"blendFunction":16,"intensity":1,"luminanceThreshold":0.9,"luminanceSmoothing":0.025,"blurScale":1,"kernelSize":3},"chromaticAberration":{"enabled":false,"opacity":1,"blendFunction":13,"offset":[10,10]},"vignette":{"enabled":false,"opacity":1,"blendFunction":13,"eskil":false,"darkness":0.5,"offset":0.5},"noise":{"enabled":false,"opacity":1,"blendFunction":14},"colorAverage":{"enabled":false,"opacity":1,"blendFunction":13},"hueSaturation":{"enabled":false,"opacity":1,"blendFunction":13,"_hue":0,"hue":0,"saturation":0},"brightnessContrast":{"enabled":false,"opacity":1,"blendFunction":13,"contrast":0,"brightness":0},"depthOfField":{"enabled":false,"opacity":1,"blendFunction":13,"focalLength":0.1,"focusDistance":0,"bokehScale":1},"pixelation":{"enabled":false,"opacity":1,"blendFunction":13,"granularity":30}}},"metadata":{"version":1.5,"type":"Object","generator":"Object3D.toJSON"},"geometries":[{"uuid":"4938E4E9-7B12-467C-84D1-C3573CD533B5","userData":{"parameters":{"width":100,"widthSegments":64,"heightSegments":64,"phiStart":0,"phiLength":6.283185307179586,"thetaStart":0,"thetaLength":3.141592653589793,"height":100.00000000000017,"depth":100.00000000000017},"type":"SphereGeometry"}},{"uuid":"41B49896-0268-442F-A0F1-3D09ED41C9D1","userData":{"parameters":{"width":99.99999999999989,"widthSegments":64,"heightSegments":64,"phiStart":0,"phiLength":6.283185307179586,"thetaStart":0,"thetaLength":3.141592653589793,"height":100.00000000000009,"depth":100.00000000000009},"type":"SphereGeometry"}},{"uuid":"6DC9D632-0F0A-4675-8B2E-E122951F499C","userData":{"parameters":{"width":103.99999999999999,"widthSegments":64,"heightSegments":64,"phiStart":0,"phiLength":6.283185307179586,"thetaStart":0,"thetaLength":3.141592653589793,"height":100,"depth":100},"type":"SphereGeometry"}},{"uuid":"01395562-B5E9-4209-A5E8-BC581B8B88DC","userData":{"parameters":{"width":100.00000000000003,"widthSegments":64,"heightSegments":64,"phiStart":0,"phiLength":6.283185307179586,"thetaStart":0,"thetaLength":3.141592653589793,"height":100.00000000000003,"depth":100.00000000000003},"type":"SphereGeometry"}},{"uuid":"7DCBBD49-075D-456F-9D8E-18080A7FDBE2","userData":{"parameters":{"width":99.99999999999989,"widthSegments":64,"heightSegments":64,"phiStart":0,"phiLength":6.283185307179586,"thetaStart":0,"thetaLength":3.141592653589793,"height":100.00000000000009,"depth":100.00000000000009},"type":"SphereGeometry"}},{"uuid":"6B6AE205-1AAE-4DE4-A115-8D11F1C28E8D","userData":{"parameters":{"width":103.99999999999999,"widthSegments":64,"heightSegments":64,"phiStart":0,"phiLength":6.283185307179586,"thetaStart":0,"thetaLength":3.141592653589793,"height":100,"depth":100},"type":"SphereGeometry"}},{"uuid":"16468936-F566-4300-8427-27D41A7D0159","userData":{"parameters":{"width":100,"widthSegments":64,"heightSegments":64,"phiStart":0,"phiLength":6.283185307179586,"thetaStart":0,"thetaLength":3.141592653589793,"height":100,"depth":100},"type":"SphereGeometry"}}],"materials":[{"uuid":"BA1253EA-EDC7-4166-A815-9C188872B43A","type":"ShaderMaterial","transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,"colorWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680,"dithering":true,"wireframeLinecap":"","wireframeLinejoin":"","userData":{"type":"PhongMaterial","category":"Phong","nodeType":"PhongNodeMaterial","layers":{"id":2,"uuid":"B1ACC471-21DB-43DA-95CC-71A1F4DA7B01","head":{"id":0,"type":"color","defines":{},"uniforms":{"f0_color":"06C7AEC6-FFC0-475B-A8D1-33699CCBE7FC","f0_alpha":"E9DAB6E0-0AD4-4519-BC84-C9C7EB78EEA8","f0_mode":"13E4FA84-B653-478A-9D95-60E1DD2BD684"},"next":{"id":1,"type":"light","defines":{},"uniforms":{"f1_alpha":"9BD44840-23D2-4B3A-B0F7-9782B281AB61","f1_mode":"F0329E9B-D6DA-4E91-8497-C1A8C1484958"}}}}},"glslVersion":null,"defines":{"PHONG":1},"vertex":"B1CFA091-EFBE-4BF4-8BC9-1C80DF72AD1B","fragment":"B1CFA091-EFBE-4BF4-8BC9-1C80DF72AD1B"},{"uuid":"D19B7F79-1622-47A0-BF1B-5FC9FDB54797","type":"ShaderMaterial","transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,"colorWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680,"dithering":true,"wireframeLinecap":"","wireframeLinejoin":"","userData":{"type":"PhongMaterial","category":"Phong","nodeType":"PhongNodeMaterial","layers":{"id":2,"uuid":"026FE863-2AF6-41E6-8D44-20825F5A3A4B","head":{"id":0,"type":"color","defines":{},"uniforms":{"f0_color":"1296192B-AF04-4711-B63C-D86146C31CD3","f0_alpha":"4067BA12-DBBE-4CAC-A0DE-B1AE1B15118F","f0_mode":"F7D83551-78CA-479A-B0AC-779385063B4B"},"next":{"id":1,"type":"light","defines":{},"uniforms":{"f1_alpha":"475A966C-FE7E-4B9D-81C3-51318A7D6869","f1_mode":"ED17C9AE-799F-457B-87D7-4316977F75A1"}}}}},"glslVersion":null,"defines":{"PHONG":1},"vertex":"53D7087E-D2B3-4714-ABB4-BE5C340987D2","fragment":"53D7087E-D2B3-4714-ABB4-BE5C340987D2"},{"uuid":"ABB5D4AE-9A24-4457-878E-CCDD89C7074E","type":"ShaderMaterial","transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,"colorWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680,"dithering":true,"wireframeLinecap":"","wireframeLinejoin":"","userData":{"type":"PhongMaterial","category":"Phong","nodeType":"PhongNodeMaterial","layers":{"id":2,"uuid":"A6E65C0A-9303-48C5-B302-69B6393DAEEE","head":{"id":0,"type":"color","defines":{},"uniforms":{"f0_color":"7D2282C0-0712-4BE4-AA94-3B3114AA34DF","f0_alpha":"0EEF7E69-09EA-4AB2-8357-073AC2FC2BE9","f0_mode":"69FF3BD6-86CB-4B08-96DE-259535CDD607"},"next":{"id":1,"type":"light","defines":{},"uniforms":{"f1_alpha":"9EEFC0B8-3B2B-4B37-AE9A-C8F88B878B0A","f1_mode":"740D3248-86FE-4901-BB15-DFD71F1634C6"}}}}},"glslVersion":null,"defines":{"PHONG":1},"vertex":"BB4F1EFE-765B-41FB-A324-A8548D6DCB68","fragment":"BB4F1EFE-765B-41FB-A324-A8548D6DCB68"},{"uuid":"76345115-C351-4339-AC38-E87A15EEC149","type":"ShaderMaterial","transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,"colorWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680,"dithering":true,"wireframeLinecap":"","wireframeLinejoin":"","userData":{"type":"PhongMaterial","category":"Phong","nodeType":"PhongNodeMaterial","layers":{"id":2,"uuid":"097ADD0D-44B6-401A-BCFB-83C9FD315C2D","head":{"id":0,"type":"color","defines":{},"uniforms":{"f0_color":"ECF0D1B0-EFF3-48DA-82F5-8AEB139AB438","f0_alpha":"E47258A1-3D10-4787-BA60-7A1B3ECE0683","f0_mode":"58029977-D740-4229-9C1C-6E300CEFB39F"},"next":{"id":1,"type":"light","defines":{},"uniforms":{"f1_alpha":"9AC6C8EA-648C-4088-8346-38234085760B","f1_mode":"F559B9D2-F716-45A5-A61C-254474CC26DB"}}}}},"glslVersion":null,"defines":{"PHONG":1},"vertex":"FD125E25-2A85-470C-A10B-3ED88498D096","fragment":"FD125E25-2A85-470C-A10B-3ED88498D096"},{"uuid":"0C7868D3-D9CC-4D03-9835-B01C67EE0B2C","type":"ShaderMaterial","transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,"colorWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680,"dithering":true,"wireframeLinecap":"","wireframeLinejoin":"","userData":{"type":"PhongMaterial","category":"Phong","nodeType":"PhongNodeMaterial","layers":{"id":2,"uuid":"79522640-6212-49F3-BFB4-F88C3A290DE2","head":{"id":0,"type":"color","defines":{},"uniforms":{"f0_color":"58D179AD-5E65-4873-BAD8-058396740EBB","f0_alpha":"A3CD55EA-9D8D-4D9E-B6EA-004F170D615D","f0_mode":"BEEFF559-D475-4B4D-896A-FD70C0CD77DD"},"next":{"id":1,"type":"light","defines":{},"uniforms":{"f1_alpha":"EF10A3FB-5C2C-46A0-9CCD-4095DBA43558","f1_mode":"CD4247AA-3024-4DEA-BAEC-125D48FB2B13"}}}}},"glslVersion":null,"defines":{"PHONG":1},"vertex":"69320C86-6735-47B0-AAF5-03A385AA6850","fragment":"69320C86-6735-47B0-AAF5-03A385AA6850"},{"uuid":"BC380370-E6E6-462B-9659-10D032C17662","type":"ShaderMaterial","transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,"colorWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680,"dithering":true,"wireframeLinecap":"","wireframeLinejoin":"","userData":{"type":"PhongMaterial","category":"Phong","nodeType":"PhongNodeMaterial","layers":{"id":2,"uuid":"11A68ACF-90C6-486A-9492-3DCF27631936","head":{"id":0,"type":"color","defines":{},"uniforms":{"f0_color":"0E64785D-5C0A-4BE8-8D54-27D2A10F0CEB","f0_alpha":"D89A6355-0FBE-48B6-9BF1-D80E5D3B2E16","f0_mode":"ACF22C2E-CCF5-448B-97A1-930E4D6AF7A2"},"next":{"id":1,"type":"light","defines":{},"uniforms":{"f1_alpha":"836ABBDB-3634-48A5-855E-4F3D1658C393","f1_mode":"B3878974-FCF2-4999-A01A-D09D49FFDAA1"}}}}},"glslVersion":null,"defines":{"PHONG":1},"vertex":"2C754A62-11A8-4FEA-8064-9AE85B19C4AC","fragment":"2C754A62-11A8-4FEA-8064-9AE85B19C4AC"},{"uuid":"707D512F-E466-4656-9872-B3752606A730","type":"ShaderMaterial","transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,"colorWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680,"dithering":true,"wireframeLinecap":"","wireframeLinejoin":"","userData":{"type":"PhongMaterial","category":"Phong","nodeType":"PhongNodeMaterial","layers":{"id":2,"uuid":"CCAB78AD-63AD-4CC9-ACD9-0DB2AD74892D","head":{"id":0,"type":"color","defines":{},"uniforms":{"f0_color":"98152D48-140E-42E6-A938-A9DBFEA2FA42","f0_alpha":"6657D12A-FE41-4A97-9C87-DB73CADCF481","f0_mode":"6C8FBCA4-319E-47D0-81C5-35F5D4E575CF"},"next":{"id":1,"type":"light","defines":{},"uniforms":{"f1_alpha":"BAD9F432-D9B3-4E42-AA6B-49A5517006CE","f1_mode":"13D914E1-CD74-4E49-BBE3-CE569F3D63CF"}}}}},"glslVersion":null,"defines":{"PHONG":1},"vertex":"00AF710D-E7A0-4127-BEA0-BB75E2E9BCA3","fragment":"00AF710D-E7A0-4127-BEA0-BB75E2E9BCA3"}],"nodes":[{"uuid":"06C7AEC6-FFC0-475B-A8D1-33699CCBE7FC","type":"c","r":0.26666666666666666,"g":1,"b":0.38823529411764707,"value":4521827,"alpha":"E9DAB6E0-0AD4-4519-BC84-C9C7EB78EEA8","nodeType":"Color"},{"uuid":"E9DAB6E0-0AD4-4519-BC84-C9C7EB78EEA8","type":"f","value":1,"nodeType":"Float"},{"uuid":"13E4FA84-B653-478A-9D95-60E1DD2BD684","type":"i","value":0,"nodeType":"Int"},{"uuid":"9BD44840-23D2-4B3A-B0F7-9782B281AB61","type":"f","value":1,"nodeType":"Float"},{"uuid":"F0329E9B-D6DA-4E91-8497-C1A8C1484958","type":"i","value":0,"nodeType":"Int"},{"uuid":"B1CFA091-EFBE-4BF4-8BC9-1C80DF72AD1B","type":"phong","color":"06C7AEC6-FFC0-475B-A8D1-33699CCBE7FC","specular":"2C14F53E-4E83-41E5-B9AC-89E6D102C86A","shininess":"8636F1CF-8ECC-40E2-A43B-E19FDBD45F10","shadingAlpha":"9BD44840-23D2-4B3A-B0F7-9782B281AB61","shadingBlend":"F0329E9B-D6DA-4E91-8497-C1A8C1484958","alpha":"B2813756-7DC6-447F-BDBF-22850F622BF2","nodeType":"Phong"},{"uuid":"2C14F53E-4E83-41E5-B9AC-89E6D102C86A","type":"c","r":0.06666666666666667,"g":0.06666666666666667,"b":0.06666666666666667,"value":1118481,"nodeType":"Color"},{"uuid":"8636F1CF-8ECC-40E2-A43B-E19FDBD45F10","type":"f","value":30,"nodeType":"Float"},{"uuid":"B2813756-7DC6-447F-BDBF-22850F622BF2","type":"f","value":1,"nodeType":"Float"},{"uuid":"1296192B-AF04-4711-B63C-D86146C31CD3","type":"c","r":0.28627450980392155,"g":1,"b":0.5843137254901961,"value":4849557,"alpha":"4067BA12-DBBE-4CAC-A0DE-B1AE1B15118F","nodeType":"Color"},{"uuid":"4067BA12-DBBE-4CAC-A0DE-B1AE1B15118F","type":"f","value":1,"nodeType":"Float"},{"uuid":"F7D83551-78CA-479A-B0AC-779385063B4B","type":"i","value":0,"nodeType":"Int"},{"uuid":"475A966C-FE7E-4B9D-81C3-51318A7D6869","type":"f","value":1,"nodeType":"Float"},{"uuid":"ED17C9AE-799F-457B-87D7-4316977F75A1","type":"i","value":0,"nodeType":"Int"},{"uuid":"53D7087E-D2B3-4714-ABB4-BE5C340987D2","type":"phong","color":"1296192B-AF04-4711-B63C-D86146C31CD3","specular":"7EFC44B0-58AE-4FDB-924B-F1C2B1CE12D6","shininess":"6B229BBC-67BB-4FD9-9B9A-F12BE1558E03","shadingAlpha":"475A966C-FE7E-4B9D-81C3-51318A7D6869","shadingBlend":"ED17C9AE-799F-457B-87D7-4316977F75A1","alpha":"B2FDB9F1-E358-4780-BBF3-838F2BCB659A","nodeType":"Phong"},{"uuid":"7EFC44B0-58AE-4FDB-924B-F1C2B1CE12D6","type":"c","r":0.06666666666666667,"g":0.06666666666666667,"b":0.06666666666666667,"value":1118481,"nodeType":"Color"},{"uuid":"6B229BBC-67BB-4FD9-9B9A-F12BE1558E03","type":"f","value":30,"nodeType":"Float"},{"uuid":"B2FDB9F1-E358-4780-BBF3-838F2BCB659A","type":"f","value":1,"nodeType":"Float"},{"uuid":"7D2282C0-0712-4BE4-AA94-3B3114AA34DF","type":"c","r":0.24705882352941178,"g":1,"b":0.8823529411764706,"value":4194273,"alpha":"0EEF7E69-09EA-4AB2-8357-073AC2FC2BE9","nodeType":"Color"},{"uuid":"0EEF7E69-09EA-4AB2-8357-073AC2FC2BE9","type":"f","value":1,"nodeType":"Float"},{"uuid":"69FF3BD6-86CB-4B08-96DE-259535CDD607","type":"i","value":0,"nodeType":"Int"},{"uuid":"9EEFC0B8-3B2B-4B37-AE9A-C8F88B878B0A","type":"f","value":1,"nodeType":"Float"},{"uuid":"740D3248-86FE-4901-BB15-DFD71F1634C6","type":"i","value":0,"nodeType":"Int"},{"uuid":"BB4F1EFE-765B-41FB-A324-A8548D6DCB68","type":"phong","color":"7D2282C0-0712-4BE4-AA94-3B3114AA34DF","specular":"B5E087FB-83CB-4F4A-88FB-C255E4525A6D","shininess":"FD847846-D869-45C7-BF6F-517E9265C670","shadingAlpha":"9EEFC0B8-3B2B-4B37-AE9A-C8F88B878B0A","shadingBlend":"740D3248-86FE-4901-BB15-DFD71F1634C6","alpha":"6FB24A39-01A8-4649-800F-81B0A09DCC29","nodeType":"Phong"},{"uuid":"B5E087FB-83CB-4F4A-88FB-C255E4525A6D","type":"c","r":0.06666666666666667,"g":0.06666666666666667,"b":0.06666666666666667,"value":1118481,"nodeType":"Color"},{"uuid":"FD847846-D869-45C7-BF6F-517E9265C670","type":"f","value":30,"nodeType":"Float"},{"uuid":"6FB24A39-01A8-4649-800F-81B0A09DCC29","type":"f","value":1,"nodeType":"Float"},{"uuid":"ECF0D1B0-EFF3-48DA-82F5-8AEB139AB438","type":"c","r":0.24705882352941178,"g":0.7843137254901961,"b":1,"value":4180223,"alpha":"E47258A1-3D10-4787-BA60-7A1B3ECE0683","nodeType":"Color"},{"uuid":"E47258A1-3D10-4787-BA60-7A1B3ECE0683","type":"f","value":1,"nodeType":"Float"},{"uuid":"58029977-D740-4229-9C1C-6E300CEFB39F","type":"i","value":0,"nodeType":"Int"},{"uuid":"9AC6C8EA-648C-4088-8346-38234085760B","type":"f","value":1,"nodeType":"Float"},{"uuid":"F559B9D2-F716-45A5-A61C-254474CC26DB","type":"i","value":0,"nodeType":"Int"},{"uuid":"FD125E25-2A85-470C-A10B-3ED88498D096","type":"phong","color":"ECF0D1B0-EFF3-48DA-82F5-8AEB139AB438","specular":"5305B712-3DAD-4568-A659-5AA9CD7A2BA7","shininess":"E2778FFF-4C62-437E-A1A8-B1B1CF0CBFA8","shadingAlpha":"9AC6C8EA-648C-4088-8346-38234085760B","shadingBlend":"F559B9D2-F716-45A5-A61C-254474CC26DB","alpha":"5B5556B7-5C52-4631-ACEC-A1B0E54E52F2","nodeType":"Phong"},{"uuid":"5305B712-3DAD-4568-A659-5AA9CD7A2BA7","type":"c","r":0.06666666666666667,"g":0.06666666666666667,"b":0.06666666666666667,"value":1118481,"nodeType":"Color"},{"uuid":"E2778FFF-4C62-437E-A1A8-B1B1CF0CBFA8","type":"f","value":30,"nodeType":"Float"},{"uuid":"5B5556B7-5C52-4631-ACEC-A1B0E54E52F2","type":"f","value":1,"nodeType":"Float"},{"uuid":"58D179AD-5E65-4873-BAD8-058396740EBB","type":"c","r":0.28627450980392155,"g":1,"b":0.5843137254901961,"value":4849557,"alpha":"A3CD55EA-9D8D-4D9E-B6EA-004F170D615D","nodeType":"Color"},{"uuid":"A3CD55EA-9D8D-4D9E-B6EA-004F170D615D","type":"f","value":1,"nodeType":"Float"},{"uuid":"BEEFF559-D475-4B4D-896A-FD70C0CD77DD","type":"i","value":0,"nodeType":"Int"},{"uuid":"EF10A3FB-5C2C-46A0-9CCD-4095DBA43558","type":"f","value":1,"nodeType":"Float"},{"uuid":"CD4247AA-3024-4DEA-BAEC-125D48FB2B13","type":"i","value":0,"nodeType":"Int"},{"uuid":"69320C86-6735-47B0-AAF5-03A385AA6850","type":"phong","color":"58D179AD-5E65-4873-BAD8-058396740EBB","specular":"84919C68-59E4-4E15-ADE0-3B4A97482E14","shininess":"18BB7BD2-17DC-44CA-B845-2CC45D9358A1","shadingAlpha":"EF10A3FB-5C2C-46A0-9CCD-4095DBA43558","shadingBlend":"CD4247AA-3024-4DEA-BAEC-125D48FB2B13","alpha":"6888F651-940E-42BA-AEBB-BA7C0E8BB849","nodeType":"Phong"},{"uuid":"84919C68-59E4-4E15-ADE0-3B4A97482E14","type":"c","r":0.06666666666666667,"g":0.06666666666666667,"b":0.06666666666666667,"value":1118481,"nodeType":"Color"},{"uuid":"18BB7BD2-17DC-44CA-B845-2CC45D9358A1","type":"f","value":30,"nodeType":"Float"},{"uuid":"6888F651-940E-42BA-AEBB-BA7C0E8BB849","type":"f","value":1,"nodeType":"Float"},{"uuid":"0E64785D-5C0A-4BE8-8D54-27D2A10F0CEB","type":"c","r":0.24705882352941178,"g":1,"b":0.8862745098039215,"value":4194274,"alpha":"D89A6355-0FBE-48B6-9BF1-D80E5D3B2E16","nodeType":"Color"},{"uuid":"D89A6355-0FBE-48B6-9BF1-D80E5D3B2E16","type":"f","value":1,"nodeType":"Float"},{"uuid":"ACF22C2E-CCF5-448B-97A1-930E4D6AF7A2","type":"i","value":0,"nodeType":"Int"},{"uuid":"836ABBDB-3634-48A5-855E-4F3D1658C393","type":"f","value":1,"nodeType":"Float"},{"uuid":"B3878974-FCF2-4999-A01A-D09D49FFDAA1","type":"i","value":0,"nodeType":"Int"},{"uuid":"2C754A62-11A8-4FEA-8064-9AE85B19C4AC","type":"phong","color":"0E64785D-5C0A-4BE8-8D54-27D2A10F0CEB","specular":"F4B012C9-B68F-4F6E-85B7-F425BFE26514","shininess":"DF08285E-5220-4263-AB96-8F6812896082","shadingAlpha":"836ABBDB-3634-48A5-855E-4F3D1658C393","shadingBlend":"B3878974-FCF2-4999-A01A-D09D49FFDAA1","alpha":"BF5A34B5-CA83-40D2-A3AD-C99524959DD5","nodeType":"Phong"},{"uuid":"F4B012C9-B68F-4F6E-85B7-F425BFE26514","type":"c","r":0.06666666666666667,"g":0.06666666666666667,"b":0.06666666666666667,"value":1118481,"nodeType":"Color"},{"uuid":"DF08285E-5220-4263-AB96-8F6812896082","type":"f","value":30,"nodeType":"Float"},{"uuid":"BF5A34B5-CA83-40D2-A3AD-C99524959DD5","type":"f","value":1,"nodeType":"Float"},{"uuid":"98152D48-140E-42E6-A938-A9DBFEA2FA42","type":"c","r":0.24705882352941178,"g":0.7803921568627451,"b":1,"value":4179967,"alpha":"6657D12A-FE41-4A97-9C87-DB73CADCF481","nodeType":"Color"},{"uuid":"6657D12A-FE41-4A97-9C87-DB73CADCF481","type":"f","value":1,"nodeType":"Float"},{"uuid":"6C8FBCA4-319E-47D0-81C5-35F5D4E575CF","type":"i","value":0,"nodeType":"Int"},{"uuid":"BAD9F432-D9B3-4E42-AA6B-49A5517006CE","type":"f","value":1,"nodeType":"Float"},{"uuid":"13D914E1-CD74-4E49-BBE3-CE569F3D63CF","type":"i","value":0,"nodeType":"Int"},{"uuid":"00AF710D-E7A0-4127-BEA0-BB75E2E9BCA3","type":"phong","color":"98152D48-140E-42E6-A938-A9DBFEA2FA42","specular":"EDFD4DA2-C002-4349-961F-9100A5C6EB1B","shininess":"1C342D15-67BB-43BA-B862-26D30208F068","shadingAlpha":"BAD9F432-D9B3-4E42-AA6B-49A5517006CE","shadingBlend":"13D914E1-CD74-4E49-BBE3-CE569F3D63CF","alpha":"437E8B34-63BC-4CDA-BB3F-EF736A4C2B9C","nodeType":"Phong"},{"uuid":"EDFD4DA2-C002-4349-961F-9100A5C6EB1B","type":"c","r":0.06666666666666667,"g":0.06666666666666667,"b":0.06666666666666667,"value":1118481,"nodeType":"Color"},{"uuid":"1C342D15-67BB-43BA-B862-26D30208F068","type":"f","value":30,"nodeType":"Float"},{"uuid":"437E8B34-63BC-4CDA-BB3F-EF736A4C2B9C","type":"f","value":1,"nodeType":"Float"}],"assets":{"materials":{}},"editor":{"publish":{"type":2,"web":{"quality":"default","logo":true}},"orbitControls":{"useKeyEvents":false,"enableDamping":true,"enablePan":false,"enableZoom":false,"enableRotate":true,"rotationLimitsMode":0,"rotationVerticalOffset":{"min":1.5707963267948966,"max":1.5707963267948966},"rotationHorizontalOffset":{"min":1.5707963267948966,"max":1.5707963267948966},"autoRotate":false,"autoRotateSpeed":2,"autoRotateClockwise":true},"helperState":true}} \ No newline at end of file diff --git a/styles/_classes.sass b/styles/_classes.sass new file mode 100644 index 0000000..1ddf906 --- /dev/null +++ b/styles/_classes.sass @@ -0,0 +1,55 @@ +@import ./_variables +@import ./_mixins + +.title + text-align: center + margin-top: 2% + margin-bottom: 2% + font-size: 60px + width: 100% + color: $text_color_0 + +.a + margin: 0% 5% 5% 5% + padding: 2% + border-radius: 10px + background-color: $primary_light + box-shadow:: 5px 5px 12px #141414 + +.normal_text + @include normal_text + background-color: $primary_light + +.highlight_text + @include highlight_text + background-color: $primary_light + +.mtop + margin-top: $mtop + +.mleft + margin-left: $mleft + +.normal_image + margin-top: $mtop + $image_margins_size + margin-bottom: $image_margins_size + box-shadow: 10px 10px 24px #111 + +.normal_video + margin-top: $mtop + $video_margins_size + margin-bottom: $video_margins_size + box-shadow: 10px 10px 24px #111 + +.row + margin-top: $mtop + display: flex + justify-content: space-around + flex-direction: row + border-radius: 10px + +.spline_scene + margin-top: $mtop + $spline_scene_margins_size + margin-bottom: $spline_scene_margins_size + box-shadow: 10px 10px 24px #111 + width: 1000px + height: 600px diff --git a/styles/_main_tags.sass b/styles/_main_tags.sass new file mode 100644 index 0000000..3b117e5 --- /dev/null +++ b/styles/_main_tags.sass @@ -0,0 +1,12 @@ +@import ./_variables + +nav + width: 100% + height: 30px + box-shadow: 0px 0px 20px #000 + background-color: $primary_dark + +canvas + margin-top: $mtop + $canvas_margins_size + margin-bottom: $canvas_margins_size + box-shadow: 10px 10px 24px #111 diff --git a/styles/_mixins.sass b/styles/_mixins.sass new file mode 100644 index 0000000..24a3592 --- /dev/null +++ b/styles/_mixins.sass @@ -0,0 +1,21 @@ +@import ./_variables + + +@mixin smaller_text + font-size: $smaller_text_font_size + color: text_color_0 + font-family: Arial, Helvetica, sans-ser + letter-spacing: 0.6px + + +@mixin normal_text + font-size: $normal_text_font_size + color: $text_color_0 + font-family: Arial, Helvetica, sans-ser + letter-spacing: 2px + +@mixin highlight_text + font-size: $highlight_text_font_size + color: $text_color_1 + font-family: Arial, Helvetica, sans-serif + letter-spacing: 1px \ No newline at end of file diff --git a/styles/_variables.sass b/styles/_variables.sass new file mode 100644 index 0000000..50a32a7 --- /dev/null +++ b/styles/_variables.sass @@ -0,0 +1,19 @@ +$primary: #282828 +$primary_dark: #895d5d +$primary_light: #313131 + +$scrollbar_track_color: #373737 +$scrollbar_thumb_color: #4b4b4b + +$text_color_0: #d2d2d2 +$text_color_1: #e3e3e3 +$small_text_font_size: 22px +$normal_text_font_size: 26px +$highlight_text_font_size: 34px +$mtop: 1.2% +$mleft: 1.2% + +$image_margins_size: 1.2% +$video_margins_size: 1.2% +$canvas_margins_size: 1.2% +$spline_scene_margins_size: 1.2% diff --git a/styles/style.css b/styles/style.css new file mode 100644 index 0000000..c4c9f18 --- /dev/null +++ b/styles/style.css @@ -0,0 +1,117 @@ +nav { + width: 100%; + height: 30px; + -webkit-box-shadow: 0px 0px 20px #000; + box-shadow: 0px 0px 20px #000; + background-color: #895d5d; +} + +canvas { + margin-top: 2.4%; + margin-bottom: 1.2%; + -webkit-box-shadow: 10px 10px 24px #111; + box-shadow: 10px 10px 24px #111; +} + +.title { + text-align: center; + margin-top: 2%; + margin-bottom: 2%; + font-size: 60px; + width: 100%; + color: #d2d2d2; +} + +.a { + margin: 0% 5% 5% 5%; + padding: 2%; + border-radius: 10px; + background-color: #313131; + -webkit-box-shadow: 5px 5px 12px #141414; + box-shadow: 5px 5px 12px #141414; +} + +.normal_text { + font-size: 26px; + color: #d2d2d2; + font-family: Arial, Helvetica, sans-ser; + letter-spacing: 2px; + background-color: #313131; +} + +.highlight_text { + font-size: 34px; + color: #e3e3e3; + font-family: Arial, Helvetica, sans-serif; + letter-spacing: 1px; + background-color: #313131; +} + +.mtop { + margin-top: 1.2%; +} + +.mleft { + margin-left: 1.2%; +} + +.normal_image { + margin-top: 2.4%; + margin-bottom: 1.2%; + -webkit-box-shadow: 10px 10px 24px #111; + box-shadow: 10px 10px 24px #111; +} + +.normal_video { + margin-top: 2.4%; + margin-bottom: 1.2%; + -webkit-box-shadow: 10px 10px 24px #111; + box-shadow: 10px 10px 24px #111; +} + +.row { + margin-top: 1.2%; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-pack: distribute; + justify-content: space-around; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + border-radius: 10px; +} + +.spline_scene { + margin-top: 2.4%; + margin-bottom: 1.2%; + -webkit-box-shadow: 10px 10px 24px #111; + box-shadow: 10px 10px 24px #111; + width: 1000px; + height: 600px; +} + +* { + padding: 0px; + margin: 0px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #282828; + line-height: 1.3; +} + +::-webkit-scrollbar { + width: 10px; +} + +::-webkit-scrollbar-track { + background-color: #373737; +} + +::-webkit-scrollbar-thumb { + background-color: #4b4b4b; +} +/*# sourceMappingURL=style.css.map */ \ No newline at end of file diff --git a/styles/style.css.map b/styles/style.css.map new file mode 100644 index 0000000..8635f5a --- /dev/null +++ b/styles/style.css.map @@ -0,0 +1,18 @@ +{ + "version": 3, + "mappings": "ACEA,AAAA,GAAG,CAAC;EACA,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,iBAAiB;EAC7B,gBAAgB,ECLL,OAAO;CDKgB;;AAEtC,AAAA,MAAM,CAAC;EACH,UAAU,EAAE,IAA4B;EACxC,aAAa,ECOK,IAAI;EDNtB,UAAU,EAAE,mBAAmB;CAAG;;AERtC,AAAA,MAAM,CAAC;EACH,UAAU,EAAE,MAAM;EAClB,UAAU,EAAE,EAAE;EACd,aAAa,EAAE,EAAE;EACjB,SAAS,EAAE,IAAI;EACf,KAAK,EAAE,IAAI;EACX,KAAK,EDFM,OAAO;CCEK;;AAE3B,AAAA,EAAE,CAAC;EACC,MAAM,EAAE,WAAW;EACnB,OAAO,EAAE,EAAE;EACX,aAAa,EAAE,IAAI;EACnB,gBAAgB,EDbJ,OAAO;ECcnB,UAAU,EAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO;CAAK;;AAE1C,AAAA,YAAY,CAAC;EEPT,SAAS,EHDW,IAAI;EGExB,KAAK,EHLM,OAAO;EGMlB,WAAW,EAAE,0BAA0B;EACvC,cAAc,EAAE,GAAG;EFMnB,gBAAgB,EDlBJ,OAAO;CCkBgB;;AAEvC,AAAA,eAAe,CAAC;EELZ,SAAS,EHNc,IAAI;EGO3B,KAAK,EHVM,OAAO;EGWlB,WAAW,EAAE,4BAA4B;EACzC,cAAc,EAAE,GAAG;EFInB,gBAAgB,EDtBJ,OAAO;CCsBgB;;AAEvC,AAAA,KAAK,CAAC;EACF,UAAU,EDfP,IAAI;CCea;;AAExB,AAAA,MAAM,CAAC;EACH,WAAW,EDjBP,IAAI;CCiBc;;AAE1B,AAAA,aAAa,CAAC;EACV,UAAU,EAAE,IAA2B;EACvC,aAAa,EDnBI,IAAI;ECoBrB,UAAU,EAAE,mBAAmB;CAAG;;AAEtC,AAAA,aAAa,CAAC;EACV,UAAU,EAAE,IAA2B;EACvC,aAAa,EDvBI,IAAI;ECwBrB,UAAU,EAAE,mBAAmB;CAAG;;AAEtC,AAAA,IAAI,CAAC;EACD,UAAU,ED/BP,IAAI;ECgCP,OAAO,EAAE,IAAI;EACb,eAAe,EAAE,YAAY;EAC7B,cAAc,EAAE,GAAG;EACnB,aAAa,EAAE,IAAI;CAAG;;AAE1B,AAAA,aAAa,CAAC;EACV,UAAU,EAAE,IAAkC;EAC9C,aAAa,EDjCW,IAAI;ECkC5B,UAAU,EAAE,mBAAmB;EAC/B,KAAK,EAAE,MAAM;EACb,MAAM,EAAE,KAAK;CAAG;;AHjDpB,AAAA,CAAC,CAAC;EACE,OAAO,EAAE,GAAG;EACZ,MAAM,EAAE,GAAG;EACX,WAAW,EAAE,IAAI;EACjB,gBAAgB,EETV,OAAO;EFUb,WAAW,EAAE,GAAG;CAAG;;AAEvB,AAAA,mBAAmB,CAAC;EAChB,KAAK,EAAE,IAAI;CAAG;;AAElB,AAAA,yBAAyB,CAAC;EACtB,gBAAgB,EEZI,OAAO;CFYgB;;AAE/C,AAAA,yBAAyB,CAAC;EACtB,gBAAgB,EEdI,OAAO;CFcgB", + "sources": [ + "style.sass", + "_main_tags.sass", + "_variables.sass", + "_classes.sass", + "_variables.sass", + "_mixins.sass", + "_variables.sass", + "_variables.sass", + "_mixins.sass", + "_variables.sass" + ], + "names": [], + "file": "style.css" +} \ No newline at end of file diff --git a/styles/style.sass b/styles/style.sass new file mode 100644 index 0000000..7b396e4 --- /dev/null +++ b/styles/style.sass @@ -0,0 +1,20 @@ +@import ./_main_tags +@import ./_classes +@import ./_variables +@import ./_mixins + +* + padding: 0px + margin: 0px + user-select: none + background-color: $primary + line-height: 1.3 + +::-webkit-scrollbar + width: 10px + +::-webkit-scrollbar-track + background-color: $scrollbar_track_color + +::-webkit-scrollbar-thumb + background-color: $scrollbar_thumb_color diff --git a/videos/Terrain3D.mp4 b/videos/Terrain3D.mp4 new file mode 100644 index 0000000..f01b194 Binary files /dev/null and b/videos/Terrain3D.mp4 differ