function _typeof(e){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t){function n(e){this.message=e}function o(e,t){return Object.keys(t).forEach(function(n){e[n]=t[n]}),e}e.console||function(){var t,n;n=function(){function n(){this.__buffer.push(arguments)}var o=setInterval(function(){var n;if(e.console&&console.log&&!console.__buffer){clearInterval(o),n=Function.prototype.bind?Function.prototype.bind.call(console.log,console):console.log;for(var r=0;r<t.__buffer.length;r++)n.apply(console,t.__buffer[r])}},1e3);this.log=n,this.error=n,this.warn=n,this.info=n,this.debug=n,this.__buffer=[]},t=e.console=new n}(),Object.keys||(Object.keys=function(){"use strict";var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o=n.length;return function(r){if("object"!==_typeof(r)&&("function"!=typeof r||null===r))throw new TypeError("Object.keys called on non-object");var i,s,u=[];for(i in r)e.call(r,i)&&u.push(i);if(t)for(s=0;s<o;s++)e.call(r,n[s])&&u.push(n[s]);return u}}());var r="undefined"!=typeof exports?exports:self,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(e){for(var t,o,r=String(e),s=0,u=i,a="";r.charAt(0|s)||(u="=",s%1);a+=u.charAt(63&t>>8-s%1*8)){if(o=r.charCodeAt(s+=.75),o>255)throw new n("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");t=t<<8|o}return a}),r.atob||(r.atob=function(e){var t=String(e).replace(/=+$/,"");if(t.length%4===1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,r,s=0,u=0,a="";r=t.charAt(u++);~r&&(o=s%4?64*o+r:r,s++%4)?a+=String.fromCharCode(255&o>>(-2*s&6)):0)r=i.indexOf(r);return a}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!("getComputedStyle"in e)&&(e.getComputedStyle=function(){function e(t,n,o,r){var i,s=n[o],u=parseFloat(s),a=s.split(/\d/)[0];return r=null!=r?r:/%|em/.test(a)&&t.parentElement?e(t.parentElement,t.parentElement.currentStyle,"fontSize",null):16,i="fontSize"===o?r:/width/i.test(o)?t.clientWidth:t.clientHeight,"em"===a?u*r:"in"===a?96*u:"pt"===a?96*u/72:"%"===a?u/100*i:u}function t(e,t){var n="border"===t?"Width":"",o=t+"Top"+n,r=t+"Right"+n,i=t+"Bottom"+n,s=t+"Left"+n;e[t]=(e[o]===e[r]===e[i]===e[s]?[e[o]]:e[o]===e[i]&&e[s]===e[r]?[e[o],e[r]]:e[s]===e[r]?[e[o],e[r],e[i]]:[e[o],e[r],e[i],e[s]]).join(" ")}function n(n){var o=n.currentStyle,r=this,i=e(n,o,"fontSize",null);for(property in o)/width|height|margin.|padding.|border.+W/.test(property)&&"auto"!==r[property]?r[property]=e(n,o,property,i)+"px":"styleFloat"===property?r["float"]=o[property]:r[property]=o[property];return t(r,"margin"),t(r,"padding"),t(r,"border"),r.fontSize=i+"px",r}function o(e){return new n(e)}return n.prototype={constructor:n,getPropertyPriority:function(){},getPropertyValue:function(e){return this[e]||""},item:function(){},removeProperty:function(){},setProperty:function(){},getPropertyCSSValue:function(){}},o}(this)),"document"in self&&("classList"in document.createElement("_")?!function(){"use strict";var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var n,o=arguments.length;for(n=0;n<o;n++)e=arguments[n],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:n.call(this,e)}}e=null}():!function(e){"use strict";if("Element"in e){var t="classList",n="prototype",o=e.Element[n],r=Object,i=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},s=Array[n].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},u=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},a=function(e,t){if(""===t)throw new u("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new u("INVALID_CHARACTER_ERR","String contains an invalid character");return s.call(e,t)},l=function(e){for(var t=i.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],o=0,r=n.length;o<r;o++)this.push(n[o]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},c=l[n]=[],f=function(){return new l(this)};if(u[n]=Error[n],c.item=function(e){return this[e]||null},c.contains=function(e){return e+="",a(this,e)!==-1},c.add=function(){var e,t=arguments,n=0,o=t.length,r=!1;do e=t[n]+"",a(this,e)===-1&&(this.push(e),r=!0);while(++n<o);r&&this._updateClassName()},c.remove=function(){var e,t,n=arguments,o=0,r=n.length,i=!1;do for(e=n[o]+"",t=a(this,e);t!==-1;)this.splice(t,1),i=!0,t=a(this,e);while(++o<r);i&&this._updateClassName()},c.toggle=function(e,t){e+="";var n=this.contains(e),o=n?t!==!0&&"remove":t!==!1&&"add";return o&&this[o](e),t===!0||t===!1?t:!n},c.toString=function(){return this.join(" ")},r.defineProperty){var p={get:f,enumerable:!0,configurable:!0};try{r.defineProperty(o,t,p)}catch(d){d.number===-2146823252&&(p.enumerable=!1,r.defineProperty(o,t,p))}}else r[n].__defineGetter__&&o.__defineGetter__(t,f)}}(self)),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n;if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),r=o.length>>>0;if(0===r)return-1;var i=+t||0;if(Math.abs(i)===1/0&&(i=0),i>=r)return-1;for(n=Math.max(i>=0?i:r-Math.abs(i),0);n<r;){if(n in o&&o[n]===e)return n;n++}return-1}),function(){function e(e,t){this._array=e,this._kind=t,this._nextIndex=0}e.prototype.next=function(){var e=this._nextIndex;return e>=this._array.length?{value:t,done:!0}:(this._nextIndex++,"key"===this._kind?{value:e,done:!1}:"value"===this._kind?{value:this._array[e],done:!1}:"key+value"===this._kind?{value:[e,this._array[e]],done:!1}:void 0)},Array.prototype.keys||(Array.prototype.keys=function(){return new e(this,"key")}),Array.prototype.values||(Array.prototype.values=function(){return new e(this,"value")}),Array.prototype.entries||(Array.prototype.entries=function(){return new e(this,"key+value")})}(),console.log2=function(e){e instanceof Object&&(e=JSON.stringify(e,null,2)),!!this.getRootElement.getElementById("error-log")&&(this.getRootElement.getElementById("error-log").innerHTML+=e+" \n")},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,n){"use strict";if(null===e||e===t)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(null!==i&&i!==t)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(o[s]=i[s])}return o},writable:!0,configurable:!0}),function(e){function t(){for(var e=0;e<C.length;e++)C[e][0](C[e][1]);C=[],h=!1}function n(e,n){C.push([e,n]),h||(h=!0,k(t,0))}function o(e,t){function n(e){s(t,e)}function o(e){a(t,e)}try{e(n,o)}catch(r){o(r)}}function r(e){var t=e.owner,n=t.state_,t=t.data_,o=e[n];if(e=e.then,"function"==typeof o){n=v;try{t=o(t)}catch(r){a(e,r)}}i(e,t)||(n===v&&s(e,t),n===b&&a(e,t))}function i(e,t){var n;try{if(e===t)throw new TypeError("A promises callback cannot return that same promise.");if(t&&("function"==typeof t||"object"===_typeof(t))){var o=t.then;if("function"==typeof o)return o.call(t,function(o){n||(n=!0,t!==o?s(e,o):u(e,o))},function(t){n||(n=!0,a(e,t))}),!0}}catch(r){return n||a(e,r),!0}return!1}function s(e,t){e!==t&&i(e,t)||u(e,t)}function u(e,t){e.state_===g&&(e.state_=m,e.data_=t,n(c,e))}function a(e,t){e.state_===g&&(e.state_=m,e.data_=t,n(f,e))}function l(e){var t=e.then_;for(e.then_=void 0,e=0;e<t.length;e++)r(t[e])}function c(e){e.state_=v,l(e)}function f(e){e.state_=b,l(e)}function p(e){if("function"!=typeof e)throw new TypeError("Promise constructor takes a function argument");if(!1==this instanceof p)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],o(e,this)}var d=e.Promise,y=d&&"resolve"in d&&"reject"in d&&"all"in d&&"race"in d&&function(){var e;return new d(function(t){e=t}),"function"==typeof e}();"undefined"!=typeof exports&&exports?(exports.Promise=y?d:p,exports.Polyfill=p):"function"==typeof define&&define.amd?define(function(){return y?d:p}):y||(e.Promise=p);var h,g="pending",m="sealed",v="fulfilled",b="rejected",w=function(){},k="undefined"!=typeof setImmediate?setImmediate:setTimeout,C=[];p.prototype={constructor:p,state_:g,then_:null,data_:void 0,then:function(e,t){var o={owner:this,then:new this.constructor(w),fulfilled:e,rejected:t};return this.state_===v||this.state_===b?n(r,o):this.then_.push(o),o.then},"catch":function(e){return this.then(null,e)}},p.all=function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("You must pass an array to Promise.all().");return new this(function(t,n){function o(e){return s++,function(n){i[e]=n,--s||t(i)}}for(var r,i=[],s=0,u=0;u<e.length;u++)(r=e[u])&&"function"==typeof r.then?r.then(o(u),n):i[u]=r;s||t(i)})},p.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("You must pass an array to Promise.race().");return new this(function(t,n){for(var o,r=0;r<e.length;r++)(o=e[r])&&"function"==typeof o.then?o.then(t,n):t(o)})},p.resolve=function(e){return e&&"object"===_typeof(e)&&e.constructor===this?e:new this(function(t){t(e)})},p.reject=function(e){return new this(function(t,n){n(e)})}}("undefined"!=typeof e?e:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<o;){var s=n[i];if(e.call(r,s,i,n))return s;i++}return t},configurable:!0,writable:!0});var s=!1,u=!1,a=!1,l="null",c=function(){function n(e,t,n){var o=btoa(JSON.stringify(e));r.ajax(r.getCliplisterDomain()+"lc/"+t+"/?"+o,function(e){try{for(var t=JSON.parse(e.responseText),o=0;o<t.length;o++){var r=t[o].request;"function"==typeof n[o]&&n[o](r)}}catch(i){"function"==typeof n[0]&&n[0](e.responseText)}})}var o=this,r=this,i={},c={},f={},p={};this.addViewer=function(e){i[e.prototype.version]=e},this.addStage=function(e){c[e.prototype.type]||(c[e.prototype.type]={}),c[e.prototype.type][e.prototype.version]||(c[e.prototype.type][e.prototype.version]=e)},this.addPlugin=function(e){f[e.prototype.name]||(f[e.prototype.name]={}),f[e.prototype.name][e.prototype.version]=e},this.ajax=function(){var t,n,o;if(2===arguments.length)t=arguments[0],n=arguments[1];else if(3===arguments.length)t=arguments[0],n=arguments[1],o=arguments[2];else if("undefined"!=typeof this._ajax)return this._ajax.apply(this,arguments);var r=null;!e.XDomainRequest&&e.XMLHttpRequest?(r=new XMLHttpRequest,r.open("GET",t,!0),r.timeout=5e3,r.onreadystatechange=function(){if(4===r.readyState){if(200===r.status&&""!==r.responseText)return"undefined"!=typeof n&&n(r),r;"undefined"!=typeof o?o(r):"undefined"!=typeof n&&n(""),r.abort()}}):(r=new XDomainRequest,r.timeout=5e3,r.onload=function(){n(r)},r.onprogress=function(){},r.ontimeout=function(){},r.onerror=function(){"undefined"!=typeof o&&o(r)},r.open("GET",t)),e.setTimeout(function(){r.send()},1)},this.getCliplisterDomain=function(){var t="http:";return"http:"!==e.location.protocol&&(t="https:"),u?(u.startsWith("http")||(u=e.location.protocol+"//"+u),u.endsWith("/")||(u+="/"),u):s?t+"//dev.mycliplister.com/":t+"//mycliplister.com/"},this.getShadowRoot=function(){return a},this.getRootElement=function(){return o.getShadowRoot()?document.getElementById(o.getShadowRoot()).shadowRoot:document},this.isDevelopment=function(){return s},this.preferHLS=function(){return"hls"===l},this.Viewer=function(t){"undefined"!=typeof t.overrideURL&&(u=t.overrideURL),"undefined"!=typeof t.streamtype&&(l=t.streamtype),"undefined"!=typeof t.dev&&"iknowwhatimdoing"===t.dev&&(s=!0),"undefined"!=typeof t.shadowRoot&&(a=t.shadowRoot);var n=document.createElement("video"),o=!!n.canPlayType&&navigator.appVersion.indexOf("MSIE 9")===-1,c=navigator.appVersion.indexOf("MSIE 9")!==-1;navigator.appVersion.indexOf("MSIE 10")!==-1;if(o){if(!(i.length>1))return i[Object.keys(i)[0]](t);if(t.version)return i[t.version](t);this.log("If multiple viewers are loaded, a version is required.",1)}else{if(!t.backgroundvideo){if(c){var f={clearInterval:function(){return!1},destroy:function(){return!1},enterFullscreen:function(){return f},leaveFullscreen:function(){return f},onFullscreenChange:function(e){return f},isFullscreen:function(){return!1},getCurrentBitrate:function(){return!1},getCurrentQuality:function(){return!1},getDuration:function(){return!1},getProgressPlayed:function(){return!1},getTimePlayed:function(){return!1},getTimePlayedMs:function(){return!1},getTimeBuffered:function(){return!1},getPercentBuffered:function(){return!1},getAssets:function(){return!1},getCurrentAssetIndex:function(){return!1},getNextAsset:function(){return!1},getPrevAsset:function(){return!1},getVideoDownloadLinks:function(){return!1},getVideoStreamingLinks:function(){return!1},playNextAsset:function(){return f},playPrevAsset:function(){return f},hidePlugin:function(e){return f},isDone:function(){return!1},isPlaying:function(){return!1},loadAsset:function(){return!1},mute:function(){return f},onReady:function(e){return f},onChange:function(e){return f},onInit:function(e){return f},onEnded:function(e){return f},onFinish:function(e){return f},onMute:function(e){return f},onPause:function(e){return f},onPlay:function(e){return f},onProgress:function(e){return f},onQualityChange:function(e){return f},onStop:function(e){return f},onTrack:function(e){return this},onUnmute:function(e){return f},pause:function(){return f},play:function(){return f},playAsset:function(){return!1},setVolume:function(e){return f},showPlugin:function(e){return f},stop:function(){return f},unmute:function(){return f},faster:function(){return f},slower:function(){return f},getHls:function(){return!1},adjustSize:function(){return f},onProgress0:function(e){return f},onProgress10:function(e){return f},onProgress20:function(e){return f},onProgress30:function(e){return f},onProgress40:function(e){return f},onProgress50:function(e){return f},onProgress60:function(e){return f},onProgress70:function(e){return f},onProgress80:function(e){return f},onProgress90:function(e){return f},onProgress100:function(e){return f}};if("undefined"!=typeof t.fallback&&"undefined"!=typeof t.fallback.ie9Mode&&"native"===t.fallback.ie9Mode){var p=function(e){function t(t){for(var n,o=Object.keys(e),i=o.length;i--;)n=o[i],e.hasOwnProperty(n)&&(e[n.toLowerCase()]=e[n],"keytype"===n.toLowerCase()&&("string"==typeof e[n.toLowerCase()]||e[n.toLowerCase()]instanceof String)&&("ean"===e[n.toLowerCase()].toLowerCase()?e[n.toLowerCase()]=0:"article"===e[n.toLowerCase()].toLowerCase()||"articlenumber"===e[n.toLowerCase()].toLowerCase()?e[n.toLowerCase()]=1e4:"videoid"===e[n.toLowerCase()].toLowerCase()?e[n.toLowerCase()]=500:"youtube"===e[n.toLowerCase()].toLowerCase()&&(e[n.toLowerCase()]=1)));"undefined"!=typeof e.assets&&(e.assetkeys=e.assets),"undefined"!=typeof e.language&&(e.languages=e.language),"undefined"!=typeof e.assettype&&(e.assetType=e.assettype),"undefined"!=typeof e.assetkind&&(e.assetKind=e.assetkind);var s={};s.SEO=!1,"undefined"!=typeof e.fsk&&(s.fsk=e.fsk),"undefined"!=typeof e.keytype&&(s.keytype=e.keytype),"undefined"!=typeof e.assetkeys&&(s.requestkey=e.assetkeys.join("|")),"undefined"!=typeof e.lang&&(s.lang=e.lang),"undefined"!=typeof e.languages&&(s.lang=e.languages.join(",")),"undefined"!=typeof e.slot&&(s.slot=e.slot),"undefined"!=typeof e.assetkind&&(s.assetkind=e.assetkind),"undefined"!=typeof e.assettype&&(s.assettype=e.assettype),"undefined"!=typeof e.output&&(s.output=e.output),"undefined"!=typeof e.bcuid&&(s.bcuid=e.bcuid),"undefined"!=typeof e.streamtype&&(s.kind="null"+("hls"===e.streamtype&&"-hls")),r.requestLiveConnectCall(s,e.customer,function(e){"undefined"!=typeof t&&t(e)})}y.controls=!0,y.autoplay="undefined"!=typeof e.autoplay&&e.autoplay,y.muted="undefined"!=typeof e.muted?e.muted:y.autoplay,y.style.width="100%",h.type="video/mp4",y.appendChild(h),f.destroy=function(){return y.parentNode&&y.parentNode.removeChild(y),f},f.play=function(){return y.play(),f},f.pause=function(){return y.pause(),f},f.stop=function(){return y.stop(),f},t(function(e){d(e)}),document.getElementById(e.parentId).appendChild(y)},d=function(e){var n=r.getCliplisterDomain()+"jplist/"+t.customer+"/"+e;t.plist&&(n=t.plist),r.ajax(n,function(e){if(!e)return console.error("Fatal Error"),!1;var t=JSON.parse(e.responseText);if(!(t.cliplist&&t.cliplist.clip&&t.cliplist.clip.clipurl))return console.error("Fatal Error"),!1;var n=t.cliplist.clip,o=n.clipurl,r="";h.src=o,"undefined"!=typeof n.previews&&"undefined"!=typeof n.previews.picture?r=n.previews.picture:"undefined"!=typeof n.thumbnail?r=n.thumbnail:"undefined"!=typeof n.prerolls&&"undefined"!=typeof n.prerolls.preroll&&"undefined"!=typeof n.prerolls.preroll.content&&(r=n.prerolls.preroll.content),y.poster=r})},y=document.createElement("video"),h=document.createElement("source");p(t)}else{var g=function(t){w||e.Cliplister.player({elementID:t.parentId,requestkey:t.assetKeys[0],slot:m,keytype:t.keyType,indirect:!1,autoplay:t.autoplay,size:"640x360",fsk:16,lang:"de,##,en",onReady:function(){w=this.api}},t.customer),e.Cliplister.reloadClips()},m="undefined"!=typeof t.fallback&&"undefined"!=typeof t.fallback.slot?t.fallback.slot:98;if(f.destroy=function(){if(w&&w.destroyStage(),w&&w.root.parentNode){for(var t=w.root.parentNode.querySelectorAll('div[id^="Cliplister_"]'),n=0;n<t.length;n++)t[n].parentNode.removeChild(t[n]);delete e.Cliplister.run,e.Cliplister.clips=[]}return f=null},f.play=function(){return w&&w.play(),f},f.pause=function(){return w&&w.pause(),f},f.stop=function(){return w&&w.stop(),f},"undefined"==typeof e.Cliplister.player){var v=document.createElement("script"),b=document.getElementsByTagName("script")[0],w=null;v.async=1,v.onload=function(){g(t)},v.src="https://mycliplister.com/static/clplayer/cllib.inc.170801.min.js",b.parentNode.insertBefore(v,b)}else g(t)}}else{var k=document.createElement("div");k.className="cliplister-viewer-notice",k.style.position="absolute",k.style.top="0px",k.style.left="0px";var C=document.createElement("img");C.src="undefined"!=typeof t.fallback?t.fallback.image:("https:"===e.location.protocol?"https:":"http:")+"//mycliplister.com/static/viewer/assets/fallback/outdated.png",C.style.backgroundColor="#FFFFFF",C.style.padding="10px",C.style.textAlign="center",C.style.height="100%",C.style.margin="auto",k.appendChild(C);var _=document.createElement("div");_.innerHTML='<a href="'+("undefined"!=typeof t.fallback?t.fallback.link:"https://www.google.com")+'">'+("undefined"!=typeof t.fallback?t.fallback.linktext:"https://www.google.com")+"</a>",_.style.backgroundColor="#FFFFFF",_.style.padding="10px",_.style.textAlign="center",k.style.backgroundColor="#FFFFFF",k.style.backgroundPosition="center center",k.style.backgroundSize="cover",k.style.width="100%",k.style.height="100%",this.getRootElement.getElementById(t.parentId).appendChild(k)}return f}var k=document.createElement("div");k.className="cliplister-viewer-background-fallback",k.style.position="absolute",k.style.top="0px",k.style.left="0px",k.style.backgroundColor="#FFFFFF",k.style.backgroundPosition="center center",k.style.backgroundSize="cover",k.style.width="100%",k.style.height="100%";var C=document.createElement("img");C.src="undefined"!=typeof t.fallback?t.fallback.bgimage:("https:"===e.location.protocol?"https:":"http:")+"//mycliplister.com/static/viewer/assets/fallback/outdated.png",C.style.backgroundColor="#FFFFFF",C.style.padding="0px",C.style.textAlign="center",C.style.width="100%",C.style.height="100%",C.style.margin="auto",k.appendChild(C),this.getRootElement.getElementById(t.parentId).appendChild(k)}},this.callStage=function(){return c.video["1.0"]()},this.getStage=function(e,n){return c[e]?1===Object.keys(c[e]).length?n!==t?c[e][n]?c[e][n]:void this.log("The "+e+" stage in version "+n+" is not loaded.",1):c[e][Object.keys(c[e])[0]]:n!==t?c[e][n]?c[e][n]:void this.log("The "+e+" stage in version "+n+" is not loaded.",1):void this.log("If multiple stages of the same type are loaded, a version is required.",1):void this.log("No stage of type "+e+" is loaded.",1)},this.getPlugin=function(e,n){return f[e]?1===Object.keys(f[e]).length?n!==t?f[e][n]?f[e][n]:void this.log("The plugin "+e+" in version "+n+" is not loaded.",1):f[e][Object.keys(f[e])[0]]:n!==t?f[e][n]?f[e][n]:void this.log("The plugin "+e+" in version "+n+" is not loaded.",1):void this.log("If multiple plugins with the same name are loaded, a version is required.",1):void this.log("No plugin "+e+" is loaded.",1)},this.log=function(e,t){console.debug(e)},this.requestLiveConnectCall=function(e,t,o){p[t]||(p[t]={timer:null,requests:[],callbacks:[]}),clearTimeout(p[t].timer),p[t].requests.push(e),p[t].callbacks.push(o),p[t].timer=setTimeout(function(){!function(e,t){n(e.requests,t,e.callbacks)}(p[t],t),p[t].requests=[],p[t].callbacks=[]},100)}};"undefined"==typeof e.Cliplister?e.Cliplister={}:"undefined"!=typeof e.Cliplister.ajax&&(e.Cliplister._ajax=e.Cliplister.ajax);var f=new c;e.Cliplister=o(e.Cliplister,f);var p=decodeURIComponent((new RegExp("[?|&]viewer_token=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null;p&&e.Cliplister.ajax("token/decrypt.php?t="+p,function(e){})}(window,void 0);"use strict";!function(window,undefined){var VERSION="1.40",CLViewer=function CLViewer(_params){function addEvent(e,t,n,s){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("test",a,a),window.removeEventListener("test",a,a)}catch(r){i=!1}i?e.addEventListener(t,n,s):e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}function removeEvent(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}function addMovementListener(e,t){movementListeners[e]||(movementListeners[e]={listeners:[]}),movementListeners[e].listeners.push(t),movementListeners[e].element&&triggerMovementListeners(movementListeners[e].element)}function animateElementPositionWithinInnerPlugin(e,t,n,s,i,a){var r=getPluginIdByElement(e);if(r){var o=getPluginById(r);if(o){o.animation!==undefined&&null!==o.animation&&clearInterval(o.animation);var l=0;exists(elements.innerPluginsContainer)&&(l=distanceToPx(n,"top"==t||"bottom"==t?parseInt(getComputedStyle(elements.innerPluginsContainer).height):parseInt(getComputedStyle(elements.innerPluginsContainer).width))),e.setAttribute("data-cl-animating",!0),enableCSSTransition(e,s,function(){e.removeAttribute("data-cl-animating"),i!==undefined&&i&&i()},!0),reSetElementPosition(e,t,l,!1,!1),repositionInnerPluginElement(e),triggerMovementListeners(e,!0,s)}}}function buildPlugins(){config.measures={availableWidth:config.dimensions.width,availableHeight:config.dimensions.height,offsets:{top:0,right:0,bottom:0,left:0}},buildOuterPlugins(),("iOS"===_platform.os.name&&_platform.os.version>="10"||"Android"===_platform.os.name)&&!params.assetType||buildInnerPlugins(),triggerListeners("pluginsBuilt")}function fullscreenListenerResizer(){return("Android"!==_platform.os.name||!_isFullscreen())&&(!!Resizer&&void setTimeout(function(){Resizer.check(!0)},100))}function buildInnerPlugins(){if(exists(elements.inner)){elements.innerPluginsContainer=document.createElement("div"),elements.innerPluginsContainer.style.position="absolute",elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px",elements.innerPluginsContainer.style.left=config.measures.offsets.left+"px",elements.innerPluginsContainer.style.zIndex=1,elements.innerPluginsContainer.height=config.dimensions.height-config.measures.offsets.top-config.measures.offsets.bottom,elements.innerPluginsContainer.width=config.dimensions.width-config.measures.offsets.left-config.measures.offsets.right,elements.innerPluginsContainer.style.width=elements.innerPluginsContainer.width+"px";var e=_platform.os.mobile;e=!(exists(params.plugins)&&exists(params.plugins)&&exists(params.plugins.InnerControls)&&exists(params.plugins.InnerControls.mobileDefaultControls)&&!params.plugins.InnerControls.mobileDefaultControls)&&e;"iOS"==_platform.os.name&&_platform.os.version>="10"&&e;elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px",elements.innerPluginsContainer.style.height=elements.innerPluginsContainer.height+"px",exists(params.assetType)&&"data"==params.assetType&&exists(params.assetKind)&&"pages"==params.assetKind&&(elements.innerPluginsContainer.style.display="none"),exists(params.allowOverflow)&&params.allowOverflow||(elements.innerPluginsContainer.style.overflow="hidden"),elements.inner.appendChild(elements.innerPluginsContainer),onMouseenter(elements.innerPluginsContainer,function(){triggerListeners("mouseover"),triggerListeners("mouseenter")}),onMouseleave(elements.innerPluginsContainer,function(){triggerListeners("mouseout"),triggerListeners("mouseleave")}),onMousedown(elements.innerPluginsContainer,function(e){triggerListeners("mousedown",e)}),onMouseup(elements.innerPluginsContainer,function(e){triggerListeners("mouseup",e)}),onMousemove(elements.innerPluginsContainer,function(e){triggerListeners("mousemove",e)});for(var t=0;t<config.plugins.visual.inner.length;t++){var n=config.plugins.visual.inner[t];n.getWrapper().style.position="absolute",n.getWrapper().style.zIndex=n.getLayer(),n.getWrapper().classList.add("cl-inner-plugin-container"),n.getWrapper().style.left="-1px",n.getWrapper().style.top="-1px",n.getWrapper().id=n.getId(),elements.innerPluginsContainer.appendChild(n.getWrapper())}getPluginApi().on("play",function(){!!Resizer&&Resizer.check(!0);var e=_platform.os.mobile;e=!(exists(params.plugins)&&exists(params.plugins)&&exists(params.plugins.InnerControls)&&exists(params.plugins.InnerControls.mobileDefaultControls)&&!params.plugins.InnerControls.mobileDefaultControls)&&e;var t="iOS"==_platform.os.name&&_platform.os.version>="10"&&e;elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px";var n="undefined"!=typeof elements.stageWrapper?getComputedStyle(elements.stageWrapper).height:getComputedStyle(elements.inner).height,s=elements.inner.clientHeight<elements.stageWrapper.clientHeight;if(_isFullscreen()&&parseInt(n)>parseInt(elements.innerPluginsContainer.style.height)+1)s?elements.innerPluginsContainer.style.top=0:elements.innerPluginsContainer.style.top=(parseInt(n)-parseInt(elements.innerPluginsContainer.style.height))/2+1+"px";else{var i=0;if(_isFullscreen()&&!e){i=parseInt(getComputedStyle(elements.inner).height)/2-parseInt(n)/2,s?elements.innerPluginsContainer.style.top=0:elements.innerPluginsContainer.style.top=_isPlaying()?0:i;var a=parseInt(getComputedStyle(elements.inner).height);"Safari"===_platform.browser.name&&(a=screen.height,elements.inner.style.height=a+"px"),elements.innerPluginsContainer.style.height=parseInt(getComputedStyle(elements.inner).height)+"px"}elements.stageWrapper.style.top=i+"px"}_isFullscreen()||(elements.innerPluginsContainer.style.height=e?elements.innerPluginsContainer.height-50+"px":elements.innerPluginsContainer.height+"px",elements.innerPluginsContainer.style.height=t?parseInt(elements.innerPluginsContainer.style.height)-43+"px":parseInt(elements.innerPluginsContainer.style.height)+"px",elements.innerPluginsContainer.style.top=t?parseInt(elements.innerPluginsContainer.style.top)+43+"px":parseInt(elements.innerPluginsContainer.style.top)+"px"),repositionInnerPluginElements()}),_features.fullscreen.fullscreenchange(function(){fullscreenListenerResizer()}),getPluginApi().on("pause",function(){!!Resizer&&Resizer.check(!0),repositionInnerPluginElements()}),getPluginApi().on("stop",function(){!!Resizer&&Resizer.check(!0),_isFullscreen()||(elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px",elements.innerPluginsContainer.style.height=elements.innerPluginsContainer.height+"px"),repositionInnerPluginElements()})}}function buildOuterPlugins(){!function(){config.plugins.visual.outer.sort(function(e,t){return e.priority==t.priority?0:e.priority>t.priority?1:-1})}(),function(){for(var e=0;e<config.plugins.visual.outer.length;e++)config.plugins.visual.outer[e].priority=e}(),function e(t){if(config.stage||(config.stage={}),params.stage){var n=capitalizeFirstLetter(t);if(params.stage[t]){var s=distanceToPx(params.stage[t],config[t]);params.stage["min"+n]&&params.stage["min"+n]>s?config.stage[t]=params.stage["min"+n]:params.stage["max"+n]&&params.stage["max"+n]<s?config.stage[t]=params.stage["max"+n]:config.stage[t]=s,config.measures["available"+n]-=config.stage[t]}else params.stage["min"+n]&&(config.stage["min"+n]=params.stage["min"+n],config.measures["available"+n]-=config.stage["min"+n]),params.stage["max"+n]&&(config.stage["max"+n]=params.stage["max"+n])}return e}("width")("height"),function(){if(params.stage&&params.stage.aspectRatio){var e=params.stage.aspectRatio.split(":");if(params.stage.width&&!params.stage.height){var t=config.stage.width/e[0]*e[1];config.stage.minHeight&&t<config.stage.minHeight?config.stage.height=config.stage.minHeight:params.stage.maxHeight&&t>config.stage.maxHeight?config.stage.height=config.stage.maxHeight:config.stage.height=t,exists(config.stage.minHeight)&&(config.measures.availableHeight+=config.stage.minHeight),config.measures.availableHeight-=config.stage.height}else if(params.stage.height&&!params.stage.width){var n=config.stage.height/e[0]*e[1];config.stage.minWidth&&n<config.stage.minWidth?config.stage.width=config.stage.minWidth:params.stage.maxWidth&&n>config.stage.maxWidth?config.stage.width=config.stage.maxWidth:config.stage.width=n,exists(config.stage.minWidth)&&(config.measures.availableWidth+=config.stage.minWidth),config.measures.availableWidth-=config.stage.width}}}(),function(){for(var e=0;e<config.plugins.visual.outer.length;e++){var t,n,s=config.plugins.visual.outer[e];if("top"==s.position||"bottom"==s.position?(s.align="horizontal",t="height",n="Height"):(s.align="vertical",t="width",n="Width"),s.getParams()[t]){s.dynamic=!1;var i=distanceToPx(s.getParams()[t],config[t]);s.getParams()["min"+n]&&s.getParams()["min"+n]>i?s[t]=s.getParams()["min"+n]:s.getParams()["max"+n]&&s.getParams()["max"+n]<i?s[t]=s.getParams()["max"+n]:s[t]=i,s[t]<=config.measures["available"+n]?config.measures["available"+n]-=s[t]:s.hidden=!0}else s.dynamic=!0,s.getParams()["min"+n]&&(s["min"+n]=s.getParams()["min"+n],s.getParams()["min"+n]<=config.measures["available"+n]?config.measures["available"+n]-=s.getParams()["min"+n]:s.hidden=!0),s.getParams()["max"+n]&&(s["max"+n]=s.getParams()["max"+n])}}(),function(){var e=new Array,t=new Array,n=0,s=new Array,i=new Array,a=0;!function(){for(var r=0;r<config.plugins.visual.outer.length;r++){var o=config.plugins.visual.outer[r];!o.hidden&&o.dynamic&&("vertical"==o.align?(e.push(o),n++,o.minWidth&&(t.push(o),config.measures.availableWidth+=o.minWidth)):"horizontal"==o.align&&(s.push(o),a++,o.minHeight&&(i.push(o),config.measures.availableHeight+=o.minHeight)))}}(),!config.stage.height&&config.stage.minHeight&&(config.measures.availableHeight+=config.stage.minHeight),!config.stage.width&&config.stage.minWidth&&(config.measures.availableWidth+=config.stage.minWidth);var r,o=config.stage.width?0:1,l=config.measures.availableWidth/(n+o);do{r=!1;for(var u=0;u<t.length;u++){var g=t[u];if(!g.width&&g.minWidth>l){g.width=g.minWidth,n--,config.measures.availableWidth-=g.width,l=config.measures.availableWidth/(n+o),r=!0;break}}}while(r);!config.stage.width&&config.stage.minWidth&&config.stage.minWidth>l&&(config.stage.width=config.stage.minWidth,o=0,config.measures.availableWidth-=config.stage.width,l=config.measures.availableWidth/(n+o));do{r=!1;for(var u=0;u<e.length;u++){var g=e[u];if(!g.width&&l>g.maxWidth){g.width=g.maxWidth,n--,config.measures.availableWidth-=g.width,l=config.measures.availableWidth/(n+o),r=!0;break}}}while(r);for(var u=0;u<e.length;u++){var g=e[u];g.width||(g.width=l)}var c=config.stage.height?0:1,p=config.measures.availableHeight/(a+c);do{r=!1;for(var u=0;u<i.length;u++){var g=i[u];if(!g.height&&g.minHeight>p){g.height=g.minHeight,a--,config.measures.availableHeight-=g.height,p=config.measures.availableHeight/(a+c),r=!0;break}}}while(r);!config.stage.height&&config.stage.minHeight&&config.stage.minHeight>p&&(config.stage.height=config.stage.minHeight,c=0,config.measures.availableHeight-=config.stage.height,p=config.measures.availableHeight/(a+c));do{r=!1;for(var u=0;u<s.length;u++){var g=s[u];if(!g.height&&p>g.maxHeight){g.height=g.maxHeight,a--,config.measures.availableHeight-=g.height,p=config.measures.availableHeight/(a+c),r=!0;break}}}while(r);for(var u=0;u<s.length;u++){var g=s[u];g.height||(g.height=p)}}(),function(){for(var e=0;e<config.plugins.visual.outer.length;e++){var t=config.plugins.visual.outer[e];if(!t.hidden){t.getWrapper().style.position="absolute",t.getWrapper().classList.add("cl-outer-plugin-container"),t.getWrapper().style.display=t.hidden?"none":"block";var n,s,i=["top","right","bottom","left"];"horizontal"==t.align?(s="height",n="top"==t.position?0:2):(s="width",n="right"==t.position?1:3),t.getWrapper().style[i[n]]=config.measures.offsets[i[n]]+"px",t.getWrapper().style[i[(n-1+4)%4]]=config.measures.offsets[i[(n-1+4)%4]]+"px",t.getWrapper().style[i[(n+1+4)%4]]=config.measures.offsets[i[(n+1+4)%4]]+"px",t.getWrapper().style[s]=t[s]+"px",t.getWrapper().id=t.getId(),config.measures.offsets[i[n]]+=t[s],elements.inner.appendChild(t.getWrapper())}}}(),config.stage.params=params.stage}function callIntervalFunctions(){for(var e=0;e<interval.timeouts.length;e++){var t=interval.timeouts[e];if(interval.counter%t==0)for(var n=0;n<interval.fns[t].length;n++)interval.fns[t][n]()}interval.counter=interval.counter==interval.maxTimeout-interval.globalTimeout?0:1*interval.counter+1*interval.globalTimeout}function callStage(e,t){return!(!exists(stage)||!exists(stage[e]))&&(t=Array.isArray(t)?t:[t],stage[e].apply(stage,t))}function camelCaseToDashed(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}function capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}function clearInterval(e){if(window.clearInterval(interval.instance),Resizer.checkInterval&&window.clearInterval(Resizer.checkInterval),e&&e.timeout&&interval.fns[e.timeout]){var t=interval.fns[e.timeout].indexOf(e);if(t>-1){interval.fns[e.timeout].splice(t,1);var n=interval.timeouts.indexOf(e.timeout);n>-1&&interval.timeouts.splice(n,1)}}}function collectAssetsInformation(){}function dashedToCamelCase(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})}function dataset(e,t,n){if("undefined"!=typeof document&&document.head){var s=function(t,n){o?e.dataset[t]=n:e.setAttribute("data-"+camelCaseToDashed(t),n)},i=function(t){return o?e.dataset[t]:e.getAttribute("data-"+camelCaseToDashed(t))},a=function(t){o?delete e.dataset[t]:e.removeAttribute("data-"+camelCaseToDashed(t))},r=function(){if(o){for(var t=e.dataset,n=Object.keys(t),s={},i=0;i<n.length;i++)s[n[i]]=t[n[i]];return s}for(var a=e.attributes,n=Object.keys(a),s={},i=0;i<n.length;i++)/^data\-(.+)$/.test(a[i].nodeName)&&(s[a[i].nodeName]=a[i].nodeValue);return s},o=!!document.head.dataset,l={set:s,get:i,del:a,toObject:r};return 3===arguments.length?s(t,n):2==arguments.length?i(t):l}}function debug(){return{}}function dieAndRiseAgain(){_destroy(),init(params)}function _destroy(){if(config&&config.parent&&elements.inner){_stop(),clearInterval();try{!!stage&&stage.setProgressPlayed&&stage.setProgressPlayed(0);var e=!!stage&&!!stage.getVideoElement&&stage.getVideoElement();!!e&&e.pause(),!!e&&!!e.src&&(e.src=""),"Firefox"===_platform.browser.name&&!!e&&!!e.src&&e.removeAttribute("src"),!!e&&e.load()}catch(t){console.info(t)}config.parent.removeChild(elements.inner);for(var n in elements)delete elements[n];for(var s in listeners)delete listeners[s];_features.fullscreen&&(_features.fullscreen.offFullscreenchange(function(){fullscreenListener()}),_features.fullscreen.offFullscreenchange(function(){fullscreenListenerResizer()}));for(var i in _features)delete _features[i];Resizer=!1}}function detectPlatform(){_platform.os={name:"os",version:0,mobile:!1},_platform.browser={name:"",version:0,html5:{basic:!1,h264:"",ogg:"",webm:""}};var e=navigator.userAgent,t=document.createElement("video");if(_platform.browser.html5.basic=!!t.canPlayType,_platform.browser.html5.basic&&(_platform.browser.html5.h264=t.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'),_platform.browser.html5.ogg=t.canPlayType('video/ogg; codecs="theora, vorbis"'),_platform.browser.html5.webm=t.canPlayType('video/webm; codecs="vp8, vorbis"')),_platform.os.isIPad=!!(e.match(/(iPad)/i)||"MacIntel"===navigator.platform&&"undefined"!=typeof navigator.standalone),_platform.os.mobile=!!e.match(/(iPad)|(iPhone)|(iPod)|(android)|(windows phone)/i)||_platform.os.isIPad,_platform.os.mobile?(/Android[\/\s](\d+(\.\d+)?)/.test(e)&&(_platform.os.name="Android",_platform.os.version=new Number(RegExp.$1)),/Windows[\/\s](\d+\.\d+)/.test(e)&&(_platform.os.name="Windows Phone",_platform.os.version=new Number(RegExp.$1)),(/(iPhone|iPad|iPod).*( \d+_\d+)/.test(e)||_platform.os.isIPad)&&(_platform.os.name="iOS",_platform.os.version=parseInt(RegExp.$1)?parseInt(RegExp.$1):parseInt(RegExp.$2),Number.isNaN(_platform.os.version)&&(_platform.os.version=e.match(/Version\/(\d+\.\d+)/)[1]))):(/Windows NT[\/\s](\d+\.\d+)/.test(e)&&(_platform.os.name="Windows NT",_platform.os.version=new Number(RegExp.$1)),/OS X[\/\s](\d+_\d+)/.test(e)&&(_platform.os.name="OS X",_platform.os.version=new Number(RegExp.$1))),_platform.os.mobile)/Firefox[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="FirefoxMobile",_platform.browser.version=new Number(RegExp.$1)):/IEMobile[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="IEMobile",_platform.browser.version=new Number(RegExp.$1)):/Edge[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="EdgeMobile",_platform.browser.version=new Number(RegExp.$1)):/Opera[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="OperaMobile",_platform.browser.version=new Number(RegExp.$1)):/(Chrome|CriOS)[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="ChromeMobile",_platform.browser.version=new Number(RegExp.$2)):/Safari[\/\s](\d+\.\d+)/.test(e)&&(_platform.browser.name="SafariMobile",_platform.browser.version=new Number(RegExp.$1));else if(/Firefox[\/\s](\d+\.\d+)/.test(e))_platform.browser.name="Firefox",_platform.browser.version=new Number(RegExp.$1);else if(e.indexOf("MSIE")!=-1||e.indexOf("Trident")!=-1){if(e.indexOf("MSIE")!=-1)var n=/MSIE (\d+\.\d+)/;else var n=/Trident.*rv[ :]*(\d+\.\d+)/;n.test(e)&&(_platform.browser.name="IE",_platform.browser.version=new Number(RegExp.$1))}else/Edge[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="Edge",_platform.browser.version=new Number(RegExp.$1)):/OPR\/(\d+\.\d+)/i.test(e)?(_platform.browser.name="Opera",_platform.browser.version=new Number(RegExp.$1)):/Opera[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="Opera",_platform.browser.version=new Number(RegExp.$1)):/Chrome[\/\s](\d+\.\d+)/.test(e)?(_platform.browser.name="Chrome",_platform.browser.version=new Number(RegExp.$1)):/Safari[\/\s](\d+\.\d+)/.test(e)&&(_platform.browser.name="Safari",_platform.browser.version=new Number(RegExp.$1));return _platform}function detectFeatures(){var e=document.createElement("div");e.requestFullscreen?_features.fullscreen={exitFullscreen:function(){document.exitFullscreen()},fullscreenchange:function(e){addEvent(document,"fullscreenchange",function(){e()})},offFullscreenchange:function(e){removeEvent(document,"fullscreenchange",function(){e()})},fullscreenElement:function(){return document.fullscreenElement},fullscreenEnabled:function(){return document.fullscreenEnabled},isFullscreen:function(){return!!this.fullscreenElement()},requestFullscreen:function(e){e.requestFullscreen(),e.stylebackup=JSON.parse(JSON.stringify(e.style)),e.style.width="100%",e.style.height="100%"}}:e.mozRequestFullScreen?_features.fullscreen={exitFullscreen:function(){document.mozCancelFullScreen(),callStage("leaveFullscreen")},fullscreenchange:function(e){addEvent(document,"mozfullscreenchange",function(){e()})},offFullscreenchange:function(e){removeEvent(document,"mozfullscreenchange",function(){e()})},fullscreenElement:function(){return document.mozFullScreenElement},fullscreenEnabled:function(){return document.mozFullScreenEnabled},isFullscreen:function(){return!!this.fullscreenElement()},requestFullscreen:function(e){e.requestFullscreen?(e.requestFullscreen(),e.stylebackup=JSON.parse(JSON.stringify(e.style))):e.mozRequestFullScreen(),e.style.width="100%",e.style.height="100%"}}:e.webkitRequestFullScreen?_features.fullscreen={exitFullscreen:function(){document.webkitExitFullscreen(),callStage("exitFullscreen")},fullscreenchange:function(e){var t="iOS"==_platform.os.name&&_platform.os.version>="12",n=t;if(n){var s=function(){var t=!!stage&&!!stage.getVideoElement&&stage.getVideoElement();t&&(addEvent(t,"webkitbeginfullscreen",function(){document.fullscreenElement=t,document.webkitFullscreenElement=t,e()}),addEvent(t,"webkitendfullscreen",function(){document.fullscreenElement=null,document.webkitFullscreenElement=null,e()}))};_isDone("stageSet")?s():on("stageSet",s)}else addEvent(document,"webkitfullscreenchange",function(){if("iOS"==_platform.os.name)if(config.fullscreen)document.fullscreenElement=null,document.webkitFullscreenElement=null;else{var t=!!stage&&!!stage.getVideoElement&&stage.getVideoElement();document.fullscreenElement=t,document.webkitFullscreenElement=t}config.fullscreen=!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement),e()})},offFullscreenchange:function(e){removeEvent(document,"webkitfullscreenchange",e)},fullscreenElement:function(){return document.webkitFullscreenElement},fullscreenEnabled:function(){return document.webkitFullscreenEnabled},isFullscreen:function(){return!!this.fullscreenElement()},requestFullscreen:function(e){elements.innerPluginsContainer.style.width="100%",elements.innerPluginsContainer.style.height="100%",e.webkitRequestFullscreen(),e.stylebackup=JSON.parse(JSON.stringify(e.style)),e.style.width="100%",e.style.height="100%"}}:e.msRequestFullscreen?_features.fullscreen={exitFullscreen:function(){document.msExitFullscreen(),callStage("leaveFullscreen"),elements.inner.style=elements.inner.stylebackup},fullscreenchange:function(e){addEvent(document,"MSFullscreenChange",function(){e()})},offFullscreenchange:function(e){removeEvent(document,"MSFullscreenChangee",function(){e()})},fullscreenElement:function(){return document.msFullscreenElement},fullscreenEnabled:function(){return document.msFullscreenEnabled},isFullscreen:function(){return!!this.fullscreenElement()},requestFullscreen:function(e){e.msRequestFullscreen(),e.stylebackup=JSON.parse(JSON.stringify(e.style)),e.style.width="100%",e.style.height="100%"}}:_features.fullscreen={exitFullscreen:function(){callStage("exitFullscreen")},fullscreenchange:function(e){on("stageSet",function(){callStage("onFullscreenChange",[e])},{subsequent:!0})},offFullscreenchange:function(){},fullscreenEnabled:function(){return callStage("isFullscreen")},isFullscreen:function(){return callStage("isNativeFullscreen")},requestFullscreen:function(){callStage("enterFullscreen")}}}function disableCSSTransition(e){e&&(e.style["-webkit-transition"]="none",e.style["-o-transition"]="none",e.style["-moz-transition"]="none",e.style["-ms-transition"]="none",e.style.transition="none")}function distanceToPx(e,t){var n=parseInt(e),s=/%$/.test(e);return s?parseInt(t)*(n/100):n}function enableCSSTransition(e,t,n,s){function i(){var t,n={transition:"transitionend","-o-transition":"oTransitionEnd","-moz-transition":"mozTransitionEnd","-webkit-transition":"webkitTransitionEnd"};for(t in n)if(e.style[t]!==undefined)return{css:t,endEvent:n[t]}}var a=i();if(e.style[a.css]="all "+t+"ms",s!==undefined&&s){var r=function o(){disableCSSTransition(e),removeEvent(e,a.endEvent,o),n!==undefined&&n()};addEvent(e,a.endEvent,r)}}function enableMovementListening(e,t){movementListeners[e]?(movementListeners[e].element=t,triggerMovementListeners(t)):movementListeners[e]={element:t,listeners:[]}}function _enterFullscreen(){_platform.os.mobile?stage.enterFullscreen():_features.fullscreen.requestFullscreen(elements.inner)}function exists(e){return"undefined"!=typeof e}function extend(){var e={},t=!1,n=0,s=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var i=function(n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t&&"[object Object]"===Object.prototype.toString.call(n[s])?e[s]=extend(!0,e[s],n[s]):e[s]=n[s])};n<s;n++){var a=arguments[n];i(a)}return e}function getAsset(){return loadedAsset}function getAssetPosition(){return currentAssetIndex}function _getNextAsset(){return getAssetPosition()+1===products[0].assets.length?getAssetPosition():currentAssetIndex+1}function _getPrevAsset(){return 0===getAssetPosition()?0:currentAssetIndex-1}function isFirstAsset(){return 0===getAssetPosition()}function isLastAsset(){return getAssetPosition()+1===products[0].assets.length}function getCostumer(){return params.customer}function getBackgroundColor(){return config.backgroundColor}function _getCurrentBitrate(){return callStage("getCurrentBitrate")}function _getCurrentQuality(){return callStage("getCurrentQuality")}function _getDuration(){return"undefined"==typeof stage||isNaN(callStage("getDuration"))?loadedAsset.duration:callStage("getDuration")}function _getVideoDownloadLinks(){return!(!exists(loadedAsset)||!exists(loadedAsset.downloadLinks)||null==loadedAsset.downloadLinks)&&(Array.isArray(loadedAsset.downloadLinks)?loadedAsset.downloadLinks:[loadedAsset.downloadLinks])}function _getVideoStreamingLinks(){return!(!exists(loadedAsset)||!exists(loadedAsset.streamingLinks)||null==loadedAsset.streamingLinks)&&(Array.isArray(loadedAsset.streamingLinks)?loadedAsset.streamingLinks:[loadedAsset.streamingLinks])}function getFetchedImage(e){if("function"==typeof fetch)return!(!exists(fetched_images[e])||""===fetched_images[e])&&fetched_images[e];var t=e.slice(-4),n="";return".jpg"===t||"jpeg"===t?n="jpg":".png"===t?n="png":".gif"===t?n="gif":".tif"===t&&(n="tif"),exists(fetched_images[e])&&""!==fetched_images[e]||(fetched_images[e]=n?e:e),fetched_images[e]}function fetchImage(e){var t=getFetchedImage(e);return"function"==typeof Promise?t?new Promise(function(e,n){e(t)}):(fetched_images[e]="",fetched_images[e]=fetch(e).then(function(e){return e.blob()}).then(function(t){return fetched_images[e]=URL.createObjectURL(t),fetched_images[e]}),fetched_images[e]):t}function setBGImage(e,t){if(!exists(e))return!1;if(exists(t)&&t&&""!==t){var n,s;"function"==typeof Promise?Array.isArray(t)?(n=t,s=n.map(function(e){return e instanceof Promise?e.then(function(e){return"url("+e+")"}):e.includes("gradient")?e:fetchImage(e).then(function(e){return"url("+e+")"})}),Promise.all(s).then(function(t){e.style.backgroundImage=t.join()})):fetchImage(t).then(function(t){e.style.backgroundImage="url("+t+")"}):Array.isArray(t)?(n=t,s=n.map(function(e){return e.includes("gradient")?e:"url("+fetchImage(e)+")"}),e.style.backgroundImage=s.join()):e.style.backgroundImage="url("+fetchImage(t)+")"}else e.style.backgroundImage="none";return e}function setImgSrc(e,t){return!(!exists(e)||!exists(t))&&(t?"function"==typeof Promise?fetchImage(t).then(function(t){e.src=t}):e.src=fetchImage(t):e.src="",e)}function setPluginsClickThrough(e){exists(elements.innerPluginsContainer)&&(exists(e)||(e=!1),elements.innerPluginsContainer.style.pointerEvents=e?"none":"all")}function setStageAspect(e,t){params.stage.aspectRatio=e+":"+t,!!Resizer&&Resizer.check(!0)}function setActiveSubtitleTrack(e,t){triggerListeners("activeSubtitleSet",{kind:e,tag:t})}function setSubtitleTracks(e){params.subtitletracks=e,triggerListeners("subtitlesSet")}function getSubtitleTracks(){return params.subtitletracks}function isSubtitlesEnabled(){return params.subtitlesEnabled}function setSubtitlesEnabled(e){params.subtitlesEnabled=!!e,triggerListeners("subtitles".concat(e?"En":"Dis","able"))}function setActiveTranscriptTrack(e){triggerListeners("activeTranscriptSet",e)}function setTranscriptTracks(e){params.transcripttracks=e,triggerListeners("transcriptSet")}function getTranscriptTracks(){return params.transcripttracks}function isTranscriptEnabled(){return params.transcriptEnabled}function setTranscriptEnabled(e){params.transcriptEnabled=!!e,triggerListeners("transcript".concat(e?"En":"Dis","able"))}function appendNativeSubtitles(e,t,n,s){_isDone("stageSet")?stage.appendNativeSubtitles(e,t,n,s):on("stageSet",function(){stage.appendNativeSubtitles(e,t,n,s)})}function getFixedQuality(){return!!exists(params.fixedQuality)&&params.fixedQuality}function isDeviceLandscape(){return!screen||screen.availWidth>screen.availHeight}function getPlugInParam(e,t){var n,s,i;return null===(n=params)||void 0===n?void 0:null===(s=n.plugins)||void 0===s?void 0:null===(i=s[e])||void 0===i?void 0:i[t]}function getPublicApi(){return{clearInterval:clearInterval,destroy:function(){_destroy()},enterFullscreen:function(){return _enterFullscreen(),getPublicApi()},leaveFullscreen:function(){return _leaveFullscreen(),getPublicApi()},onFullscreenChange:function(e){return on("fullscreenChange",e),getPublicApi()},isFullscreen:function(){return _isFullscreen()},getCurrentBitrate:function(){return _getCurrentBitrate()},getCurrentQuality:function(){return _getCurrentQuality()},getDuration:function(){return _getDuration()},getProgressPlayed:function(){return _getProgressPlayed()},getTimePlayed:function(){return _getTimePlayed()},getTimePlayedMs:function(){return 1e3*_getTimePlayed()},getTimeBuffered:function(){return _getTimeBuffered()},getPercentBuffered:function(){return _getPercentBuffered()},getAssets:function(){return products[0].assets},getProducts:function(){return products},getCurrentAssetIndex:function(){return getAssetPosition()},getNextAsset:function(){return _getNextAsset()},getPrevAsset:function(){return _getPrevAsset()},getVideoDownloadLinks:function(){return _getVideoDownloadLinks()},getVideoStreamingLinks:function(){return _getVideoStreamingLinks()},playNextAsset:function(){return _playNextAsset(),getPublicApi()},playPrevAsset:function(){return playAsset(_getPrevAsset()),getPublicApi()},hidePlugin:function(e){return _hidePlugin(e),getPublicApi()},isDone:function(){return _isDone()},isPlaying:function(){return _isPlaying()},loadAsset:loadAsset,mute:function(){return _mute(),getPublicApi()},onReady:function(e){return on("mediaReady",e),getPublicApi()},onChange:function(e){return this.onReady(e),getPublicApi()},onInit:function(e){return on("initDone",e),getPublicApi()},onEnded:function(e){return on("finish",e),getPublicApi()},onFinish:function(e){return on("finish",e),getPublicApi()},onMute:function(e){return on("mute",e),getPublicApi()},onPause:function(e){return on("pauseMedia",e),getPublicApi()},onPlay:function(e){return on("playMedia",e),getPublicApi()},onUserPlay:function(e){return on("userPlay",e),getPublicApi()},onInitialPlay:function(e){return on("initialPlay",e),getPublicApi()},onProgress:function(e){return on("progress",e),getPublicApi()},onUserQualityChange:function(e){return on("userQualityChange",function(){_isDone("mediaReady")&&e()}),getPublicApi()},onQualityChange:function(e){return on("qualityChange",function(){_isDone("mediaReady")&&e()}),getPublicApi()},onStop:function(e){return on("stopMedia",e),getPublicApi()},onTrack:function(e){return on("track",e),getPublicApi()},onUnmute:function(e){return on("unmute",e),getPublicApi()},pause:function(){return _pause(),getPublicApi()},play:function(){return playPubAPI(),getPublicApi()},playAsset:playAsset,setVolume:function(e){return _setVolume(e),getPublicApi()},showPlugin:function(e){return _showPlugin(e),getPublicApi()},stop:function(){return _stop(),getPublicApi()},unmute:function(){return _unmute(),getPublicApi()},faster:function(){return _faster(),getPublicApi()},slower:function(){return _slower(),getPublicApi()},getHls:function(){return hls()},adjustSize:function(){return!!Resizer&&Resizer.check(!0),getPublicApi()},onProgress0:function(e){return on("progress0",e),getPublicApi()},onProgress10:function(e){return on("progress10",e),getPublicApi()},onProgress20:function(e){return on("progress20",e),getPublicApi()},onProgress30:function(e){return on("progress30",e),getPublicApi()},onProgress40:function(e){return on("progress40",e),getPublicApi()},onProgress50:function(e){return on("progress50",e),getPublicApi()},onProgress60:function(e){return on("progress60",e),getPublicApi()},onProgress70:function(e){return on("progress70",e),getPublicApi()},onProgress80:function(e){return on("progress80",e),getPublicApi()},onProgress90:function(e){return on("progress90",e),getPublicApi()},onProgress100:function(e){return on("progress100",e),getPublicApi()},setProgressPlayed:function(e){return _setProgressPlayed(e),getPublicApi()},setTimePlayed:function(e){return _setTimePlayed(e),getPublicApi()},activateAR:function(){return _activateAR(),getPublicApi()},showQr:function(){return _showQr(),getPublicApi()},hideQr:function(){return _hideQr(),getPublicApi()},getRotationCenter:function(){return _getRotationCenter()},
getOrbitPosition:function(){return _getOrbitPosition()},setRotationCenter:function(e,t,n){return _setOrbitPosition(e,t,n),getPublicApi()},setOrbitPosition:function(e,t,n,s){return _setOrbitPosition(e,t,n,s),getPublicApi()},setOrbitPositionFront:function(e){return _setOrbitPosition(0,90,105,e),getPublicApi()},setOrbitPositionBack:function(e){return _setOrbitPosition(180,90,105,e),getPublicApi()},setOrbitPositionTop:function(e){return _setOrbitPosition(0,0,105,e),getPublicApi()},setOrbitPositionBottom:function(e){return _setOrbitPosition(0,180,105,e),getPublicApi()},setOrbitPositionLeft:function(e){return _setOrbitPosition(90,90,105,e),getPublicApi()},setOrbitPositionRight:function(e){return _setOrbitPosition(270,90,105,e),getPublicApi()},setExposure:function(e){return _setExposure(e),getPublicApi()},setShadowIntensity:function(e){return _setShadowIntensity(e),getPublicApi()},setShadowSoftness:function(e){return _setShadowSoftness(e),getPublicApi()},getExposure:function(){return _getExposure()},getShadowSoftness:function(){return _getShadowSoftness()},getShadowIntensity:function(){return _getShadowIntensity()}}}function getPluginApi(){return{Counter:Counter,addEvent:addEvent,removeEvent:removeEvent,addMovementListener:addMovementListener,ajax:cl.ajax,animateElementPosition:animateElementPositionWithinInnerPlugin,clearInterval:clearInterval,dashSeparatedToCamelCase:dashedToCamelCase,dataset:dataset,disableCSSTransition:disableCSSTransition,distanceToPx:distanceToPx,enableCSSTransition:enableCSSTransition,enableMovementListening:enableMovementListening,enterFullscreen:_enterFullscreen,exists:exists,extend:extend,features:function(){return _features},platform:function(){return _platform},isIOS10:function(){return"iOS"==_platform.os.name&&_platform.os.version>="10"},getAsset:getAsset,loadAsset:loadAsset,playAsset:playAsset,getNextAsset:_getNextAsset,getPrevAsset:_getPrevAsset,isFirstAsset:isFirstAsset,isLastAsset:isLastAsset,playNextAsset:_playNextAsset,playPrevAsset:function(){playAsset(_getPrevAsset())},getAssetPosition:getAssetPosition,getCostumer:getCostumer,getProducts:function(){return products},getBackgroundColor:getBackgroundColor,getCurrentBitrate:_getCurrentBitrate,getCurrentQuality:_getCurrentQuality,getVidSrc:getVidSrc,getDuration:_getDuration,getPluginById:getPluginById,getPluginIdByElement:getPluginIdByElement,getProgressPlayed:_getProgressPlayed,getStageDimension:getStageDimension,getTimePlayed:_getTimePlayed,getTimeBuffered:_getTimeBuffered,getPercentBuffered:_getPercentBuffered,getVolume:getVolume,getVideoDownloadLinks:_getVideoDownloadLinks,getVideoStreamingLinks:_getVideoStreamingLinks,hideCursor:hideCursor,hidePlugin:_hidePlugin,isLooping:isLooping,isPlayNext:isPlayNext,isDone:_isDone,isFullscreen:_isFullscreen,fullscreenListener:fullscreenListener,isMuted:isMuted,isPlaying:_isPlaying,isQualityOverride:isQualityOverride,isStopped:isStopped,leaveFullscreen:_leaveFullscreen,log:cl.log,mute:_mute,off:off,on:on,onMouseenter:onMouseenter,onMouseleave:onMouseleave,onMousedown:onMousedown,onMouseup:onMouseup,onMousemove:onMousemove,onPlay:function(e){on("play",e)},onInitialPlay:function(e){on("initialPlay",e)},onProgress:function(e){on("progress",e)},onTimeupdate:function(e){on("timeupdate",e)},onPluginsBuilt:function(e){on("pluginsBuilt",e)},onStageReady:function(e){on("stageReady",e)},onResize:function(e){on("resize",e)},pad:pad,pause:_pause,play:play,setElementPosition:setElementPositionWithinInnerPlugin,setElementSize:setElementSizeWithinInnerPlugin,setProgressPlayed:_setProgressPlayed,setTimePlayed:_setTimePlayed,setQuality:setQuality,setVolume:_setVolume,showCursor:showCursor,showPlugin:_showPlugin,stop:_stop,transparentBackground:transparentBackground,triggerListeners:triggerListeners,unmute:_unmute,onSpeedChange:onSpeedChange,getCurrentSpeed:getCurrentSpeed,faster:_faster,slower:_slower,showDefaultControls:showDefaultControls,hideDefaultControls:hideDefaultControls,hls:hls,resetSpeed:resetSpeed,changeQuality:changeQuality,getAvailableQualities:getAvailableQualities,setAvailableQualities:setAvailableQualities,setQualityOverride:setQualityOverride,zoomImage:zoomImage,zoomPage:zoomPage,getZoomObject:getZoomObject,prevImage:prevImage,nextImage:nextImage,firstImage:firstImage,lastImage:lastImage,prevPage:prevPage,nextPage:nextPage,firstPage:firstPage,lastPage:lastPage,setPage:setPage,prevLvl:prevLvl,nextLvl:nextLvl,checkResize:checkResize,resetViewerSize:resetViewerSize,getCurrentPage:getCurrentPage,getCurrentPageLandscape:getCurrentPageLandscape,getPageLandscape:getPageLandscape,getPageCount:getPageCount,getPDFTitle:getPDFTitle,getStageHeightAdjustment:getStageHeightAdjustment,setStageHeightAdjustment:setStageHeightAdjustment,getStageWidth:getStageWidth,getStageWidthAbs:getStageWidthAbs,getStageHeight:getStageHeight,getStageHeightAbs:getStageHeightAbs,setStageWidth:setStageWidth,setStageHeight:setStageHeight,zoomStatusChange:setZoomStatus,setSimpleZoom:setSimpleZoom,setZoomMode:setZoomMode,downloadPDF:downloadPDF,canDownloadPDF:canDownloadPDF,getImageSrc:getImageSrc,getImageLandscape:getImageLandscape,isAnimated:isAnimated,fetchImage:fetchImage,getFetchedImage:getFetchedImage,setBGImage:setBGImage,setImgSrc:setImgSrc,setPluginsClickThrough:setPluginsClickThrough,activateAR:_activateAR,showQr:_showQr,hideQr:_hideQr,getLandingPageLinkData:getLandingPageLinkData,setOrbitPosition:_setOrbitPosition,setRotationCenter:setRotationCenter,getOrbitPosition:_getOrbitPosition,getRotationCenter:_getRotationCenter,setOrbitPositionFront:function(e){_setOrbitPosition(0,90,105,e)},setOrbitPositionBack:function(e){_setOrbitPosition(180,90,105,e)},setOrbitPositionTop:function(e){_setOrbitPosition(0,0,105,e)},setOrbitPositionBottom:function(e){_setOrbitPosition(0,180,105,e)},setOrbitPositionLeft:function(e){_setOrbitPosition(90,90,105,e)},setOrbitPositionRight:function(e){_setOrbitPosition(270,90,105,e)},setExposure:_setExposure,getExposure:_getExposure,setShadowIntensity:_setShadowIntensity,getShadowIntensity:_getShadowIntensity,setShadowSoftness:_setShadowSoftness,getShadowSoftness:_getShadowSoftness,setStageAspect:setStageAspect,setActiveSubtitleTrack:setActiveSubtitleTrack,setSubtitleTracks:setSubtitleTracks,getSubtitleTracks:getSubtitleTracks,setSubtitlesEnabled:setSubtitlesEnabled,isSubtitlesEnabled:isSubtitlesEnabled,setActiveTranscriptTrack:setActiveTranscriptTrack,setTranscriptTracks:setTranscriptTracks,getTranscriptTracks:getTranscriptTracks,setTranscriptEnabled:setTranscriptEnabled,isTranscriptEnabled:isTranscriptEnabled,appendNativeSubtitles:appendNativeSubtitles,getFixedQuality:getFixedQuality,isDeviceLandscape:isDeviceLandscape,getStageType:function(){return exists(stage)&&stage.type},iOSinlineplay:function(e){return callStage("enableIOSinlineplay",!!e)},getShadowRoot:cl.getShadowRoot,getRootElement:getRootElement,getPlugInParam:getPlugInParam}}function getPluginById(e){function t(n){var s=null;if(n instanceof Array)for(var i=0;i<n.length&&(s=t(n[i]),s===undefined);i++);else{if(n.getId)return n.getId()==e?n:void 0;for(var a in n)if((n[a]instanceof Object||n[a]instanceof Array)&&(s=t(n[a])))break}return s}return t(config.plugins)}function getPluginIdByElement(e){if(e){if(e.className&&"cliplister-viewer"==e.className)return;return e.id?e.id:getPluginIdByElement(e.parentNode)}}function _getProgressPlayed(){return callStage("getProgressPlayed")}function getCurrentSpeed(){return callStage("getCurrentSpeed")}function getPDFDetails(){cl.ajax(params.pdf.xml,function(e){var t=parseXml(e.responseText);return params.pdf.id=t.getElementsByTagName("asset_id")[0].textContent.trim()||!1,params.pdf.title=t.getElementsByTagName("asset_title")[0].textContent.trim()||"",params.pdf.id===!1?(console.log("id could not be retrieved. Aborting..."),triggerListeners("fatalAbort"),!1):(params.pdf.location=params.pdf.baseUrl.replace("/is/","/ad/")+"c2/-/"+params.pdf.id,void cl.ajax(params.pdf.baseUrl+"c2/-/"+params.pdf.id+"?clmeta",function(e){var t=JSON.parse(e.responseText);Object.assign(params.pdf,t);for(var n=params.pdf.pages[0].resolution.split("x"),s=0;s<n.length;s++)n[s]=parseInt(n[s]);return params.stage.aspectRatio=(n[0]>n[1]?n[0]:2*n[0])+":"+n[1],!!Resizer&&Resizer.check(!0),params.pdf.pages.length?void triggerListeners("pdfDataLoaded"):(console.log("pages could not be retrieved. Aborting..."),triggerListeners("fatalAbort"),!1)},function(e){console.log("Error while collecting data. Aborting..."),triggerListeners("fatalAbort")}))})}function getDocumentDetails(){cl.ajax(params.pdf.xml,function(e){var t=parseXml(e.responseText);return params.pdf.id=t.getElementsByTagName("asset_id")[0].textContent.trim()||!1,params.pdf.title=t.getElementsByTagName("asset_title")[0].textContent.trim()||"",params.pdf.id===!1?(console.log("id could not be retrieved. Aborting..."),triggerListeners("fatalAbort"),!1):void cl.ajax(params.pdf.baseUrl+"c2/-/"+params.pdf.id+"?clmeta",function(e){var t=JSON.parse(e.responseText);Object.assign(params.pdf,t);var n=params.pdf.pages[0].resolution.split("x");return params.stage.aspectRatio=(n[0]>n[1]?n[0]:2*n[0])+":"+n[1],!!Resizer&&Resizer.check(!0),params.pdf.pages.length?void triggerListeners("pdfDataLoaded"):(console.log("pages could not be retrieved. Aborting..."),triggerListeners("fatalAbort"),!1)},function(e){console.log("Error while collecting data. Aborting..."),triggerListeners("fatalAbort")})})}function getProducts(e){var t=("function"==typeof MediaSource,cl.getCliplisterDomain()+"jplist/"+params.customer+"/"+e);params.plist&&(t=params.plist),cl.ajax(t,function(e){if(e){var t=JSON.parse(e.responseText);processProducts(t)}else triggerListeners("fatalAbort")})}function getSlotContent(e,t){cl.ajax(cl.getCliplisterDomain()+("pdf"==params.assetType?"view/":"lcplay/")+params.customer+"/"+e,function(e){var n=e.responseText;if("pdf"==!params.assetType)overwriteParams(n);else{var s=n.slice(n.indexOf("{"),n.indexOf("};")+1),i=s.replace(/:\s*"([^"]*)"/g,function(e,t){return': "'+t.replace(/:/g,"@colon@")+'"'}).replace(/:\s*'([^']*)'/g,function(e,t){return': "'+t.replace(/:/g,"@colon@")+'"'}).replace(/(['"])?([a-z0-9A-Z_]+)(['"])?\s*:/g,'"$2": ').replace(/@colon@/g,":");params.pdf=JSON.parse(i)}exists(t)&&t()})}function getStageDimension(){return exists(elements.innerPluginsContainer)?{width:parseInt(getComputedStyle(elements.innerPluginsContainer).width),height:parseInt(getComputedStyle(elements.innerPluginsContainer).height)}:{width:0,height:0}}function _getTimePlayed(){return callStage("getTimePlayed")}function _getTimeBuffered(){return callStage("getTimeBuffered")}function _getPercentBuffered(){return callStage("getPercentBuffered")}function getVolume(){return callStage("getVolume")}function hideCursor(){elements.inner.style.cursor="none"}function _hidePlugin(e,t){var n;n=getPluginById(e instanceof Object?getPluginIdByElement(e):e),"visual"==n.getType()&&"inner"==n.getMode()&&(t!==undefined||(n.getWrapper().hidden=!0,n.getWrapper().style.display="none"))}function init(e){function t(){function e(){var e=exists(params.initialAsset)?params.initialAsset:0;if(loadAsset(e),params.autoplay||params.backgroundvideo&&(!_platform.os.mobile||"always"===params.backgroundvideo)&&(!exists(params.autoplay)||params.autoplay)){var t=function n(){return"iOS"==_platform.os.name&&"9"==_platform.os.version?(_stop(),!1):("iOS"==_platform.os.name?callStage("enableIOSmobileautoplay",!0):"Safari"==_platform.browser.name&&_platform.browser.version>=11||(_mute(),play()),void("always"!=params.autoplay&&("iOS"==_platform.os.name&&callStage("enableIOSmobileautoplay",!1),off("mediaReady",n),hls()&&off("hlsCG",n))))};_isDone("mediaReady")?t():on("mediaReady",t),hls()&&(_isDone("hlsCG")?t():on("hlsCG",t))}notifyID.viewer=Math.round(1e13*Math.random()),triggerListeners("initDone")}initPlugins();var t=document.createElement("video"),n=!!t.canPlayType;params.backgroundvideo&&_platform.os.mobile&&"always"!==params.backgroundvideo&&(!params.backgroundvideo||n)||initStage(),initListeners(),_isDone("productsLoaded")?e():on("productsLoaded",e),on("fatalAbort",function(){_destroy()}),on("reinitialise",function(){dieAndRiseAgain()})}params=e,exists(params.assetType)&&"data"==params.assetType&&(params.output=exists(params.output)?params.output:"viewer",params.assetkind=exists(params.assetkind)?params.assetkind:"pages"),processParameters()&&(_platform=detectPlatform(),detectFeatures(),config.originalDimensions=getComputedStyle(config.parent),initViewer(),orderRequestToken(function(){if(!exists(params.slot)||exists(params.assetType)&&"data"==params.assetType?t():getSlotContent(requestToken,function(){t(),exists(params.assetType)&&"pdf"==params.assetType&&(getPDFDetails(params.pdfdetails),on("pdfDataLoaded",function(){var e={product:{title:params.pdf.title,description:"",link:null},assets:[]};e.assets.push(params.pdf),products.push(e);var t=exists(params.initialAsset)?params.initialAsset:0;loadAsset(t)}))}),exists(params.forceAssetType)&&"image360"==params.forceAssetType){var e=exists(params.initialAsset)?params.initialAsset:0;loadAsset(e)}else if(1==params.keytype){for(var n={product:{title:"",description:"",link:null},assets:[]},s=0;s<params.assetkeys.length;s++){var i={download:!1,duration:null,id:params.assetkeys[s],language:null,previews:{},social:{},subtitles:"",thumbnail:null,title:"",type:"youtube",uri:null,hls:!1,versions:null,aspectratio:null};n.assets.push(i)}products.push(n);var e=exists(params.initialAsset)?params.initialAsset:0;loadAsset(e)}else exists(params.assetType)&&"pdf"==params.assetType||getProducts(requestToken)}))}function fullscreenListener(){if(!exists(_features.fullscreen))return!1;var e="iOS"==_platform.os.name;if(e)if(config.fullscreen)document.fullscreenElement=null,document.webkitFullscreenElement=null;else{var t=!!stage&&!!stage.getVideoElement&&stage.getVideoElement();document.fullscreenElement=t,document.webkitFullscreenElement=t}config.fullscreen=!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement),triggerListeners("fullscreenChange"),_platform.os.mobile&&(config.fullscreen?Resizer.unwatch():Resizer.watch()),_platform.os.mobile&&resetViewerSize()}function initListeners(){!function(){config.fullscreen=!1,_features.fullscreen&&_features.fullscreen.fullscreenchange(function(){fullscreenListener()})}(),!!Resizer&&!!Resizer.watch&&Resizer.watch();var e="onorientationchange"in window,t=e?"orientationchange":"resize";e&&window.addEventListener(t,function(){return setTimeout(function(){!!Resizer&&!!Resizer.check&&Resizer.check(!0),triggerListeners("resize")},125)},!1),function(){function e(e){switch(e.key){case"Enter":case" ":e.preventDefault();case"k":_isPlaying()?_pause():play();break;case"m":isMuted()?_unmute():_mute();break;case"f":_isFullscreen()?_leaveFullscreen():_enterFullscreen();break;case"c":setSubtitlesEnabled(!isSubtitlesEnabled());break;case"t":setTranscriptEnabled(!isTranscriptEnabled());break;case"N":playAsset(_getNextAsset());break;case"P":playAsset(_getPrevAsset());break;case"ArrowUp":e.preventDefault(),_setVolume(Math.min(getVolume()+10,100));break;case"ArrowDown":e.preventDefault(),_setVolume(Math.max(0,getVolume()-10));break;case"ArrowLeft":e.preventDefault(),_setTimePlayed(_getTimePlayed()-5);break;case"ArrowRight":e.preventDefault(),_setTimePlayed(_getTimePlayed()+5);break;case"j":_setTimePlayed(_getTimePlayed()-10);break;case"l":_setTimePlayed(_getTimePlayed()+10);break;case"1":_setProgressPlayed(10);break;case"2":_setProgressPlayed(20);break;case"3":_setProgressPlayed(30);break;case"4":_setProgressPlayed(40);break;case"5":_setProgressPlayed(50);break;case"6":_setProgressPlayed(60);break;case"7":_setProgressPlayed(70);break;case"8":_setProgressPlayed(80);break;case"9":_setProgressPlayed(90);break;case"0":_setProgressPlayed(0);break;case",":prevFrame();break;case".":nextFrame();break;case"<":_slower();break;case">":_faster();break;case"Home":e.preventDefault(),_setTimePlayed(0);break;case"End":e.preventDefault(),_setTimePlayed(_getDuration()-1)}}config.focus=!1,addEvent(document,"click",function(t){for(var n=t.target;n;n=n.parentNode)if(n===elements.inner)return void addEvent(document,"keydown",e);removeEvent(document,"keydown",e)})}()}function initPlugins(){function e(e,n){var s=cl.getPlugin(e,n.version);if(s){if(n.viewer=self,n.pluginApi=getPluginApi(),"visual"==s.prototype.type){var i=document.createElement("div");n.parent=i;var a=s(n);a.setWrapper(i),"outer"==s.prototype.mode?(a.setPriority(n.priority),a.setPosition(n.position),config.plugins.visual.outer.push(a)):"inner"==s.prototype.mode&&(a.mode="inner",a.setLayer(n.layer),config.plugins.visual.inner.push(a))}else if("functional"==s.prototype.type){var a=s();config.plugins.functional.push(a)}a.setParams(n),a.positionListeners=[],n.id?a.setId(n.id):a.setId(t++),a.init()}}config.plugins||(config.plugins={visual:{inner:new Array,outer:new Array},functional:new Array});var t=0;if(params.plugins)for(var n in params.plugins)if(params.plugins.hasOwnProperty(n))if(Array.isArray(params.plugins[n]))for(var s=0;s<params.plugins[n].length;s++){var i=params.plugins[n][s];e(n,i)}else{var i=params.plugins[n];e(n,i)}getPluginById(1),buildPlugins()}function initStage(){exists(elements.inner)&&(exists(elements.stageWrapper)||(elements.stageWrapper=document.createElement("div"),elements.stageWrapper.style.overflow="hidden",elements.stageWrapper.style.position="absolute",elements.stageWrapper.style.top=config.measures.offsets.top+"px",elements.stageWrapper.style.left=config.measures.offsets.left+"px",elements.stageWrapper.style.right=config.measures.offsets.right+"px",elements.stageWrapper.style.bottom=config.measures.offsets.bottom+"px",elements.stageWrapper.style.bottom=config.measures.offsets.bottom+"px",elements.inner.appendChild(elements.stageWrapper)))}function initViewer(){config.parent.api=getPublicApi(),elements.inner=document.createElement("div"),elements.inner.className="cliplister-viewer",elements.inner.style.position="relative",elements.inner.style.top="0px",elements.inner.style.left="0px",params.backgroundColor?config.backgroundColor=params.backgroundColor:params.backgroundColor="#000000",elements.inner.style.backgroundColor=params.backgroundColor,config.parent.api=getPublicApi(),config.parent.appendChild(elements.inner);var e=getComputedStyle(config.parent);config.dimensions={},config.dimensions.width=parseInt(e.width),config.dimensions.height=parseInt(e.height),elements.inner.style.width=config.dimensions.width+(/%$/.test(e.width)?"%":"px"),elements.inner.style.height=config.dimensions.height+(/%$/.test(e.height)?"%":"px")}function isAChildOf(e,t){if(e===t)return!1;for(;t&&t!==e;)t=t.parentNode;return t===e}function _isDone(e){return occurredEvents.indexOf(e)>=0}function isLooping(){return params.loop||params.backgroundvideo||!1}function isPlayNext(){return params.playNext||!1}function isMovementListening(e){return!(!movementListeners[e]||!movementListeners[e].element)}function _isPlaying(){return callStage("isPlaying")}function _isFullscreen(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)}function isMuted(){return callStage("isMuted")}function isQualityOverride(){return callStage("isQualityOverride")}function isStopped(){return callStage("isStopped")}function _leaveFullscreen(){_features.fullscreen.exitFullscreen()}function notifyAjax(e){function t(e){for(var n=-1,s=0,i=e.length;s<i;s++)n=n>>>8^t.b_table[255&(n^e.charCodeAt(s))];return(n^-1)>>>0}t.a_table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D",t.b_table=t.a_table.split(" ").map(function(e){return parseInt(e,16)});var n=getAsset(),s=_getCurrentQuality(),i={v:1,vs:1,vm:2,vx:3},a=i[s.string],r=params.assetkeys?params.assetkeys:params.assetKeys?params.assetKeys:[0],o={cid:params.customer,tid:notifyID.asset+"",sid:notifyID.viewer+"",e:[{eti:new Date(Date.now()).toISOString(),et:e,ed:{s:_getProgressPlayed(),vid:n.id,vi:a,rk:r[getAssetPosition()],rt:params.keytype,pv:CLViewer.prototype.version}}]},l=JSON.stringify(o),u={j:btoa(l),c:t(l)},g=(btoa(l),t(l),encodeURIComponent),c=Object.keys(u).map(function(e){return g(e)+"="+g(u[e])}).join("&"),p="https://ts.mycliplister.com/v2",d=p+"?"+c;cl.ajax(d,function(e){return!1},function(e){return!0})}function loadAsset(e,t){function n(){triggerListeners("assetReady"),exists(params.assetType)&&"data"===params.assetType&&exists(params.output)&&"data"===params.output||exists(params.assetType)&&("pdf"===params.assetType||params.assetKind.includes("eFlyer"))||exists(params.assetType)&&("data"===params.assetType||params.assetKind.includes("360view"))?(setStage(exists(params.assetKind)&&params.assetKind.includes("eFlyer")?"eFlyer":exists(params.assetKind)&&params.assetKind.includes("360view")?"image360":exists(params.assetKind)&&params.assetKind.includes("3Dasset")?"3d":params.assetType),_isDone("pluginsBuilt")?callStage("showMedia",[loadedAsset]):on("pluginsBuilt",function(){callStage("showMedia",[loadedAsset])})):(exists(params.CLTracking)&&params.CLTracking&&(_isDone("initialPlay")||on("initialPlay",function(){notifyID.asset=Math.round(1e13*Math.random()),notifyAjax("videoPlay")}),_isDone("changeSrc")||on("changeSrc",function(){notifyAjax("qualityChange")})),params.backgroundvideo&&_platform.os.mobile&&"always"!==params.backgroundvideo||(setStage(exists(params.forceAssetType)?params.forceAssetType:loadedAsset.hls?"videoHLS":loadedAsset.type),(params.mute||params.backgroundvideo)&&_mute(),exists(params.forceAssetType)&&"image360"==params.forceAssetType?callStage("showMedia",[params.assetkeys]):1==params.keytype?callStage("showMedia",[loadedAsset]):callStage("showMedia",[loadedAsset]),exists(params.fixedQuality)?on("mediaReady",function(){callStage("setQuality",[params.fixedQuality])}):exists(params.defaultQuality)&&on("mediaReady",function(){callStage("setQuality",[params.defaultQuality])})))}if(String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&this.indexOf(e,t)!==-1}),e=parseInt(e),(exists(params.assetType)&&"data"===params.assetType&&exists(params.output)&&"data"===params.output||"pdf"===params.assetType||exists(params.assetKind)&&(params.assetKind.includes("eFlyer")||params.assetKind.includes("360view")||params.assetKind.includes("3Dasset")))&&(t=!0),isStopped||_stop(),"undefined"==typeof t)for(var s=0,i=!1,a=0;a<products.length;a++){for(var r=0;r<products[a].assets.length;r++){if(e<1e3&&e==s||e>=1e3&&e==products[a].assets[r].id){i=!0,loadedAsset=products[a].assets[r],currentAssetIndex=e,currentProductIndex=a,n();break}s++}if(i)break}else{switch(params.assetType){case"pdf":loadedAsset=products;break;case"data":if(exists(params.assetKind)){if(params.assetKind.includes("eFlyer")){loadedAsset=products.eFlyers[0];break}if(params.assetKind.includes("360view")){var o=products.threesixty[0]||products.threesixty;loadedAsset=o.assets[0]||o.assets;break}if(params.assetKind.includes("3Dasset")){loadedAsset=products["3Dasset"][0]||products["3Dasset"];break}}loadedAsset=products.pages[0];break;default:if(params.assetType.includes("documents")){loadedAsset=products.documents[0];break}loadedAsset=products}n()}}function playAsset(e,t){loadAsset(e,t),play()}function _playNextAsset(){params.playNext=!0,getPluginApi().on("play",function(){triggerListeners("playNext"),params.playNext=!1}),playAsset(_getNextAsset())}function loadProduct(){}function _mute(){callStage("mute")}function off(e,t){if(listeners[e])if(1==listeners[e].length)delete listeners[e];else for(var n=0;n<listeners[e].length;n++)if(listeners[e][n]==t){listeners[e].splice(n,1);break}}function on(e,t,n){function s(e,t){listeners[e]||(listeners[e]=new Array),listeners[e].push(t)}if(n&&n.subsequent&&_isDone(e)&&t(),e instanceof Array)for(var i=0;i<e.length;i++)s(e[i],t);else s(e,t)}function onMouseenter(e,t){addEvent(e,"mouseover",function(e){var n=e.relatedTarget;this===n||isAChildOf(this,n)||t(e)})}function onMouseleave(e,t){addEvent(e,"mouseout",function(e){var n=e.relatedTarget;this===n||isAChildOf(this,n)||t(e)})}function onMousedown(e,t){var n="ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0;addEvent(e,n?"touchstart":"mousedown",function(e){var n=e.relatedTarget;this===n||isAChildOf(this,n)||t(e)})}function onMouseup(e,t){var n="ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0;addEvent(e,n?"touchend":"mouseup",function(e){var n=e.relatedTarget;this===n||isAChildOf(this,n)||t(e)})}function onMousemove(e,t){var n="ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0;addEvent(e,n?"touchmove":"mousemove",function(e){var n=e.relatedTarget;this===n||isAChildOf(this,n)||t(e)})}function orderRequestToken(e){var t={};t.SEO=!1,exists(params.fsk)&&(t.fsk=params.fsk),exists(params.keytype)&&(t.keytype=params.keytype),exists(params.assetkeys)&&(t.requestkey=params.assetkeys.join("|")),exists(params.lang)&&(t.lang=params.lang),exists(params.languages)&&(t.lang=params.languages.join(",")),exists(params.slot)&&(t.slot=params.slot),exists(params.assetkind)&&(t.assetkind=params.assetkind),exists(params.assettype)&&(t.assettype=params.assettype),exists(params.output)&&(t.output=params.output),exists(params.bcuid)&&(t.bcuid=params.bcuid),"undefined"!=typeof Hls&&Hls.isSupported()&&exists(params.streamtype)&&(t.streamtype=params.streamtype),exists(params.plist)?exists(e)&&e():cl.requestLiveConnectCall(t,params.customer,function(t){requestToken=t,exists(e)&&e()})}function overwriteParams(slotContent){try{var slotParams=eval("("+slotContent+")");params=extend(!0,slotParams,params)}catch(e){cl.log(slotContent),cl.log("The slot content is not valid",1)}}function pad(e,t){for(var n=e+"";n.length<t;)n="0"+n;return n}function parseXml(e){if("undefined"!=typeof window.DOMParser)return(new window.DOMParser).parseFromString(e,"text/xml");if("undefined"!=typeof window.ActiveXObject&&new window.ActiveXObject("Microsoft.XMLDOM")){var t=new window.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(xmlStr),t}throw new Error("No XML parser found")}function onSpeedChange(e){}function changeQuality(e){stage.changeQuality(e)}function getAvailableQualities(){return stage.getAvailableQualities()}function setAvailableQualities(e){return stage.setAvailableQualities(e)}function setQuality(e){stage.setQuality(e)}function setQualityOverride(e){stage.setQualityOverride(e)}function getZoomObject(){return exists(stage.zoomPages)?stage.zoomPages():stage.zoomImage()}function zoomImage(){return stage.zoomImage()}function zoomPage(e){return stage.zoomPage(e)}function nextImage(){stage.nextImage()}function prevImage(){stage.prevImage()}function firstImage(){stage.firstImage()}function lastImage(){stage.lastImage()}function nextPage(){stage.nextPage()}function prevPage(){stage.prevPage()}function firstPage(){stage.firstPage()}function lastPage(){stage.lastPage()}function setPage(e){stage.setPage(e)}function getCurrentPage(){return exists(stage)&&_isDone("mediaReady")?stage.getCurrentPage():0}function getCurrentPageLandscape(){return exists(stage)&&_isDone("mediaReady")?stage.getCurrentPageLandscape():0}function getPageLandscape(e){return exists(stage)&&_isDone("mediaReady")?stage.getPageLandscape(e):0}function getPageCount(){return exists(stage)&&_isDone("mediaReady")?stage.getPageCount():0}function getPDFTitle(){return exists(stage)&&_isDone("mediaReady")?stage.getTitle():""}function setStageHeightAdjustment(e){stageHeightAdjustment=parseInt(e),resetViewerSize()}function getStageHeightAdjustment(){return stageHeightAdjustment}function setStageWidth(e){var t=parseInt(e);_isDone("stageSet")?stage.setStageWidth&&stage.setStageWidth(t):on("stageSet",function(){stage.setStageWidth&&stage.setStageWidth(t)})}function getStageWidthAbs(){if(_isDone("stageSet")){var e,t,n;return null!==(e=null===(t=(n=stage).getStageWidthAbs)||void 0===t?void 0:t.call(n))&&void 0!==e?e:0}return 0}function getStageWidth(){if(_isDone("stageSet")){var e,t,n;return null!==(e=null===(t=(n=stage).getStageWidth)||void 0===t?void 0:t.call(n))&&void 0!==e?e:0}return 0}function getStageHeightAbs(){if(_isDone("stageSet")){var e,t,n;return null!==(e=null===(t=(n=stage).getStageHeightAbs)||void 0===t?void 0:t.call(n))&&void 0!==e?e:0}return 0}function getStageHeight(){if(_isDone("stageSet")){var e,t,n;return null!==(e=null===(t=(n=stage).getStageHeight)||void 0===t?void 0:t.call(n))&&void 0!==e?e:0}return 0}function setStageHeight(e){var t=parseInt(e);_isDone("stageSet")?stage.setStageHeight&&stage.setStageHeight(t):on("stageSet",function(){stage.setStageHeight&&stage.setStageHeight(t)})}function setZoomStatus(e,t,n){config.currentZoom=e,exists(t)&&(config.maxZoom=t),triggerListeners("zoomChanged",{currentZoom:config.currentZoom,maxZoom:config.maxZoom,immediately:n})}function setSimpleZoom(e){stage.setSimpleZoom(e)}function setZoomMode(e){_isDone("stageSet")?exists(stage.setZoomMode)&&stage.setZoomMode(e):on("stageSet",function(){exists(stage.setZoomMode)&&stage.setZoomMode(e)})}function downloadPDF(){stage.downloadPDF()}function canDownloadPDF(){return stage.canDownloadPDF()}function getImageSrc(e,t){return stage.getImageSrc(e,t)}function getImageLandscape(e){return stage.getImageLandscape(e)}function isAnimated(){return!!exists(params.stage.animated)&&params.stage.animated}function nextLvl(){stage.nextLvl()}function prevLvl(){stage.prevLvl()}function _activateAR(){exists(stage)&&"3d"===stage.type&&stage.activateAR()}function activateARDirectLink(){if(exists(stage)&&"3d"===stage.type){var e=({glb:loadedAsset.derivate.find(function(e){"glb"===e.fileExtension}),usdz:loadedAsset.derivate.find(function(e){"usdz"===e.fileExtension;
})},new URL("https://arvr.google.com/scene-viewer/1.0"));e.searchParams.append("file","https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF/Avocado.gltf"),e.searchParams.append("mode","ar_only")}}function _showQr(){triggerListeners("showQr")}function _hideQr(){triggerListeners("hideQr")}function getLandingPageLinkData(e){var t="https://mycliplister.com/static/html/dynamicLandingPage.html",n={landingpageBaseUrl:t,asset:loadedAsset,settings:{custid:params.customer,rk:Array.isArray(params.assetkeys)?params.assetkeys[0]:params.assetkeys,keytype:params.keytype,stageAspect:params.stage.aspectRatio}};return n}function _setOrbitPosition(e,t,n,s){exists(stage)&&"3d"===stage.type&&stage.setOrbitPosition(e,t,n,s)}function setRotationCenter(e,t,n){exists(stage)&&"3d"===stage.type&&stage.setRotationCenter(e,t,n)}function _getOrbitPosition(){if(exists(stage)&&"3d"===stage.type)return stage.getOrbitPosition()}function _getRotationCenter(){if(exists(stage)&&"3d"===stage.type)return stage.getRotationCenter()}function _setExposure(e){exists(stage)&&"3d"===stage.type&&stage.setExposure(e)}function _getExposure(){if(exists(stage)&&"3d"===stage.type)return stage.getExposure()}function _setShadowIntensity(e){exists(stage)&&"3d"===stage.type&&stage.setShadowIntensity(e)}function _getShadowIntensity(){if(exists(stage)&&"3d"===stage.type)return stage.getShadowIntensity()}function _setShadowSoftness(e){exists(stage)&&"3d"===stage.type&&stage.setShadowSoftness(e)}function _getShadowSoftness(){if(exists(stage)&&"3d"===stage.type)return stage.getShadowSoftness()}function _pause(){exists(stage)&&_isDone("mediaReady")&&(_platform.os.mobile||triggerListeners("pauseMedia"),stage.pause())}function playPubAPI(){return _getProgressPlayed()||"iOS"!=_platform.os.name||"9"!=_platform.os.version?(_getProgressPlayed()||_mute(),void play()):(_stop(),!1)}function play(){function e(){hls()||callStage("play"),stage.play()}exists(stage)&&stage.getSrc()&&(_platform.os.mobile||triggerListeners("playMedia"),e())}function getVidSrc(){var e="";return exists(stage)&&_isDone("mediaReady")&&(e=stage.getSrc()),e}function getRootElement(){return cl.getRootElement()}function processProducts(e){function t(e){var t={};return t.download=e.download||!1,t.duration=e.duration||null,t.id=e.vid,t.language=e.language,t.previews=e.previews||{},t.social={},t.subtitles="",t.thumbnail=e.clipthumbnail||null,t.title=e.cliptitle||"",t.type=e.type||"video",t.uri=e.clipurl,t.srcurl=e.srcurl||null,t.iossrcurl=e.iossrcurl||null,t.pivotpoint=e.pivotpoint||null,t.hotspots=e.hotspots||null,t.hls="undefined"!=typeof e.stream&&"true"==e.stream,t.versions=e.versions||null,t.aspectratio=e.aspectratio||null,t.cliptype_name=e.cliptype_name||null,t.downloadLinks=e.videoDownloadLinks||null,t.streamingLinks=e.videoStreamingLinks||null,t}function n(e,n){var s={product:{},assets:[]};s.product.title=e.producttext||"",s.product.description=e.productshortdesc||"",s.product.link=e.productlink||null,delete e.producttext,delete e.productshortdesc;var i=e.relatedclips;e.related=!1,delete e.relatedclips;var a=t(e);if(s.assets.push(a),exists(i)&&""!=i)if(i.clip instanceof Array){n=n?n-1:i.clip.length,n=Math.min(n,i.clip.length);for(var r=0;r<n;r++)i.clip[r].related=!0,s.assets.push(t(i.clip[r]))}else(!n||n>1)&&(i.clip.related=!0,s.assets.push(t(i.clip)));return s}function s(e){var t=e[0];return t.type="image360",t}function i(e){var t={product:{},assets:[]};t.product.title=e.producttext||"",t.product.description=e.productshortdesc||"",t.product.link=e.productlink||null,delete e.producttext,delete e.productshortdesc;var n=e.relatedclips;e.related=!1,delete e.relatedclips;var i=s(e);if(t.assets.push(i),exists(n)&&""!=n)if(n.clip instanceof Array)for(var a=0;a<n.clip.length;a++)n.clip[a].related=!0,t.assets.push(s(n.clip[a]));else n.clip.related=!0,t.assets.push(s(n.clip));return t}if("1"!==e.cliplist.version||"undefined"==typeof e.cliplist.clip&&"undefined"==typeof e.cliplist.pages&&"undefined"==typeof e.cliplist["360view"]&&"undefined"==typeof e.cliplist["360views"]&&"undefined"==typeof e.cliplist.eFlyers&&"undefined"==typeof e.cliplist["3Dasset"])triggerListeners("fatalAbort");else{var a=!!exists(params.assetLimit)&&params.assetLimit;if(exists(e.cliplist.clip))if(e.cliplist.clip instanceof Array)for(var r=0;r<e.cliplist.clip.length;r++){var o=e.cliplist.clip[r];products.push(n(o,a))}else products.push(n(e.cliplist.clip,a));if(e.cliplist.pages instanceof Array&&(products.pages=e.cliplist.pages),e.cliplist.eFlyers instanceof Array&&(products.eFlyers=e.cliplist.eFlyers),"undefined"!=typeof e.cliplist["3Dasset"]&&(products["3Dasset"]=e.cliplist["3Dasset"]),"undefined"!=typeof e.cliplist["360view"])if(!exists(products.threesixty)&&(products.threesixty=[]),products.threesixty.push(i(e.cliplist["360view"])),e.cliplist["360view"]instanceof Array&&exists(e.cliplist["360view"][0])&&e.cliplist["360view"][0]instanceof Array)for(var r=0;r<e.cliplist["360view"].length;r++){var l=e.cliplist["360view"][r];products.threesixty.push(i(l,a))}else products.threesixty.push(i(e.cliplist["360view"],a));if("undefined"!=typeof e.cliplist["360views"])if(!exists(products.threesixty)&&(products.threesixty=[]),products.threesixty.push(i(e.cliplist["360views"])),e.cliplist["360views"]instanceof Array&&exists(e.cliplist["360views"][0])&&e.cliplist["360views"][0]instanceof Array)for(var r=0;r<e.cliplist["360views"].length;r++){var l=e.cliplist["360views"][r];products.threesixty.push(i(l,a))}else products.threesixty.push(i(e.cliplist["360views"],a));triggerListeners("productsLoaded")}}function processParameters(){for(var e,t,n=Object.keys(params),s=n.length;s--;)t=n[s],params.hasOwnProperty(t)&&(params[t.toLowerCase()]=params[t],"keytype"==t.toLowerCase()&&("string"==typeof params[t.toLowerCase()]||params[t.toLowerCase()]instanceof String)&&("ean"==params[t.toLowerCase()].toLowerCase()?params[t.toLowerCase()]=0:"article"==params[t.toLowerCase()].toLowerCase()||"articlenumber"==params[t.toLowerCase()].toLowerCase()?params[t.toLowerCase()]=1e4:"videoid"==params[t.toLowerCase()].toLowerCase()?params[t.toLowerCase()]=500:"youtube"==params[t.toLowerCase()].toLowerCase()&&(params[t.toLowerCase()]=1)));return exists(params.assets)&&(params.assetkeys=params.assets),exists(params.language)&&(params.languages=params.language),exists(params.assettype)&&(params.assetType=params.assettype),exists(params.assetkind)&&(params.assetKind=params.assetkind),params.parentid&&null!=(e=getRootElement().getElementById(params.parentid))?(config.parent=e,!0):(cl.log("The CLViewer requires an existing parent element.",1),triggerListeners("fatalAbort"),1)}function readFile(e){var t=new XMLHttpRequest;t.open("GET",e,!1),t.onreadystatechange=function(){if(4===t.readyState&&(200===t.status||0==t.status)){var e=t.responseText;alert(e)}},t.send(null)}function reSetElementPosition(e,t,n,s,i){e===undefined||"top"!=t&&"right"!=t&&"bottom"!=t&&"left"!=t||n===undefined||("auto"==n?delete e[t]:e[t]=n,s!==undefined&&s?e.middlepointX=!0:delete e.middlepointX,i!==undefined&&i?e.middlepointY=!0:delete e.middlepointY)}function repositionInnerPluginElement(e){if(e&&exists(elements.innerPluginsContainer)){e.style.position="absolute";for(var t={container:{width:Math.ceil(parseInt(getComputedStyle(elements.innerPluginsContainer).width))+2,height:Math.ceil(parseFloat(getComputedStyle(elements.innerPluginsContainer).height))+2},element:{width:Math.ceil(parseInt(getComputedStyle(e).width))+2,height:Math.ceil(parseFloat(getComputedStyle(e).height))+2}},n=["left","width","right","top","height","bottom"],s=0;s<n.length;s++){var i=n[s];"undefined"!=typeof e[i]&&(t[i]=distanceToPx(e[i],"left"==i||"right"==i||"width"==i?t.container.width:t.container.height),"right"==i?e.width&&e.left||(e.left?e.style.width=t.container.width-t.left-t.right+"px":e.width?e.style.left=t.container.width-distanceToPx(e.width,t.container.width)-t.right+"px":t.element.width&&e.right&&(e.style.left=t.container.width-distanceToPx(t.element.width,t.container.width)-t.right+"px")):"bottom"==i?(e.height&&e.top||(e.top?e.style.height=t.container.height-t.top-t.bottom+"px":e.height?e.style.top=t.container.height-distanceToPx(e.height,t.container.height)-t.bottom+"px":t.element.height&&e.bottom&&(e.style.left=t.container.height-distanceToPx(t.element.height,t.container.height)-t.bottom+"px")),e.style.height=t.container.height-t.top-t.bottom+"px"):e.style[i]=t[i]+"px")}e.style.left||e.style.right||(e.style.left="0px"),e.style.top||e.style.bottom||(e.style.top="0px");var a=e.minWidth?distanceToPx(e.minWidth,t.container.width):0,r=e.maxWidth?distanceToPx(e.maxWidth,t.container.width):t.container.width,o=e.minHeight?distanceToPx(e.minHeight,t.container.height):0,l=e.maxHeight?distanceToPx(e.maxHeight,t.container.height):t.container.height;e.minWidth&&t.width<a&&(e.style.width=a+"px",!e.right||e.width&&e.left||(e.style.left=1*parseInt(e.style.left)-1*(t.width-a)+"px")),e.maxWidth&&t.width>r&&(e.style.width=r+"px",!e.right||e.width&&e.left||(e.style.left=1*parseInt(e.style.left)+1*(t.width-r)+"px")),e.minHeight&&t.height<o&&(e.style.height=o+"px",!e.bottom||e.height&&e.top||(e.style.top=1*parseInt(e.style.top)-1*(t.height-o)+"px")),e.maxHeight&&t.height>l&&(e.style.height=l+"px",!e.bottom||e.height&&e.top||(e.style.top=1*parseInt(e.style.top)+1*(t.height-l)+"px")),exists(e.middlepointY)&&(e.top&&!e.bottom?e.style.top=parseInt(e.style.top)-parseInt(e.style.height)/2+"px":!e.top&&e.bottom&&(e.style.top=parseInt(e.style.top)+parseInt(e.style.height)/2+"px")),exists(e.middlepointX)&&(e.left&&!e.right?e.style.left=parseInt(e.style.left)-parseInt(e.style.width)/2+"px":!e.left&&e.right&&(e.style.left=parseInt(e.style.left)+parseInt(e.style.width)/2+"px"))}}function repositionInnerPluginElements(){if(config.plugins&&config.plugins.visual&&config.plugins.visual.inner)for(var e=0;e<config.plugins.visual.inner.length;e++){var t=config.plugins.visual.inner[e].getWrapper().childNodes[0];"undefined"==typeof t||t.getAttribute("data-cl-animating")||disableCSSTransition(config.plugins.visual.inner[e].getWrapper().childNodes[0]),repositionInnerPluginElement(config.plugins.visual.inner[e].getWrapper().childNodes[0])}}function resizeListener(){}function setBitrate(e){stage.setBitrate(e)}function setElementPositionWithinInnerPlugin(e,t,n,s){var i,a,r,o,l,u,g;1==arguments.length?(e.element!==undefined&&(i=e.element),e.position!==undefined&&(a=e.position),e.value!==undefined&&(r=e.value),e.animate!==undefined&&(g=e.animate),e.fromMiddlePoint!==undefined&&(e.fromMiddlePoint.x!==undefined&&(o=e.fromMiddlePoint.x),e.fromMiddlePoint.y!==undefined&&(l=e.fromMiddlePoint.y)),e.reposition!==undefined&&(u=e.reposition)):(i=e,a=t,r=n,g=s),"undefined"==typeof g&&(g=!1),"undefined"==typeof u&&(u=!0),"undefined"==typeof o&&(o=!1),"undefined"==typeof l&&(l=!1),g||disableCSSTransition(i),reSetElementPosition(i,a,r,o,l),u!==undefined&&u&&repositionInnerPluginElement(i)}function setElementSizeWithinInnerPlugin(e,t,n,s){var i,a,r,o,l,u;1==arguments.length?(e.element!==undefined&&(i=e.element),e.dimension!==undefined&&(a=e.dimension),e.value!==undefined&&(r=e.value),e.min!==undefined&&(u=e.min),e.min!==undefined&&(u=e.min),e.min!==undefined&&(u=e.min),e.min!==undefined&&(u=e.min),e.max!==undefined&&(l=e.max)):(i=e,a=t,r=n,o=s),"undefined"==typeof o&&(o=!0),i===undefined||"width"!=a&&"height"!=a||r===undefined||("auto"==r?delete i[a]:i[a]=r,u!==undefined&&(i["min"+capitalizeFirstLetter(a)]=u),l!==undefined&&(i["max"+capitalizeFirstLetter(a)]=l),o&&repositionInnerPluginElement(i))}function _setProgressPlayed(e){stage.setProgressPlayed(e)}function _setTimePlayed(e){stage.setTimePlayed(e)}function nextFrame(){isStopped()||_isPlaying()||_setTimePlayed(_getTimePlayed()+1/24)}function prevFrame(){isStopped()||_isPlaying()||_setTimePlayed(_getTimePlayed()-1/24)}function setStage(e){function t(e){if(exists(elements.stageWrapper)||initStage(),!stage||stage.getType!==e){var t=config.stage,n=!!stage&&getVolume();t.parent=elements.stageWrapper,t.viewer=self,t.pluginApi=getPluginApi(),t.callParams=config.stage.params,stage=cl.getStage(e)(t),"video"!==e&&"videoHLS"!==e||(n!==!1&&_setVolume(n),"iOS"===_platform.os.name&&callStage("enableIOSinlineplay",!0)),triggerListeners("stageSet")}}"eFlyer"===e&&(e="pdf"),"hls"===e&&(e="videoHLS"),_isDone("pluginsBuilt")?t(e):on("pluginsBuilt",function(){t(e)})}function _setVolume(e){stage.setVolume(e)}function showCursor(){!!elements.inner&&(elements.inner.style.cursor="default")}function _showPlugin(e){var t;t=getPluginById(e instanceof Object?getPluginIdByElement(e):e),"visual"==t.getType()&&"inner"==t.getMode()&&(delete t.getWrapper().hidden,t.getWrapper().style.display="block")}function _stop(e){if(exists(stage)&&_isDone("mediaReady")){if(triggerListeners("stopMedia"),!stage.stop)return!1;stage.stop()}e&&(params.loop||params.backgroundvideo)&&setTimeout(function(){play()},5)}function transparentBackground(e){e.style.backgroundImage="url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)"}function _faster(){stage.faster()}function _slower(){stage.slower()}function showDefaultControls(){stage.showDefaultControls()}function hideDefaultControls(){stage.hideDefaultControls()}function hls(){return!!stage.hls&&stage.hls()}function checkResize(){!!Resizer&&Resizer.check()}function resetViewerSize(){if(exists(elements.inner)&&exists(elements.innerPluginsContainer)){config.dimensions={};config.originalDimensions;config.dimensions.width=parseInt(getStageWidthAbs()),config.dimensions.height=parseInt(getStageHeightAbs())+stageHeightAdjustment,elements.inner.style.width=config.dimensions.width+"px",elements.inner.style.height=config.dimensions.height+"px",elements.innerPluginsContainer.height=config.dimensions.height-config.measures.offsets.top-config.measures.offsets.bottom,elements.innerPluginsContainer.width=parseInt(config.dimensions.width)-config.measures.offsets.left-config.measures.offsets.right,elements.innerPluginsContainer.style.width=elements.innerPluginsContainer.width+"px";var e=_platform.os.mobile;e=!(exists(params.plugins)&&exists(params.plugins)&&exists(params.plugins.InnerControls)&&exists(params.plugins.InnerControls.mobileDefaultControls)&&!params.plugins.InnerControls.mobileDefaultControls)&&e;var t="iOS"==_platform.os.name&&_platform.os.version>="10"&&e;elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px",isStopped()?(elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px",elements.innerPluginsContainer.style.height=elements.innerPluginsContainer.height+"px"):(elements.innerPluginsContainer.style.height=e&&!t?elements.innerPluginsContainer.height-50+"px":elements.innerPluginsContainer.height+"px",elements.innerPluginsContainer.style.height=t?parseInt(elements.innerPluginsContainer.style.height)-43+"px":parseInt(elements.innerPluginsContainer.style.height)+"px",elements.innerPluginsContainer.style.top=t?parseInt(elements.innerPluginsContainer.style.top)+43+"px":parseInt(elements.innerPluginsContainer.style.top)+"px")}}function resetSpeed(){stage.resetSpeed()}function triggerListeners(e,t){occurredEvents.indexOf(e)==-1&&occurredEvents.push(e);for(var n=0;e in listeners&&n<listeners[e].length;n++)listeners[e][n](t)}function triggerMovementListeners(e,t,n){var s=getPluginIdByElement(e),i=movementListeners[s];if(i&&i.element===e){var a={};exists(e.width)&&(a.width=e.width),exists(e.height)&&(a.height=e.height),exists(e.top)&&(a.top=e.top),exists(e.right)&&(a.right=e.right),exists(e.bottom)&&(a.bottom=e.bottom),exists(e.left)&&(a.left=e.left),exists(e.hidden)&&(a.hidden=e.hidden),t&&(a.animate=!0,a.duration=n);for(var r=0;r<i.listeners.length;r++)i.listeners[r](a)}}function _unmute(){stage.unmute()}function verifyDependencies(){}if(!(this instanceof CLViewer))return new CLViewer(_params);var self=this,cl=window.Cliplister,elements={},_features={},_platform={},params={},config={},listeners={},occurredEvents=[],movementListeners={},products=[],stage,loadedAsset,currentAssetIndex,currentProductIndex,requestToken,stageHeightAdjustment=0,notifyID={asset:0,viewer:0},interval={instance:{},globalTimeout:0,counter:0,fns:[],timeouts:[],maxTimeout:0},Counter={count:0,getUniqueNumber:function(){return exists(cl[Counter])?cl.Counter.getUniqueNumber():++this.count}},fetched_images={},hasScrollbar=function(){if("number"==typeof window.innerWidth)return window.innerWidth>document.documentElement.clientWidth;var e,t=document.documentElement||document.body;"undefined"!=typeof t.currentStyle&&(e=t.currentStyle.overflow),e=e||window.getComputedStyle(t,"").overflow;var n;"undefined"!=typeof t.currentStyle&&(n=t.currentStyle.overflowY),n=n||window.getComputedStyle(t,"").overflowY;var s=t.scrollHeight>t.clientHeight,i=/^(visible|auto)$/.test(e)||/^(visible|auto)$/.test(n),a="scroll"===e||"scroll"===n;return s&&i||a},Resizer={knownWidth:0,knownHeight:0,currentWidth:0,currentHeight:0,watch:function(){this.unwatch(),this.checkInterval=setInterval(this.check,250)},watchSlow:function(){this.unwatch(),this.checkInterval=setInterval(this.check,1e3)},unwatch:function(){this.checkInterval&&window.clearInterval(this.checkInterval)},check:function(e){e="undefined"!=typeof e&&e;var t=exists(params.stage)&&exists(params.stage.removeSize)&&"padding"===params.stage.removeSize;if(config.fullscreen&&!_platform.os.isIPad){e=!0;var n={width:window.innerWidth,height:window.innerHeight};this.currentWidth=window.innerWidth,this.currentHeight=window.innerHeight}else{var n=getComputedStyle(config.parent);this.currentWidth=t?Math.round(parseFloat(n.width))-Math.round(parseFloat(n.paddingLeft))-Math.round(parseFloat(n.paddingRight))-Math.round(parseFloat(n.borderLeftWidth))-Math.round(parseFloat(n.borderRightWidth)):Math.round(parseFloat(n.width)),this.currentHeight=t?Math.round(parseFloat(n.height))-Math.round(parseFloat(n.paddingTop))-Math.round(parseFloat(n.paddingBottom))-Math.round(parseFloat(n.borderTopWidth))-Math.round(parseFloat(n.borderBottomWidth)):Math.round(parseFloat(n.height))}if(Math.round(parseFloat(this.knownHeight))!==Math.round(parseFloat(this.currentHeight))&&(!config.fullscreen||"undefined"==typeof params.stage.aspectRatio||"undefined"==typeof params.stage.width)||Math.round(parseFloat(this.knownWidth))!==Math.round(parseFloat(this.currentWidth))&&(!config.fullscreen||"undefined"==typeof params.stage.aspectRatio||"undefined"==typeof params.stage.height)||e){var s=!1;if(config.fullscreen)var i=Math.round(parseFloat(n.width)),a=Math.round(parseFloat(n.height));else var i=t?Math.round(parseFloat(n.width))-Math.round(parseFloat(n.paddingLeft))-Math.round(parseFloat(n.paddingRight))-Math.round(parseFloat(n.borderLeftWidth))-Math.round(parseFloat(n.borderRightWidth)):Math.round(parseFloat(n.width)),a=t?Math.round(parseFloat(n.height))-Math.round(parseFloat(n.paddingTop))-Math.round(parseFloat(n.paddingBottom))-Math.round(parseFloat(n.borderTopWidth))-Math.round(parseFloat(n.borderBottomWidth)):Math.round(parseFloat(n.height));if(params.stage&&params.stage.aspectRatio){s={};var r=getAsset(),o="undefined"==typeof r||"undefined"==typeof r.aspectratio||null===r.aspectratio?[16,9]:r.aspectratio.split(":"),l=("asset"==params.stage.aspectRatio?o:params.stage.aspectRatio.split(":"))||[16,9];if(exists(r)&&exists(r.type)&&"eFlyer"===r.type)l=[Math.sqrt(2),1];else if(exists(r)&&"3Dasset"===params.assetKind&&"asset"===params.stage.aspectRatio){for(var u=config.parent.parentElement;0===u.offsetHeight;)u=u.parentElement;var g=getComputedStyle(u),c=parseFloat(g.paddingLeft)+parseFloat(g.paddingRight),p=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),d=parseFloat(g.borderLeftWidth)+parseFloat(g.borderRightWidth),m=parseFloat(g.borderTopWidth)+parseFloat(g.borderBottomWidth),f=u.offsetWidth-c-d,h=u.offsetHeight-p-m;l=[f,h]}if(params.stage.width&&!params.stage.height){s.width=distanceToPx(params.stage.width,i),hasScrollbar();var y=Math.round(parseInt(s.width/l[0]*l[1]+stageHeightAdjustment));exists(stage)&&exists(stage.setBottom)&&stage.setBottom(stageHeightAdjustment),s.minHeight&&y<s.minHeight?s.height=s.minHeight:params.stage.maxHeight&&y>params.stage.maxHeight?s.height=s.maxHeight:s.height=y,exists(s.minHeight)&&(s.availableHeight+=s.minHeight),s.availableHeight-=s.height}else if(params.stage.height&&!params.stage.width){s.height=distanceToPx(params.stage.height,a);var v=Math.round(parseInt(s.height-stageHeightAdjustment/l[1]*l[0]));params.stage.minWidth&&v<params.stage.minWidth?s.width=s.minWidth:params.stage.maxWidth&&v>params.stage.maxWidth?s.width=s.maxWidth:s.width=v,exists(s.minWidth)&&(s.availableWidth+=s.minWidth),s.availableWidth-=s.width}}this.knownWidth=s?s.width:parseInt(i),this.knownHeight=s?s.height:parseInt(a);var P=s?s:n;config.dimensions.width=this.knownWidth,config.dimensions.height=this.knownHeight,elements.inner.style.width=parseInt(this.knownWidth)+(/%$/.test(P.width)?"%":"px"),elements.inner.style.height=parseInt(this.knownHeight)+(/%$/.test(P.height)?"%":"px"),elements.innerPluginsContainer&&(elements.innerPluginsContainer.height=this.knownHeight-config.measures.offsets.top-config.measures.offsets.bottom),elements.innerPluginsContainer&&(elements.innerPluginsContainer.width=this.knownWidth-config.measures.offsets.left-config.measures.offsets.right),elements.innerPluginsContainer&&(elements.innerPluginsContainer.style.width=elements.innerPluginsContainer.width+(/%$/.test(P.width)?"%":"px")),elements.innerPluginsContainer&&(elements.innerPluginsContainer.style.height=elements.innerPluginsContainer.height+(/%$/.test(P.height)?"%":"px"));var b=_platform.os.mobile;b=!(exists(params.plugins)&&exists(params.plugins)&&exists(params.plugins.InnerControls)&&exists(params.plugins.InnerControls.mobileDefaultControls)&&!params.plugins.InnerControls.mobileDefaultControls)&&b;var w="iOS"==_platform.os.name&&_platform.os.version>="10"&&b;elements.innerPluginsContainer&&(_getProgressPlayed()?(elements.innerPluginsContainer.style.height=b&&!w?elements.innerPluginsContainer.height-50+"px":elements.innerPluginsContainer.height+"px",elements.innerPluginsContainer.style.height=w?parseInt(elements.innerPluginsContainer.style.height)-43+"px":parseInt(elements.innerPluginsContainer.style.height)+"px",elements.innerPluginsContainer.style.top=w?parseInt(elements.innerPluginsContainer.style.top)+43+"px":parseInt(elements.innerPluginsContainer.style.top)+"px"):(elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px",elements.innerPluginsContainer.style.height=elements.innerPluginsContainer.height+"px"));var x=!0;if(exists(r)&&!exists(r.pagesDataLink)){!b&&exists(elements.stageWrapper)&&(elements.stageWrapper.style.height=elements.inner.clientHeight+"px"),elements.innerPluginsContainer&&(elements.innerPluginsContainer.style.top=config.measures.offsets.top+"px");var A=exists(elements.stageWrapper)?getComputedStyle(elements.stageWrapper).height:getComputedStyle(elements.inner).height,C=exists(elements.stageWrapper)?elements.stageWrapper.clientHeight:elements.inner.clientHeight;x=elements.inner.clientHeight<C;var _=Math.round(C/o[1]*o[0]);x=elements.inner.clientWidth>_}if(_isFullscreen()&&elements.innerPluginsContainer&&parseInt(A)>parseInt(elements.innerPluginsContainer.style.height)+1)x?elements.innerPluginsContainer.style.top=0:elements.innerPluginsContainer.style.top=0,elements.innerPluginsContainer.style.height=parseInt(getComputedStyle(elements.inner).height)+"px";else{var S=0,E=parseInt(getComputedStyle(elements.inner).height);"Safari"===_platform.browser.name&&(x||(E=screen.height)),_isFullscreen()&&("Safari"===_platform.browser.name&&"Safari"===_platform.browser.name&&x&&(E=elements.inner.clientHeight),S=E/2-parseInt(A)/2),_isDone("stageSet"),_isFullscreen()&&elements.innerPluginsContainer&&(x?elements.innerPluginsContainer.style.top=0:elements.innerPluginsContainer.style.top=_isPlaying()?0:S,"Safari"===_platform.browser.name&&(elements.inner.style.height=E+"px"),elements.innerPluginsContainer.style.height=parseInt(getComputedStyle(elements.inner).height)+"px"),_getProgressPlayed()&&elements.innerPluginsContainer&&(elements.innerPluginsContainer.style.top=w?parseInt(elements.innerPluginsContainer.style.top)+43+"px":parseInt(elements.innerPluginsContainer.style.top)+"px",elements.innerPluginsContainer.style.height=w?parseInt(elements.innerPluginsContainer.style.height)-43+"px":parseInt(elements.innerPluginsContainer.style.height)+"px")}params.stage&&params.stage.forceDimensions&&(config.parent.style.width=this.knownWidth+(/%$/.test(P.width)?"%":"px"),config.parent.style.height=this.knownHeight+(/%$/.test(P.height)?"%":"px")),repositionInnerPluginElements(),triggerListeners("resize")}}};return init(_params),getPublicApi()};CLViewer.prototype.version=VERSION,window.Cliplister.addViewer(CLViewer)}(window,void 0);"use strict";!function(e,t){var i="video",n="1.2",r=function s(i){function n(t){var n=("http:"===location.protocol?"http:":"https:")+"//mycliplister.com/static/viewer/assets/chk/meta2.png?n="+Math.random(),r=[],s=[],u=[],a=[],l=0,o=new XMLHttpRequest;o.addEventListener("loadstart",function(e){"undefined"==typeof r[t]&&(r[t]=(new Date).getTime())}),o.addEventListener("loadend",function(n){s[t]=(new Date).getTime();var o="undefined"==typeof a[t]?r[t]:a[t],p="undefined"==typeof u[t]?s[t]:u[t],g=(p-o)/1e3,c=8*l;e.downloadSpeed=Math.round(c/g),i.pluginApi.triggerListeners("bandwidthChecked")}),o.addEventListener("progress",function(e){l=e.loaded}),o.onreadystatechange=function(){2===o.readyState&&(a[t]=(new Date).getTime())};try{o.open("GET",n),o.timeout=2e3,o.send()}catch(p){e.downloadSpeed=1e5,i.pluginApi.triggerListeners("bandwidthChecked")}}function r(){if(_.playPosition=U.getTimePlayed(),!isNaN(U.getProgressPlayed())&&Math.round(_.playProgress)!==Math.round(U.getProgressPlayed())&&Math.round(U.getProgressPlayed())%10===0)switch(Math.round(U.getProgressPlayed())){case 0:i.pluginApi.triggerListeners("progress0");break;case 10:i.pluginApi.triggerListeners("progress10");break;case 20:i.pluginApi.triggerListeners("progress20");break;case 30:i.pluginApi.triggerListeners("progress30");break;case 40:i.pluginApi.triggerListeners("progress40");break;case 50:i.pluginApi.triggerListeners("progress50");break;case 60:i.pluginApi.triggerListeners("progress60");break;case 70:i.pluginApi.triggerListeners("progress70");break;case 80:i.pluginApi.triggerListeners("progress80");break;case 90:i.pluginApi.triggerListeners("progress90");break;case 100:i.pluginApi.triggerListeners("progress100");break;case 5:i.pluginApi.triggerListeners("progress5");break;case 15:i.pluginApi.triggerListeners("progress15");break;case 25:i.pluginApi.triggerListeners("progress25");break;case 35:i.pluginApi.triggerListeners("progress35");break;case 45:i.pluginApi.triggerListeners("progress45");break;case 55:i.pluginApi.triggerListeners("progress55");break;case 65:i.pluginApi.triggerListeners("progress65");break;case 75:i.pluginApi.triggerListeners("progress75");break;case 85:i.pluginApi.triggerListeners("progress85");break;case 95:i.pluginApi.triggerListeners("progress95");break;default:console.log("Played a percentage not in between 0 and 100... wait wat.")}if(Math.round(_.playProgress)!==Math.round(U.getProgressPlayed())&&"Safari"===i.pluginApi.platform().browser.name){var e=V.videoWidth,t=V.videoHeight;W.width=e,W.height=t,j.drawImage(V,0,0,e,t)}_.playProgress=U.getProgressPlayed(),_.bufferPercent=U.getPercentBuffered(),_.playPosition===_.oldPlayPosition?(Z||i.pluginApi.triggerListeners("buffering"),Z=!0):(Z=!1,i.pluginApi.triggerListeners("bufferingDone")),_.oldPlayPosition=_.playPosition,_.oldPlayProgress=_.playProgress,_.oldBufferPercent=_.bufferPercent,V.quality!=_.currentQuality&&i.pluginApi.isDone("bandwidthChecked")&&(V.quality=_.currentQuality,B())}function u(){return $}function a(){o(),l()}function l(){U.switchBitrate=function(e){return U},U.enterFullscreen=function(){return S(),U},U.getAvailableQualities=function(){return u()},U.getCurrentBitrate=function(){return $[_.currentQuality].bitrate},U.getCurrentQuality=function(){return $[_.currentQuality]},U.getDuration=function(){return i.pluginApi.exists(V)?Math.round(V.duration):0},U.getProgressPlayed=function(){return i.pluginApi.exists(V)?V.currentTime/(V.duration/100):0},U.getTimePlayed=function(){return i.pluginApi.exists(V)?V.currentTime:0},U.getTimeBuffered=function(){return i.pluginApi.exists(V)&&V.buffered.length?V.buffered.end(V.buffered.length-1):0},U.getPercentBuffered=function(){return i.pluginApi.exists(V)&&V.buffered.length?V.buffered.end(V.buffered.length-1)/V.duration*100:0},U.getPlaybackSpeed=function(){},U.getVolume=function(){return i.pluginApi.exists(V)?parseInt(100*V.volume):0},U.getSrc=function(){return!!i.pluginApi.exists(V)&&Q(_.currentQuality)},U.isMuted=function(){return!!i.pluginApi.exists(V)&&V.muted},U.getVideoElement=function(){return!!i.pluginApi.exists(V)&&V},U.isNativeFullscreen=function(){return Y},U.isPlaying=function(){return G},U.isQualityOverride=function(){return ie},U.isStopped=function(){return K},U.leaveFullscreen=function(){return C(),U},U.exitFullscreen=function(){return P(),U},U.mute=function(){return!!i.pluginApi.exists(V)&&(_.volumeBeforeMute=i.pluginApi.getVolume(),i.pluginApi.setVolume(0),V.muted=!0,i.pluginApi.triggerListeners("mute"),void i.pluginApi.triggerListeners("volumeChange"))},U.onFullscreenChange=function(e){N(e)},U.pause=function(){return E(),U},U.play=function(){return F(),_.playPromise},U.setTimePlayed=function(e){return I(e),U},U.setProgressPlayed=function(e){return T(e),U},U.setQuality=function(e){return R(e),U},U.setQualityOverride=function(e){return q(e),U},U.setVolume=function(e){return b(e),U},U.showMedia=function(e){M(e)},U.stop=function(){return z(),i.pluginApi.platform().os.mobile&&i.pluginApi.triggerListeners("stop"),U},U.unmute=function(){("iOS"!==i.pluginApi.platform().os.name||X)&&(V.muted=!1,i.pluginApi.setVolume(100),i.pluginApi.triggerListeners("unmute"),i.pluginApi.triggerListeners("volumeChange"))},U.slower=function(){return V.playbackRate>=ae+oe&&(V.playbackRate-=oe,i.pluginApi.triggerListeners("playbackSpeedChange")),U},U.faster=function(){return V.playbackRate<=le-oe&&(V.playbackRate+=oe,i.pluginApi.triggerListeners("playbackSpeedChange")),U},U.setSpeed=function(e){return e>=ae&&e<=le&&(V.playbackRate=e,i.pluginApi.triggerListeners("playbackSpeedChange")),U},U.resetSpeed=function(){return V.playbackRate=V.defaultPlaybackRate,i.pluginApi.triggerListeners("playbackSpeedChange"),U},U.getCurrentSpeed=function(){return V.playbackRate},U.changeQuality=function(e){return D(e),U},U.showDefaultControls=function(){return L(),U},U.hideDefaultControls=function(){return x(),U},U.enableIOSmobileautoplay=function(e){return w(e),U},U.enableIOSinlineplay=function(e){return k(e),U},U.appendNativeSubtitles=function(e,t,i,n){return g(e,t,i,n),U},U.setStageWidth=function(e){return c(e),U},U.setStageHeight=function(e){return d(e),U},U.getStageWidth=function(){return parseInt(V.style.width)},U.getStageHeight=function(){return parseInt(V.style.height)},U.getStageHeightAbs=function(){return parseInt(V.clientHeight)},U.getStageWidthAbs=function(){return parseInt(V.clientWidth)},U.setTop=function(e){e=isNaN(parseInt(e))?0:e,H.style.top=parseInt(e)+"px"},U.setBottom=function(e){e=isNaN(parseInt(e))?0:e,i.pluginApi.exists(H)&&(H.style.bottom=parseInt(e)+"px")},U.setLeft=function(e){e=isNaN(parseInt(e))?0:e,H.style.left=parseInt(e)+"px"},U.setRight=function(e){e=isNaN(parseInt(e))?0:e,H.style.right=parseInt(e)+"px"}}function o(){if(i.pluginApi.exists(i.parent)){i.parent.innerHTML="",H=document.createElement("div"),H.style.position="absolute",H.style.top="-1px",H.style.right="-1px",H.style.bottom="-1px",H.style.left="-1px",H.style.backgroundColor=i.pluginApi.getBackgroundColor(),H.style.color="#FFFFFF",i.parent.appendChild(H);var e=document.createElement("style");if(e.type="text/css",e.innerHTML=".activityIndicator {height:40px;width:40px;-webkit-background-size:40px 40px;margin:0px auto;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;-webkit-animation-name:spinnerAnim;}@-webkit-keyframes spinnerAnim {0% { -webkit-transform:rotate(0deg);}100% { -webkit-transform:rotate(360deg);}}",document.head.appendChild(e),V=document.createElement("video"),V.style.width="100%",V.style.height="100%",V.style.backgroundColor=i.pluginApi.getBackgroundColor(),V.preload="auto",V.controlsList="",i.pluginApi.platform().os.mobile&&(V.addEventListener("seeked",f),V.addEventListener("play",v),V.addEventListener("pause",h),V.requestFullscreen?V.addEventListener("fullscreenchange",i.pluginApi.fullscreenListener):V.mozRequestFullScreen?V.addEventListener("mozfullscreenchange",i.pluginApi.fullscreenListener):V.webkitRequestFullScreen||V.webkitEnterFullScreen?V.addEventListener("webkitfullscreenchange",function(){"iOS"===i.pluginApi.platform().os.name&&(document.fullscreenElement=document.fullscreenElement?null:V,document.webkitFullscreenElement=document.webkitFullscreenElement?null:V),i.pluginApi.fullscreenListener()}):V.msRequestFullscreen&&V.addEventListener("MSFullscreenChange",i.pluginApi.fullscreenListener)),"iOS"===i.pluginApi.platform().os.name&&"9"===i.pluginApi.platform().os.version&&(V.removeEventListener("ended",m),V.addEventListener("ended",m)),"iOS"===i.pluginApi.platform().os.name&&"12"===i.pluginApi.platform().os.version,V.addEventListener("volumechange",p),V.addEventListener("abort",y),V.addEventListener("error",A),V.onabort=y,V.onerror=A,H.appendChild(V),"Safari"===i.pluginApi.platform().browser.name){W=document.createElement("canvas");var t=V.videoWidth,n=V.videoHeight;W.width=t,W.height=n,W.style.position="absolute",W.style.width="0%",W.style.transform="translateY(-50%)",W.style.top="90000px",W.style.left="90000px",j=W.getContext("2d"),H.appendChild(W),W.style.width="100%"}var r=50;i.pluginApi.exists(i.defaultVolume)&&(r=i.defaultVolume),V.volume=r/100,"iOS"===i.pluginApi.platform().os.name&&"9"===i.pluginApi.platform().os.version||i.pluginApi.addEvent(V,"ended",function(){X=!1,i.pluginApi.triggerListeners("finish"),i.pluginApi.stop(!0)})}}function p(e){"Android"===i.pluginApi.platform().os.name&&(V.muted||_.volumeBeforeMute===parseInt(100*V.volume)||b(_.volumeBeforeMute))}function g(e,t,i,n){if(!V)return!1;if(t){var r=document.createElement("style");r.type="text/css",r.innerHTML=".cliplister-viewer video::cue{background: ".concat(t.textBackground,";font-size: ").concat(t.textSize,";font-family: ").concat(t.textFont,";color: ").concat(t.textColor,";text-shadow: 1px  1px 1px ").concat(t.textOutlineColor,", 1px -1px 1px ").concat(t.textOutlineColor,", -1px  1px 1px ").concat(t.textOutlineColor,", -1px -1px 1px ").concat(t.textOutlineColor,";}"),document.head.appendChild(r)}if(e){var s=Array.from(V.textTracks),u=s.find(function(e){return e.language===i.tag&&e.kind===n});if(u){var a=u.cues&&Array.from(u.cues);a&&a.forEach(function(e){return u.removeCue(e)})}else u=V.addTextTrack(n,i.label,i.tag);e.forEach(function(e){return u.addCue(e)})}}function c(e){V&&(V.style.width=e+"%")}function d(e){V&&(V.style.height=e+"%")}function f(e){i.pluginApi.triggerListeners("seek")}function m(e){"iOS"===i.pluginApi.platform().os.name&&"9"===i.pluginApi.platform().os.version&&(X=!1,V.removeEventListener("ended",m),i.pluginApi.triggerListeners("finish"),i.pluginApi.stop(!0))}function v(e){X||(i.pluginApi.triggerListeners("initialPlay"),X=!0),"iOS"===i.pluginApi.platform().os.name&&"9"===i.pluginApi.platform().os.version&&(V.removeEventListener("ended",m),V.addEventListener("ended",m)),i.pluginApi.triggerListeners("play"),(!G||"iOS"===i.pluginApi.platform().os.name&&"9"===i.pluginApi.platform().os.version)&&i.pluginApi.triggerListeners("playMedia"),G=!0,K=!1,J=!0,ee.start()}function h(e){var t;i.pluginApi.triggerListeners("pause"),"Android"===i.pluginApi.platform().os.name&&2===(null===(t=e.path)||void 0===t?void 0:t.length)||V.ended||i.pluginApi.triggerListeners("pauseMedia"),G=!1,J=!1,i.pluginApi.triggerListeners("bufferingDone"),ee.stop()}function y(e){return!0}function A(e){1!==V.error.code&&(z(),_.errCounter++<10&&F())}function b(e){return!!i.pluginApi.exists(V)&&(V.muted&&0!=e&&(V.muted=!1,i.pluginApi.triggerListeners("unmute")),e&&(_.volumeBeforeMute=e),V.volume=e/100,void i.pluginApi.triggerListeners("volumeChange"))}function L(){return!!i.pluginApi.exists(V)&&(V.controls=!0,V.setAttribute("controls","controls"),void(V.controlsList="nodownload"))}function x(){return!!i.pluginApi.exists(V)&&(V.controlsList="",void V.removeAttribute("controlslist"))}function w(e){try{if(!i.pluginApi.exists(V))return!1;if(e=!!i.pluginApi.exists(e)&&!!e,_.volumeBeforeMute=i.pluginApi.getVolume(),V.removeAttribute("muted"),V.removeAttribute("autoplay"),!e)return!1;U.mute(),V.muted=!0,V.autoplay=!0,V.controls=!0,V.playsinline=!0,V.setAttribute("muted","muted"),V.setAttribute("autoplay","autoplay"),V.setAttribute("controls",!0),V.setAttribute("playsinline",!0),F()}catch(t){console.error(t)}}function k(e){return!!i.pluginApi.exists(V)&&(e=!!i.pluginApi.exists(e)&&!!e,_.volumeBeforeMute=i.pluginApi.getVolume(),!!e&&(i.pluginApi.mute(),V.controls=!0,V.playsinline=!0,V.setAttribute("controls","controls"),void V.setAttribute("playsinline",!0)))}function S(){try{V.requestFullscreen?V.requestFullscreen():V.msRequestFullscreen?V.msRequestFullscreen():V.mozRequestFullScreen?V.mozRequestFullScreen():V.webkitRequestFullscreen?V.webkitRequestFullscreen():V.webkitEnterFullscreen&&V.webkitEnterFullscreen()}catch(e){}}function P(){try{Document.exitFullscreen?Document.exitFullscreen():V.exitFullscreen?V.exitFullscreen():V.msExitFullscreen?V.msExitFullscreen():V.mozExitFullScreen?V.mozExitFullScreen():V.webkitExitFullscreen&&V.webkitExitFullscreen()}catch(e){}C()}function C(){i.pluginApi.platform().os.mobile&&"iOS"===i.pluginApi.platform().os.name&&i.pluginApi.resetViewerSize()}function E(){G&&(_.playPromise?_.playPromise.then(function(){V.pause()})["catch"](function(){V.pause()}):V.pause(),G=!1,J=!1,i.pluginApi.platform().os.mobile&&"iOS"===i.pluginApi.platform().os.name&&i.pluginApi.resetViewerSize(),i.pluginApi.triggerListeners("pause")),Z=!1,i.pluginApi.triggerListeners("bufferingDone"),ee.stop()}function F(){if(!G)if(se=!0,setTimeout(function(){se=!1},2e3),J=!0,""!=V.src){var e=V.play();if(e!==t){var n=setTimeout(function(){},2e3);_.playPromise=e.then(function(){if(clearTimeout(n),X||(setTimeout(function(){i.pluginApi.triggerListeners("initialPlay")},1e3),X=!0),"Safari"===i.pluginApi.platform().browser.name){var e=V.videoWidth,t=V.videoHeight;W.width=e,W.height=t,j.drawImage(V,0,0,e,t)}i.pluginApi.triggerListeners("bufferingDone"),ee.start(),i.pluginApi.triggerListeners("play"),G=!0,K=!1})["catch"](function(e){V.muted?z(!0):(V.muted=!0,F())})}else V.play(),X||(i.pluginApi.triggerListeners("initialPlay"),X=!0),i.pluginApi.triggerListeners("bufferingDone"),ee.start(),i.pluginApi.triggerListeners("play"),G=!0,K=!1}else B()}function I(e){e=parseFloat(e),V.duration?(se=!0,setTimeout(function(){se=!1},2e3),e=e>=0?e<=V.duration?e:V.duration:0,V.currentTime=e,i.pluginApi.triggerListeners("seek")):(_.setTime=e,V.onloadeddata=function(e){se=!0,setTimeout(function(){se=!1},2e3),_.setTime=_.setTime>=0?_.setTime<=V.duration?_.setTime:V.duration:0,_.currentTime=_.setTime,i.pluginApi.triggerListeners("seek")})}function T(e){V.duration?(e=parseFloat(e),se=!0,setTimeout(function(){se=!1},2e3),V.currentTime=e>0?V.duration/100*e:0,i.pluginApi.triggerListeners("seek")):(_.setPerc=e,V.onloadeddata=function(e){se=!0,setTimeout(function(){se=!1},2e3),_.currentTime=_.setPerc>0?V.duration/100*_.setPerc:0,i.pluginApi.triggerListeners("seek")})}function q(e){ie=e,i.pluginApi.triggerListeners("setQuality")}function M(r){if(i.pluginApi.exists(V)){var s=i.pluginApi.platform(),u=r.uri.split("/");if(V.protocol=u[0],V.baseUrl=u[2],V.crypt=u.pop(),V.costumer=u.pop(),"iOS"===s.os.name&&s.os.version>="10"||"Android"===s.os.name){var a="",l=i.pluginApi.getPlugInParam("PreviewImage","image"),o=i.pluginApi.getPlugInParam("PreviewImage","backgroundSize");l?(a=l,o&&(V.style.objectFit=o)):i.pluginApi.exists(r.previews)&&i.pluginApi.exists(r.previews.picture)?a=r.previews.picture:i.pluginApi.exists(r.thumbnail)?a=r.thumbnail:i.pluginApi.exists(r.prerolls)&&i.pluginApi.exists(r.prerolls.preroll)&&i.pluginApi.exists(r.prerolls.preroll.content)&&(a=r.prerolls.preroll.content),V.poster=a,V.preload="none",V.quality=i.pluginApi.exists(V.quality)?V.quality:O(e.downloadSpeed/1024),V.src="",V.src=Q(V.quality),V.addEventListener("volumechange",function(e){console.log("muted",V.muted),i.pluginApi.triggerListeners("".concat(V.muted?"":"un","mute"))},!1)}i.pluginApi.getVolume()||(V.muted=!0);var p=i.pluginApi.getFixedQuality();if(p){if(_.fixedSpeedOverride=t,"number"==typeof p)_.fixedSpeedOverride=p/.7*1024;else if(Number.isNaN(parseInt(p))){var g=$.find(function(e){return e.display.toLowerCase()===p.toLowerCase()});g?_.fixedSpeedOverride=parseInt(g.bitrate)/.7*1024:_.fixedSpeedOverride=t}else _.fixedSpeedOverride=parseInt(p)/.7*1024;e.downloadSpeed=_.fixedSpeedOverride}V.language=r.language,q(!0),"undefined"==typeof e.downloadSpeed?(n(Math.round(1e7*Math.random())),i.pluginApi.on("bandwidthChecked",function(){V.quality=O(e.downloadSpeed/1024),_.currentQuality=V.quality,i.pluginApi.triggerListeners("mediaReady")})):(i.pluginApi.isDone("bandwidthChecked")||i.pluginApi.triggerListeners("bandwidthChecked"),V.quality=O(e.downloadSpeed/1024),_.currentQuality=V.quality,i.pluginApi.triggerListeners("mediaReady"))}}function O(e){var t=0;return $.every(function(i,n,r){return!(.7*e<i.bitrate)&&(t=n,!0)}),t}function Q(e,t){var n=i.pluginApi.getAvailableQualities();return V.protocol+"//"+V.baseUrl+"/"+n[e].string+"/"+V.costumer+"/"+V.crypt}function R(t){function n(e){q(!0),e>=0&&e<=_.maxQuality&&(_.currentQuality=e)}_.fixedSpeedOverride&&(t=_.fixedSpeedOverride);var r=u();if(t instanceof Object){if(i.pluginApi.exists(t.number))n(t.number);else if(i.pluginApi.exists(t.bitrate))if("auto"===t)q(!1),_.currentQuality=O(e.downloadSpeed/1024);else for(var s=0;s<r.length;s++)if(t.bitrate===parseInt(r[s].bitrate)){n(t.bitrate);break}}else{var a=parseInt(t);if(a){if(a<r.length)n(t);else for(var s=0;s<r.length;s++)if(parseInt(t)===parseInt(r[s].bitrate)){n(s);break}}else"auto"===t&&(q(!1),_.currentQuality=O(e.downloadSpeed/1024))}i.pluginApi.triggerListeners("setQuality")}function B(){function t(){if(V.currentTime=_.currentTime||0,n&&!Y&&E(),J){G=!1,F(),i.pluginApi.triggerListeners("bufferingDone");var e=setInterval(function(){V.currentTime>_.currentTime&&(clearInterval(e),ee.start(),te.removeCanvas(),i.pluginApi.triggerListeners("changeSrc"),i.pluginApi.triggerListeners("bufferingDone"),i.pluginApi.triggerListeners("initialImagesLoaded"))},10)}V.removeEventListener("canplay",t),ue=!1}te.createCanvas();var n=Y;return re=!0,ne=!0,_.currentTime=V.currentTime,i.pluginApi.triggerListeners("qualityChange"),i.pluginApi.triggerListeners("setQuality"),_.playPromise?_.playPromise.then(function(){V.pause()})["catch"](function(){V.pause()}):V.pause(),te.refreshCanvas(),ee.stop(),i.pluginApi.triggerListeners("buffering"),"undefined"==typeof e.downloadSpeed?i.pluginApi.on("bandwidthChecked",function(){V.quality=i.pluginApi.exists(V.quality)?V.quality:O(e.downloadSpeed/1024),V.src="",V.src=Q(V.quality),V.load(),V.addEventListener("canplay",t)}):(V.quality=i.pluginApi.exists(V.quality)?V.quality:O(e.downloadSpeed/1024),V.src="",V.src=Q(V.quality),V.load(),V.addEventListener("canplay",t)),V.src}function D(e){R(parseInt(e))}function N(e){V.requestFullScreen?i.pluginApi.addEvent(V,"fullscreenchange",function(){e()}):V.mozRequestFullScreen?i.pluginApi.addEvent(V,"mozfullscreenchange",function(){e()}):V.webkitRequestFullScreen?i.pluginApi.addEvent(V,"webkitfullscreenchange",function(){e()}):V.msRequestFullscreen?i.pluginApi.addEvent(V,"MSFullscreenChange",function(){e()}):(i.pluginApi.addEvent(V,"webkitendfullscreen",function(){Y=!1,E(),e()}),i.pluginApi.addEvent(V,"webkitbeginfullscreen",function(){Y=!0,e()}))}function z(e){if(X=!1,!e&&(e=!1),!K||e){_.playPromise?_.playPromise.then(function(){V.pause()})["catch"](function(){V.pause()}):V.pause();try{V.currentTime=0}catch(t){}G=!1,J=!1,K=!0,i.pluginApi.triggerListeners("stop"),ee.stop()}Z=!1,i.pluginApi.triggerListeners("bufferingDone")}if(!(this instanceof s))return new s(i);var H,V,W,j,U=this,Y=!1,G=!1,X=!1,J=!1,K=!0,Z=!1,$=[{string:"v",display:"S",bitrate:"500"},{string:"vm",display:"M",bitrate:"1000"},{string:"vx",display:"L",bitrate:"3000"}],_={volumeBeforeMute:50,currentTime:0,setTime:0,setPerc:0,playPosition:0,oldPlayPosition:0,bufferPercent:null,oldBufferPercent:null,playProgress:null,oldPlayProgress:null,lastQualityChange:0,maxQuality:$.length-1,currentQuality:0,playPromise:null,errCounter:0,fixedSpeedOverride:t},ee={checkInterval:null,notifyInterval:null,start:function(){this.stop(),this.checkInterval=setInterval(r,150),this.notifyInterval=setInterval(function(){i.pluginApi.triggerListeners("progress")},100)},stop:function(){clearInterval(this.checkInterval),clearInterval(this.notifyInterval)}},te={canvas:null,createCanvas:function(){this.canvas&&(H.removeChild(this.canvas),this.canvas=null),this.canvas=document.createElement("canvas");var e=V.videoWidth,t=V.videoHeight;this.canvas.width=e,this.canvas.height=t,this.canvas.style.position="absolute",this.canvas.style.width="0%",this.canvas.style.transform="translateY(-50%)",this.canvas.style.top="50%",this.canvas.style.left="0px";var i=this.canvas.getContext("2d");i.drawImage(V,0,0,e,t),H.appendChild(this.canvas),this.canvas.style.width="100%"},refreshCanvas:function(){if(this.canvas){var e=V.videoWidth,t=V.videoHeight,i=this.canvas.getContext("2d");i.drawImage(V,0,0,e,t),this.canvas.style.top="50%",this.canvas.style.left="0px"}else this.createCanvas()},removeCanvas:function(){this.canvas&&(this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),H.contains(this.canvas)&&H.removeChild(this.canvas),this.canvas=null)}},ie=!1,ne=!0,re=!0,se=!1,ue=!1,ae=.5,le=2,oe=.25;return a(),this};r.prototype.type=i,r.prototype.version=n,e.Cliplister.addStage(r)}(window,void 0);"use strict";!function(e,t){var n="InnerControls",a="1.6",i="visual",o="inner",l=function r(){function l(){(!F&&!P.exists(R.animation)||!F&&R.animation)&&(O(!0),P.animateElementPosition(V,"bottom",1,300,function(){},!1,!0),P.showCursor())}function s(e){if(P.getStageType&&"audio"===P.getStageType())return!1;if(F&&!P.exists(R.animation)||F&&R.animation){clearTimeout(W);var n="undefined"!=typeof R.timeout?parseInt(R.timeout):2e3;n=e===t?n:1,W=setTimeout(function(){if(P.getStageType&&"audio"===P.getStageType())return!1;if(!U||e&&!X){O(!1),P.animateElementPosition(V,"bottom",-(_+1),300,function(){},!1,!0);for(var t=P.getRootElement().querySelectorAll(".containerTrigger"),n=0;n<t.length;n++)t[n].checked=!1;P.isFullscreen()&&P.hideCursor()}},n)}}function c(){return B}function d(){return I}function u(){return D}function p(){return A}function g(){return R}function v(){return H}function f(){return N}function b(){return z}function h(e,t){return P.dataset(e,"clBinding")==t?e:h(e.parentNode,t)}function m(e,t){if(P.dataset(e,"clBinding")==t)return e;for(var n=e.childNodes,a=0;a<n.length;a++)if(1==n[a].nodeType){var i=m(n[a],t);if(i)return i}}function y(){var e={};P.exists(R.breakpoints)&&(e=R.breakpoints,V.classList.remove("cl-breakpoint-l"),P.exists(e.s)&&P.getStageDimension().width<=e.s?V.classList.add("cl-breakpoint-s"):(V.classList.remove("cl-breakpoint-s"),P.exists(e.m)&&P.getStageDimension().width<=e.m?V.classList.add("cl-breakpoint-m"):(V.classList.remove("cl-breakpoint-m"),V.classList.add("cl-breakpoint-l"))));for(var t=P.getRootElement().querySelectorAll(".containerTrigger"),n=0;n<t.length;n++)t[n].checked=!1}function x(){var e=P.platform().os.mobile;if(e=!(P.exists(R.mobileDefaultControls)&&!R.mobileDefaultControls)&&e,P.platform().os.mobile&&e)try{P.on("stageSet",function(){P.showDefaultControls()}),P.isDone("stageSet")&&P.showDefaultControls()}catch(t){console.warn(t.message)}else{V=document.createElement("div"),V.style.position="absolute","IE"==P.platform().browser.name&&10==P.platform().browser.version&&V.classList.add("cl-ie10"),$=P.extend(!0,$,R.qualityLabels);var n=document.getElementsByTagName("head")[0];if(P.getShadowRoot()&&(n=P.getRootElement()),P.exists(R.template)){if("external"==R.template.type){var a=R.template.source.replace(/[^\/]*$/,"");P.ajax(R.template.source,function(e){var t=document.createElement("div"),i=e.responseText;i=i.replace(/(url\(['"]?)([\da-z\.\-_\/]+)(['"]?\))/g,"$1"+a+"$2$3"),t.innerHTML=i;var o=document.createElement("style");o.type="text/css",o.appendChild(document.createTextNode(t.getElementsByTagName("style")[0].innerHTML)),n.appendChild(o),V.innerHTML=t.querySelector("#video-test-container").innerHTML,C()})}}else{var i=" #video-test-container{height: 300px;width: 800px;position: relative;}.cl-a{cursor: pointer;}.cl-b{ position: absolute;left: 0px;bottom: 0px;right: 0px;height: 52px;width: 100%;background-color: rgba(12,76,132,1);}.cl-b,.cl-b *{-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}.cl-c{ position: relative;height: 52px;width: 52px;float: right;background-size: auto 52px;background-repeat: no-repeat;background-color: inherit;background-image: url(default/img/controls-map.svg);}.cl-d{font-size: 18px;font-family: Arial;color: white;}.cl-e{ background-position: 0px 0px;background-position-x: 0px;float: left;}.cl-f{ background-position: -52px 0px;background-position-x: -52px;float: left;display: none;}.cl-g{ float: left;height: 52px;width: 80px;text-align: center;line-height: 52px;color: white;}.cl-h{position: relative;height: 52px;overflow: hidden;}.cl-i{position: relative;height: 4px;margin-left: 8px;margin-right: 8px;overflow: visible;top: 24px;border-radius: 5px;background-color: rgb(72,120,162);}.cl-j{position: relative;height: 100%;width: 0%;left: 0px;border-radius: 5px;background-color: rgb(163,187,181);}.cl-k{position: relative;height: 100%;width: 0%;left: 0px;border-radius: 5px;background-color: rgb(255,255,255);margin-top: -4px;}.cl-l{ float: right;height: 52px;width: 80px;text-align: center;line-height: 52px;}.cl-m{ background-position: -624px 0px;background-position-x: -624px;}.cl-m:hover .cl-m-overlay{visibility: visible;opacity: 1;}.cl-m-overlay{position: absolute;height: 96px;width: 100px;left: 0;bottom: 52px;opacity: 0;background-color: inherit;visibility: hidden;-webkit-transition: all ease-out 0.2s;-moz-transition: all ease-out 0.2s;-o-transition: all ease-out 0.2s;transition: all ease-out 0.2s;}.cl-m-tab{float: left;}.cl-m-tab label{margin-left: -1px;position: relative;left: 1px;top: 0px;font-size: 10px;color: white;padding: 5px;border: 1px solid rgba(12,76,132,1);}.cl-m-tab [type=radio]{display: none;}.cl-m-tab .cl-p{position: absolute;top: 30px;left: 0;right: 0;padding-left: 20px;padding-right: 20px;opacity: 0;}.cl-m-tab .cl-p input{ width: 100%;}.cl-q{ width: 100%;padding: 5px;border: 1px solid transparent;color: rgb(255,255,255);}.cl-q:hover{ border: 1px solid rgb(255,255,255);background-color: rgb(163,187,181);}.cl-q a{ display: inline-block;width: 100%;color: rgb(255,255,255);}.cl-q:hover a{ text-decoration: none;}.cl-m-tab [type=radio]:checked ~ label{border: 1px solid white;z-index: 2;}.cl-m-tab [type=radio]:checked ~ label ~ .cl-p{z-index: 1;opacity: 1;}.cl-r{ background-position: -468px 0px;background-position-x: -468px;}.cl-r:hover .cl-r-overlay{visibility: visible;opacity: 1;}.cl-r-text{position: absolute;top: 50%;left: 50%;font-size: 10px;color: white;transform: translate(-50%,-50%);}.cl-r-overlay{position: absolute;//height: 100px;width: 52px;bottom: 52px;opacity: 0;background-color: inherit;visibility: hidden;-webkit-transition: all ease-out 0.2s;-moz-transition: all ease-out 0.2s;-o-transition: all ease-out 0.2s;transition: all ease-out 0.2s;}.cl-r-overlay-entry{height: 30px;line-height: 30px;color: white;text-align: center;font-size: 10px;}.cl-v{ background-position: 0px 0px;}.cl-v:hover .cl-v-overlay{visibility: visible;opacity: 1;}.cl-v-text{position: absolute;top: 55%;left: 55%;font-size: 10px;color: white;}.cl-v-overlay{position: absolute;//height: 100px;width: 52px;bottom: 52px;opacity: 0;background-color: inherit;visibility: hidden;-webkit-transition: all ease-out 0.2s;-moz-transition: all ease-out 0.2s;-o-transition: all ease-out 0.2s;transition: all ease-out 0.2s;}.cl-v-faster{background-position: -520px 0px;background-position-x: -520px;}.cl-v-slower{background-position: -572px 0px;background-position-x: -572px;}.cl-aa{ background-position: -104px 0px;background-position-x: -104px;}.cl-ab{ background-position: -156px 0px;background-position-x: -156px;display: none;}.cl-ac{ -webkit-transition: all ease-out 0.2s;-moz-transition: all ease-out 0.2s;-o-transition: all ease-out 0.2s;transition: all ease-out 0.2s;}.cl-ac:hover .cl-ac-slider-container{visibility: visible;opacity: 1;}.cl-ae{ position: relative;height: 16px;width: 16px;position: absolute;background-color: #fff;border-radius: 100%;cursor: pointer;}.cl-g-point{ top: -6px;right: -8px;}.cl-ag{ top: -8px;left: -6px;}.cl-ac-slider-container{ position: absolute;height: 100px;width: 52px;bottom: 52px;opacity: 0;background-color: inherit;visibility: hidden;-webkit-transition: all ease-out 0.2s;-moz-transition: all ease-out 0.2s;-o-transition: all ease-out 0.2s;transition: all ease-out 0.2s;}.cl-ac-4,.cl-ac-3,.cl-ac-2,.cl-ac-1,.cl-ac-0{display: none;position: absolute;height: 52px;width: 52px;left: 0px;top: 0px;}.cl-ac-4{background-position: -208px 0px;background-position-x: -208px;}.cl-ac-3{background-position: -260px 0px;background-position-x: -260px;}.cl-ac-2{background-position: -312px 0px;background-position-x: -312px;display: block;}.cl-ac-1{background-position: -364px 0px;background-position-x: -364px;}.cl-ac-0{background-position: -416px 0px;background-position-x: -416px;}.cl-ac-slider-rail{ position: relative;margin: 20px auto;height: 60px;width: 4px;border-radius: 5px;background-color: rgb(72,120,162);}.cl-ac-slider-current{ position: absolute;height: 50%;width: 100%;left: 0px;bottom: 0px;border-radius: 5px;background-color: rgb(255,255,255);}",o='<div id="video-test-container"><div class="cl-b" data-cl-binding="controls"><div class="cl-a cl-c cl-e" data-cl-binding="play"></div><div class="cl-a cl-c cl-f" data-cl-binding="pause"></div><div class="cl-g cl-d"><span data-cl-binding="time-minute">00</span><span>:</span><span data-cl-binding="time-second">00</span></div><div class="cl-a cl-c cl-aa" data-cl-binding="fullscreen-enter"></div><div class="cl-a cl-c cl-ab" data-cl-binding="fullscreen-leave"></div><div class="cl-c cl-ac" data-cl-binding="volume"><div class="cl-c cl-ac-4" data-cl-binding="volume-80"></div><div class="cl-c cl-ac-3" data-cl-binding="volume-60"></div><div class="cl-c cl-ac-2" data-cl-binding="volume-40"></div><div class="cl-c cl-ac-1" data-cl-binding="volume-20"></div><div class="cl-c cl-ac-0" data-cl-binding="volume-0"></div><div class="cl-ac-slider-container"><div data-cl-binding="volume-bar" data-cl-orientation="vertical" class="cl-ac-slider-rail"><div data-cl-binding="volume-bar-filled" class="cl-ac-slider-current"><div data-cl-binding="volume-bar-slider" class="cl-ae cl-ag"></div></div></div></div></div><div class="cl-c cl-m" data-cl-binding="share-button"><div class="cl-m-overlay" data-cl-binding="share-overlay"><div class="cl-p cl-q"><a href="#" data-cl-binding="share-link-facebook">Facebook</a></div><div class="cl-p cl-q"><a href="#" data-cl-binding="share-link-twitter">Twitter</a></div><div class="cl-p cl-q"><a href="#" data-cl-binding="share-link-googleplus">Google+</a></div></div></div><div class="cl-c cl-r" data-cl-binding="quality-button"><div class="cl-r-overlay" data-cl-binding="quality-overlay"><div class="cl-a cl-r-overlay-entry" data-cl-binding="quality-overlay-entry">360p</div></div><div class="cl-r-text" data-cl-binding="playback-quality">Auto</div></div><div class="cl-c cl-v" data-cl-binding="speed-button"><div class="cl-v-overlay"><div class="cl-a cl-c cl-v-faster" data-cl-binding="playback-speed-faster"></div><div class="cl-a cl-c cl-v-slower" data-cl-binding="playback-speed-slower"></div></div><div class="cl-v-text" data-cl-binding="playback-speed">x1.0</div></div><div class="cl-l cl-d"><span data-cl-binding="duration-minute">00</span><span>:</span><span data-cl-binding="duration-second">00</span></div><div class="cl-h"><div class="cl-h"><div class="cl-i" data-cl-binding="progress-bar"><div class="cl-j" data-cl-binding="progress-bar-buffered"></div><div class="cl-k" data-cl-binding="progress-bar-filled"><div data-cl-binding="progress-bar-slider" class="cl-ae cl-g-point"></div></div></div></div></div></div></div>',r=document.createElement("style");r.type="text/css",r.appendChild(document.createTextNode(i)),n.appendChild(r);var c=document.createElement("div");c.innerHTML=o,V.innerHTML=c.querySelector("#video-test-container").innerHTML,setTimeout(C,1)}P.onPluginsBuilt(function(){P.disableCSSTransition(V),P.setElementPosition(V,"bottom","1",!1,!1),P.setElementSize(V,"width","100%",!1),P.setElementSize(V,"height",_),y(),P.enableCSSTransition(V)}),P.onMouseenter(V,function(){X=!0}),P.onMouseleave(V,function(){X=!1}),P.on(["play","pause"],function(){M()}),P.on("mouseenter",function(){U=!0,P.addEvent(document,"mousemove",M),l()}),P.on("mouseleave",function(){U=!1,s(),clearTimeout(Q),P.removeEvent(document,"mousemove",M)}),P.on("resize",function(){P.disableCSSTransition(V),y(),P.enableCSSTransition(V),s()}),s()}}function k(e){if(("fullscreen-enter"==e||"fullscreen-leave"==e)&&"IE"==P.platform().browser.name&&10==P.platform().browser.version)return!1;var t=["play","pause","time-second","time-minute","time-seconds","duration-second","duration-minute","duration-seconds","fullscreen-enter","fullscreen-leave","volume","share","playback-speed","quality","speed-button","subtitles-button","transcript-button","quality-button","download-button","download","share-button","progress-bar"],n=!0;return t.indexOf(e)>=0&&(R.whitelist&&R.whitelist.indexOf(e)==-1||R.blacklist&&R.blacklist.indexOf(e)>-1)&&(n=!1),n}function w(e,n,a){function i(e,n){var a=0;return function(){var i=(new Date).getTime();if(!(i-a<e))return a=i,n.apply(t,arguments)}}if(1==e.which){var o=function(e){n!==t&&n(e)},l=function s(t){1==t.which&&P.removeEvent(document,"mousemove",r),P.removeEvent(document,"mouseup",s),a&&a(e)},r=i(20,o);P.addEvent(document,"mousemove",r),P.addEvent(document,"mouseup",l)}}function C(){R.parent.appendChild(V);for(var e=V.getElementsByTagName("*"),t=0;t<e.length;t++){var n=e[t];if(P.dataset(n,"clBinding")){var a=P.dataset(n,"clBinding"),i=P.dashSeparatedToCamelCase(a);Y.add(n,i),k(a)||(n.style.display="none")}}}function L(t){var n=e.open(t,"_blank");n.focus()}function E(e){return!B&&(B=e,!0)}function T(e){return!I&&(I=e,!0)}function S(e){return!R&&(R=e,P=R.pluginApi,!0)}function q(e){return!z&&(z=e,!0)}function M(){l(),clearTimeout(Q);var e="undefined"!=typeof R.timeout?parseInt(R.timeout):2e3;Q=setTimeout(function(){s(!0)},e)}function O(e){F=e}if(!(this instanceof r))return new r;var B,I,D,A,R,H,N,z,P,V;D=o,A=n,H=i,N=a;var W,Q,F=!0,U=!1,X=!1,_=0,Y={add:function(e,t){var n=null,a=t,i=/\s*(\d+)$/.exec(t);i&&(n=i[0],a=t.slice(0,i.index)),Y[a]&&("function"==typeof Y[a]&&Y[a](e),Y[a].add?Y[a].add(e,a,n):(Y[a].list||(Y[a].list=[]),Y[a].list.push(e)))},clear:function(e){var t=e;Y[t]&&Y[t].list&&(Y[t].list=[])},controls:function(e){_=parseInt(getComputedStyle(e).height),P.setElementSize(V,"height",_),P.enableMovementListening(B,V)},durationMinute:function(e){e.innerHTML=P.pad(0,2),P.on(["mediaReady","assetReady"],function(){e.innerHTML=P.pad(Math.floor(P.getDuration()/60),2)},{subsequent:!0}),P.on("play",function(){e.innerHTML=P.pad(Math.floor(P.getDuration()/60),2)},{subsequent:!0})},durationSecond:function(e){e.innerHTML=P.pad(0,2),P.on(["mediaReady","assetReady"],function(){e.innerHTML=P.pad(P.getDuration()%60,2)},{subsequent:!0}),P.on("play",function(){e.innerHTML=P.pad(P.getDuration()%60,2)},{subsequent:!0})},durationSeconds:function(e){e.innerHTML.innerHTML=0,P.on(["mediaReady","assetReady"],function(){e.innerHTML=P.pad(P.getDuration(),2)},{subsequent:!0}),P.on("play",function(){e.innerHTML=P.pad(P.getDuration(),2)},{subsequent:!0})},fullscreenEnter:function(e){P.addEvent(e,"click",P.enterFullscreen),P.on("fullscreenChange",function(){O(!1),P.isFullscreen()?e.style.display="none":e.style.display="block","IE"==P.platform().browser.name&&11==P.platform().browser.version?setTimeout(function(){P.checkResize()},750):P.checkResize()});var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Vollbild einschalten":"Enter Fullscreen";e.setAttribute("aria-label",n)},fullscreenLeave:function(e){P.addEvent(e,"click",P.leaveFullscreen),P.on("fullscreenChange",function(){O(!1),P.isFullscreen()?e.style.display="block":e.style.display="none","IE"==P.platform().browser.name&&11==P.platform().browser.version?setTimeout(function(){P.checkResize()},750):P.checkResize()});var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Vollbild verlassen":"Leave Fullscreen";e.setAttribute("aria-label",n)},pause:function(e){P.addEvent(e,"click",P.pause),P.on("play",function(){e.style.display="block"}),P.on(["pause","stop"],function(){e.style.display="none"});var t=navigator.language||navigator.userLanguage,n=(t.startsWith("de"),"pause");e.setAttribute("aria-label",n)},play:function(e){P.addEvent(e,"click",function(){P.play(),P.triggerListeners("userPlay")}),P.on("play",function(){e.style.display="none"}),P.on(["pause","stop"],function(){e.style.display="block"});var t=navigator.language||navigator.userLanguage,n=(t.startsWith("de"),"play");e.setAttribute("aria-label",n)},playbackSpeed:{},playbackSpeedText:function(e){P.on("playbackSpeedChange",function(){e.textContent="x"+P.getCurrentSpeed()})},playbackSpeedFaster:function(e){P.addEvent(e,"click",function(){P.faster()})},playbackSpeedSlower:function(e){P.addEvent(e,"click",function(){P.slower()})},progress:{},progressBar:function(e){function n(e,n){var a=0;return function(){var i=(new Date).getTime();if(!(i-a<e))return a=i,n.apply(t,arguments)}}P.addEvent(e,"click",function(t){var n=e.getBoundingClientRect(),a=e.getRootNode().dir||"ltr",i=n.left+document.body.scrollLeft,o="rtl"===a?100-Math.round((t.pageX-i)/parseInt(getComputedStyle(e).width)*100):Math.round((t.pageX-i)/parseInt(getComputedStyle(e).width)*100);o=Math.min(Math.max(o,0),100),P.setProgressPlayed(o)}),P.addEvent(e,"mouseenter",function(t){var n=e.getBoundingClientRect(),a=n.left+document.body.scrollLeft,i=Math.round((t.pageX-a)/parseInt(getComputedStyle(e).width)*100);P.triggerListeners("progressBarHoverStart",[t,i])}),P.addEvent(e,"mouseleave",function(t){var n=e.getBoundingClientRect(),a=n.left+document.body.scrollLeft;Math.round((t.pageX-a)/parseInt(getComputedStyle(e).width)*100);P.triggerListeners("progressBarHoverEnd",t)});var a=function(t){var n=t.target.getBoundingClientRect(),a=n.left+document.body.scrollLeft,i=Math.round((t.pageX-a)/parseInt(getComputedStyle(e).width)*100);P.triggerListeners("progressBarHover",[t,i])},i=n(100,a);P.addEvent(e,"mousemove",i)},progressBarFilled:function(e){P.on(["progress","seek"],function(){e.style.width=Math.floor(100*P.getProgressPlayed())/100+"%"}),P.on("stop",function(){e.style.width="0%"})},progressBarBuffered:function(e){P.on(["progress","seek"],function(){e.style.width=Math.floor(P.getPercentBuffered())+"%"})},progressBarSlider:function(e){P.addEvent(e,"mousedown",function(t){var n=h(e,"progress-bar"),a=n.getBoundingClientRect(),i=a.left+document.body.scrollLeft,o=e.getRootNode().dir||"ltr";w(t,function(e){var t="rtl"===o?100-Math.round((e.pageX-i)/parseInt(getComputedStyle(n).width)*100):Math.round((e.pageX-i)/parseInt(getComputedStyle(n).width)*100);t=Math.min(Math.max(t,0),100),P.setProgressPlayed(t)})})},qualityButton:{},qualityOverlay:function(e){var t,n=e.getElementsByTagName("*");if(n.length>0){for(var a={},i=0;i<n.length;i++)if(P.dataset(n[i],"clBinding")&&"quality-overlay-entry"==P.dataset(n[i],"clBinding")){t=n[i];break}for(;e.firstChild;)e.removeChild(e.firstChild);t.textContent=$.auto,P.dataset(t).del("clBinding"),a.auto=t,P.exists(R.qualityLabelsOrder)||(e.appendChild(t),Y.add(t,"qualityOverlayEntry")),P.on("stageSet",function(){var n=P.hls();if(n){var i=function(){var n=P.hls();n.on(Hls.Events.MANIFEST_PARSED,function(i,o){for(var l=n.levels,r=function(n){var i=t.cloneNode(!0);i.textContent=l[n].height+"p",function(e){P.addEvent(i,"click",function(t){P.setQuality(e),P.triggerListeners("setQuality"),P.triggerListeners("qualityChange")})}(n),a["hls_"+n]=i,e.appendChild(i),Y.add(i,"qualityOverlayEntry")},s=0;s<l.length;s++)r(s)})};P.addEvent(t,"click",function(){n.currentLevel=-1}),P.on("hlsReady",i)}else!function(){for(Y.clear("qualityOverlayEntry");e.firstChild;)e.removeChild(e.firstChild);P.exists(R.qualityLabelsOrder)||(e.appendChild(t),Y.add(t,"qualityOverlayEntry"));for(var n=P.getAvailableQualities(),i=0;i<n.length;i++)$[n[i].bitrate]=n[i].display;P.addEvent(t,"click",function(){P.setQuality("auto"),P.triggerListeners("userQualityChange")});for(var o=function(i){var o=t.cloneNode(!0);o.textContent=$[n[i].bitrate],function(e){P.addEvent(o,"click",function(){P.setQuality(n[e].bitrate),P.triggerListeners("userQualityChange")})}(i),a[n[i].bitrate]=o,P.exists(R.qualityLabelsOrder)||(e.appendChild(o),Y.add(o,"qualityOverlayEntry"))},l=0;l<n.length;l++)o(l);if(R.qualityLabelsOrder)for(j=0;j<R.qualityLabelsOrder.length;j++)e.appendChild(a[R.qualityLabelsOrder[j]]),Y.add(a[R.qualityLabelsOrder[j]],"qualityOverlayEntry")}()},{subsequent:!0})}},qualityOverlayEntry:function(e){var t=function(){var t=P.hls();if(!t){var n=P.getCurrentQuality();if(P.exists(n)){var a=$[P.getCurrentQuality().bitrate];e.textContent==a&&P.isQualityOverride()?e.classList.add("selected"):P.isQualityOverride()||e.textContent!=$.auto?e.classList.remove("selected"):e.classList.add("selected")}}};P.on(["stageSet","stageReady"],t,{subsequent:!0}),P.on(["qualityChange","setQuality"],t)},qualityText:function(e){var t=function(){var t=P.hls();if(!t){var n=P.getCurrentQuality();if(P.exists(n)){var a=$[P.getCurrentQuality().bitrate];e.textContent=P.isQualityOverride()?a:$.auto}}},n=function(){var t=P.hls();t.on(Hls.Events.LEVEL_SWITCH,function(n,a){var i=a.level;e.textContent=t.autoLevelEnabled?$.auto:t.levels[i].height+"p"})};P.isDone("hlsCG")?n():P.on("hlsCG",n,{subsequent:!1}),P.on(["stageSet","stageReady"],t,{subsequent:!0}),P.on("qualityChange",t)},downloadButton:{},downloadOverlay:function(t){var n,a=t.getElementsByTagName("*");if(a.length>0){var i=function(){var i=!1,o=!1;P.exists(R.download)&&(R.download.indexOf("download-derivates")>-1&&(i=P.getVideoDownloadLinks()),R.download.indexOf("streaming-derivates")>-1&&(o=P.getVideoStreamingLinks()));for(var l=0;l<a.length;j++)if(P.dataset(a[l],"clBinding")&&"download-overlay-entry"===P.dataset(a[l],"clBinding")){n=a[l];break}for(;t.firstChild;)t.removeChild(t.firstChild);if(i){var r=n.cloneNode(!0);r.textContent="Download:",r.style.fontWeight="bold",r.style.fontSize="12px",r.style.paddingLeft="10px",t.appendChild(r),Y.add(r,"downloadOverlayEntry"),t.parentElement.style.display="block",Array.isArray(i)||(i=[i]);for(var s=function(a){var o=new Date(i[a].valid_to),l=new Date;if(!(o>l))return"break";var r=n.cloneNode(!0),s=i[a].name;"."===s.charAt(s.length-5)?s=s.substring(0,s.length-5):"."===s.charAt(s.length-4)&&(s=s.substring(0,s.length-4)),s.length>20&&(s=s.substring(0,19)+" ..."),r.textContent=s,function(t){P.addEvent(r,"click",function(){e.open(i[t].location)})}(a),t.appendChild(r),Y.add(r,"downloadOverlayEntry")},c=0;c<i.length;c++){var d=s(c);if("break"===d)break}}if(o){var u=n.cloneNode(!0);u.textContent="Streaming:",u.style.fontWeight="bold",u.style.fontSize="12px",u.style.paddingLeft="10px",t.appendChild(u),Y.add(u,"downloadOverlayEntry"),t.parentElement.style.display="block",Array.isArray(o)||(o=[o]),o.sort(function(e,t){var n=/desktop /,a=e.fileType||e.formatName||e.name;a=a.toLowerCase();var i=a.match(n);null!==i&&0===i.index&&(a=a.substring(n.toString().length-2));var o=t.fileType||t.formatName||t.name;o=o.toLowerCase();var l=o.match(n);return null!==l&&0===l.index&&(o=o.substring(n.toString().length-2)),a<o?-1:a>o?1:0});var p=function(a){var i=new Date(o[a].valid_to),l=new Date;if(!(i>l))return"break";var r=n.cloneNode(!0),s=o[a].fileType||o[a].formatName||o[a].name;if("play"===s)return"continue";var c=/Desktop /,d=s.match(c);null!==d&&0===d.index&&(s=s.substring(c.toString().length-2)),s.length>20&&(s=s.substring(0,19)+" ..."),r.textContent=s,function(t){P.addEvent(r,"click",function(){e.open(o[t].location)})}(a),t.appendChild(r),Y.add(r,"downloadOverlayEntry")};e:for(var g=0;g<o.length;g++){var v=p(g);switch(v){case"break":break e;case"continue":continue}}}i||o||(t.parentElement.style.display="none")};P.on("mediaReady",i)}},downloadOverlayEntry:function(e){var t=function(){};P.on("mediaReady",t)},share:{},shareOverlay:{},shareLinkFacebook:function(t){var n=R.shareUrl||e.location;t.onclick=function(){L("http://www.facebook.com/sharer.php?u="+encodeURI(n))}},shareLinkTwitter:function(t){var n=R.shareUrl||e.location;t.onclick=function(){L("https://twitter.com/intent/tweet?url="+encodeURI(n))}},shareLinkGoogleplus:function(t){var n=R.shareUrl||e.location;t.onclick=function(){L("https://plus.google.com/share?url="+encodeURI(n))}},shareLinkWhatsapp:function(t){var n=R.shareUrl||e.location;t.onclick=function(){L("whatsapp://send?text="+n)}},timeMinute:function(e){e.innerHTML=P.pad(0,2),P.on(["progress","seek"],function(){e.innerHTML=P.pad(Math.floor(Math.floor(P.getTimePlayed())/60),2)}),P.on("stop",function(){e.innerHTML=P.pad(0,2)})},timeSecond:function(e){e.innerHTML=P.pad(0,2),P.on(["progress","seek"],function(){e.innerHTML=P.pad(Math.floor(P.getTimePlayed())%60,2)}),P.on("stop",function(){e.innerHTML=P.pad(0,2)})},timeSeconds:function(e){e.innerHTML.innerHTML=0,P.on(["progress","seek"],function(){e.innerHTML=Math.floor(P.getTimePlayed())}),P.on("stop",function(){e.innerHTML=0})},volume:{},volumeIncrease:function(e){P.addEvent(e,"click",function(e){var t=P.getVolume()+5;t<100&&(P.setVolume(t),P.triggerListeners("volumeChangeDone"))})},volumeDecrease:function(e){P.addEvent(e,"click",function(e){var t=P.getVolume()-5;t>=0&&(P.setVolume(t),P.triggerListeners("volumeChangeDone"))})},volumeBar:function(t){P.addEvent(t,"click",function(n){n.stopPropagation();var a=t.getBoundingClientRect();if(P.dataset(t,"clOrientation")&&"vertical"==P.dataset(t,"clOrientation")){var i=e.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,o=a.bottom+i,l=Math.round(o-n.pageY)/parseInt(getComputedStyle(t).height)*100;l<1?l=0:l>99&&(l=100),P.setVolume(l),P.triggerListeners("volumeChangeDone")}else{var r=e.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0,s=a.left+r,c=Math.round((n.pageX-s)/parseInt(getComputedStyle(t).width)*100);c<1?c=0:c>99&&(c=100),P.setVolume(c),P.triggerListeners("volumeChangeDone")}}),P.on(["stageBuilt","stageReady","volumeChange"],function(){var e=P.getVolume(),n=m(t,"volume-bar-filled");n&&(P.dataset(t,"clOrientation")&&"vertical"==P.dataset(t,"clOrientation")?n.style.height=e+"%":n.style.width=e+"%")},{subsequent:!0})},volumeBarFilled:{},volumeBarSlider:function(t){P.addEvent(t,"click",function(e){e.stopPropagation()}),P.addEvent(t,"mousedown",function(n){n.stopPropagation();var a=h(t,"volume-bar-filled"),i=h(t,"volume-bar"),o=a.getBoundingClientRect();if(P.dataset(i,"clOrientation")&&"vertical"==P.dataset(i,"clOrientation")){var l=e.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,r=o.bottom+l,s=Math.round(r-n.pageY)/parseInt(getComputedStyle(i).height)*100+1;s<1?s=1:s>99&&(s=100),P.setVolume(s),w(n,function(e){var t=Math.round(r-e.pageY)/parseInt(getComputedStyle(i).height)*100;t<1?t=0:t>99&&(t=100),P.setVolume(t)},function(){P.triggerListeners("volumeChangeDone")})}else{var c=e.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0,d=o.left+c,u=Math.round((n.pageX-d)/parseInt(getComputedStyle(i).width)*100)+1;u<1?u=1:u>99&&(u=100),P.setVolume(u),w(n,function(e){var t=Math.round((e.pageX-d)/parseInt(getComputedStyle(i).width)*100);t<1?t=0:t>99&&(t=100),P.setVolume(t),P.isPlaying()&&P.play()},function(){P.triggerListeners("volumeChangeDone")})}})},volumeStep:{volumeIcons:{},add:function(e,t,n){e.percent=n;var a=h(e,"controls");a.uniqueid||(a.uniqueid=P.Counter.getUniqueNumber()),this.volumeIcons[a.uniqueid]||(this.volumeIcons[a.uniqueid]={}),e.controlsUniqueid=a.uniqueid;var i=Object.keys(this.volumeIcons[e.controlsUniqueid]);e.min=parseInt(n),e.max=100;for(var o=0;o<i.length;o++)if(i[o]>e.percent){o>0&&(this.volumeIcons[a.uniqueid][i[o-1]].max=e.percent-1),e.max=this.volumeIcons[a.uniqueid][i[o]].percent-1;break}this.volumeIcons[a.uniqueid][n]=e,this.init(e)},init:function(e){if(P.addEvent(e,"click",function(){if(P.isMuted()){P.unmute();var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Stummschalten":"mute";e.setAttribute("aria-label",n)}else{P.mute();var a=navigator.language||navigator.userLanguage,i=a.startsWith("de")?"Stummschaltung aufheben":"unmute";e.setAttribute("aria-label",i)}}),P.on(["mediaReady","play","volumeChange"],function(){var t=P.getVolume();t>=e.min&&t<=e.max?e.style.display="block":e.style.display="none"}),P.isMuted()){var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Stummschalten":"mute";e.setAttribute("aria-label",n)}else{var a=navigator.language||navigator.userLanguage,i=a.startsWith("de")?"Stummschaltung aufheben":"unmute";e.setAttribute("aria-label",i)}}},subtitlesOverlay:function(e){var t,n=e.getElementsByTagName("*");if(n.length>0){var a=function(){var a,i=!1;i=P.getSubtitleTracks();for(var o=0;o<n.length;j++)if(P.dataset(n[o],"clBinding")&&"subtitles-overlay-entry"===P.dataset(n[o],"clBinding")){t=n[o];break}for(;e.firstChild;)e.removeChild(e.firstChild);if(i&&!(null===(a=R.blacklist)||void 0===a?void 0:a.includes(e.parentElement.dataset.clBinding))){e.parentElement.style.display="block",Array.isArray(i)||(i=[i]);for(var l=function(n){var a=t.cloneNode(!0),o=i[n].language.label;"subtitles"!==i[n].kind&&(o+=" - ".concat(i[n].kind)),a.textContent=o,a.setAttribute("aria-label",o),a.dataset.tag=i[n].language.tag,a.dataset.kind=i[n].kind,a.dataset.active=i[n].active,a.classList.toggle("cl-subtitle-active",i[n].active),function(e){P.addEvent(a,"click",function(){P.triggerListeners("activeSubtitleSet",{kind:i[e].kind,tag:i[e].language.tag})})}(n),e.appendChild(a),Y.add(a,"subtitlesOverlayEntry")},r=0;r<i.length;r++)l(r)}i?1===i.length&&(e.style.display="none"):e.parentElement.style.display="none"};P.on("subtitlesSet",a),P.isDone("subtitlesSet")&&a()}},subtitlesOverlayEntry:function(e){},subtitlesToggle:function(e){P.addEvent(e,"click",function(){P.setSubtitlesEnabled(!P.isSubtitlesEnabled())}),P.on("subtitlesEnable",function(){e.classList.remove("cl-video-control-subtitles-disabled");var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Untertitel ausschalten":"Turn off subtitles";e.setAttribute("aria-label",n)}),P.on("subtitlesDisable",function(){e.classList.add("cl-video-control-subtitles-disabled");var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Untertitel einschalten":"Turn on subtitles";e.setAttribute("aria-label",n)})},transcriptOverlay:function(e){var t,n=e.getElementsByTagName("*");if(n.length>0){var a=function(){var a,i=!1;i=P.getTranscriptTracks();for(var o=0;o<n.length;j++)if(P.dataset(n[o],"clBinding")&&"transcript-overlay-entry"===P.dataset(n[o],"clBinding")){t=n[o];break}for(;e.firstChild;)e.removeChild(e.firstChild);if(i&&!(null===(a=R.blacklist)||void 0===a?void 0:a.includes(e.parentElement.dataset.clBinding))){e.parentElement.style.display="block",Array.isArray(i)||(i=[i]);for(var l=function(n){var a=t.cloneNode(!0),o=i[n].language.label;"transcript"!==i[n].kind&&(o+=" - ".concat(i[n].kind)),a.textContent=o,a.setAttribute("aria-label",o),a.dataset.tag=i[n].language.tag,a.dataset.kind=i[n].kind,a.dataset.active=i[n].active,a.classList.toggle("cl-transcript-active",i[n].active),function(e){P.addEvent(a,"click",function(){P.setActiveTranscriptTrack(i[e].language.tag)})}(n),e.appendChild(a),Y.add(a,"transcriptOverlayEntry")},r=0;r<i.length;r++)l(r)}i?1===i.length&&(e.style.display="none"):e.parentElement.style.display="none"};P.on("transcriptSet",a),P.isDone("transcriptSet")&&a()}},transcriptOverlayEntry:function(e){},transcriptToggle:function(e){P.addEvent(e,"click",function(){P.setTranscriptEnabled(!P.isTranscriptEnabled())}),P.on("transcriptEnable",function(){e.classList.remove("cl-video-control-transcript-disabled");var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Transcript ausschalten":"Turn off transcript";e.setAttribute("aria-label",n)}),P.on("transcriptDisable",function(){e.classList.add("cl-video-control-transcript-disabled");var t=navigator.language||navigator.userLanguage,n=t.startsWith("de")?"Transcript einschalten":"Turn on transcript";e.setAttribute("aria-label",n)})}},$={auto:"Auto"};return{getId:c,getLayer:d,getMode:u,getName:p,getParams:g,getType:v,getVersion:f,getWrapper:b,init:x,setId:E,setLayer:T,setParams:S,setWrapper:q}};l.prototype.name=n,l.prototype.version=a,l.prototype.type=i,l.prototype.mode=o,e.Cliplister.addPlugin(l)}(window,void 0);!function(e,n){var i="ClickableVideo",t="1.1.1",r="visual",u="inner",o=function p(e){function n(){return b}function o(){return h}function l(){return w}function a(){return P}function s(){return e}function c(){return T}function g(){return k}function f(){return C}function m(){E=document.createElement("div"),E.style.position="absolute",e.pointer&&(E.style.cursor="pointer"),e.pluginApi.platform().os.mobile&&(E.style.webkitTapHighlightColor="rgba(0,0,0,0)"),e.pluginApi.transparentBackground(E),E.onclick=function(){if(I++,1==I)clearTimeout(F),F=setTimeout(function(){I=0,clearTimeout(F),e.pluginApi.isPlaying()?e.pluginApi.pause():(e.pluginApi.play(),e.pluginApi.triggerListeners("userPlay"))},200);else if(2==I){if("IE"===e.pluginApi.platform().browser.name&&10==e.pluginApi.platform().browser.version)return!1;I=0,clearTimeout(F),e.pluginApi.isFullscreen()?e.pluginApi.leaveFullscreen():e.pluginApi.enterFullscreen()}},e.parent.appendChild(E),e.pluginApi.onPluginsBuilt(function(){e.pluginApi.setElementSize(E,"width","100%",!1),e.pluginApi.setElementSize(E,"height","100%")})}function d(e){return!b&&(b=e,!0)}function y(e){return!h&&(h=e,!0)}function A(n){return!e&&(e=n,!0)}function v(e){return!C&&(C=e,!0)}if(!(this instanceof p))return new p(e);var b,h,w,P,e,T,k,C,E;w=u,P=i,T=r,k=t;var F,I=0;return{getId:n,getLayer:o,getMode:l,getName:a,getParams:s,getType:c,getVersion:g,getWrapper:f,init:m,setId:d,setLayer:y,setParams:A,setWrapper:v}};o.prototype.name=i,o.prototype.version=t,o.prototype.type=r,o.prototype.mode=u,e.Cliplister.addPlugin(o)}(window,void 0);!function(i,n){var e="PlayButton",t="1.1",u="visual",o="inner",p=function r(i){function n(){return v}function p(){return w}function l(){return x}function g(){return E}function s(){return i}function a(){return L}function c(){return N}function d(){return S}function f(){return!!P()&&(b=document.createElement("div"),b.style.position="absolute",i.pluginApi.exists(i.image)&&(b.style.backgroundImage="url("+i.image+")"),b.style.backgroundSize="100% auto",b.style.cursor="pointer",i.pluginApi.addEvent(b,"click",function(){i.pluginApi.play(),i.pluginApi.triggerListeners("userPlay")}),i.pluginApi.on(["play","autoNextShown"],function(){i.pluginApi.hidePlugin(v)}),i.pluginApi.on("stop",function(){i.pluginApi.isLooping()||i.pluginApi.exists(i.pluginApi.isPlayNext)&&i.pluginApi.isPlayNext()||i.pluginApi.showPlugin(v)}),i.pluginApi.onPluginsBuilt(function(){i.pluginApi.setElementPosition({element:b,position:"top",value:"50%",reposition:!1,fromMiddlePoint:{x:!0,y:!0}}),i.pluginApi.setElementPosition({element:b,position:"left",value:"50%",reposition:!1,fromMiddlePoint:{x:!0,y:!0}}),i.pluginApi.setElementSize(b,"width",i.width,!1),i.pluginApi.setElementSize(b,"height",i.height)}),void i.parent.appendChild(b))}function m(i){return!v&&(v=i,!0)}function h(i){return!w&&(w=i,!0)}function A(n){return!i&&(i=n,T=i.pluginApi,!0)}function y(i){return!S&&(S=i,!0)}function P(){return i.image?i.width?!!i.height||(i.pluginApi.log("The "+k.name+" plugin requires a height.",1),!1):(i.pluginApi.log("The "+k.name+" plugin requires a width.",1),!1):(i.pluginApi.log("The "+k.name+" plugin requires the image parameter.",1),!1)}if(!(this instanceof r))return new r(i);var v,w,x,E,L,N,S,T,b,k=this;return x=o,E=e,L=u,N=t,{getId:n,getLayer:p,getMode:l,getName:g,getParams:s,getType:a,getVersion:c,getWrapper:d,init:f,setId:m,setLayer:h,setParams:A,setWrapper:y}};p.prototype.name=e,p.prototype.version=t,p.prototype.type=u,p.prototype.mode=o,i.Cliplister.addPlugin(p)}(window,void 0);!function(e,t){var n="PreviewImage",i="1.2",o="visual",r="inner",s=function u(e){function t(){return x}function s(){return w}function a(){return P}function c(){return S}function l(){return e}function p(){return k}function g(){return z}function f(){return I}function d(){var t=L.getAsset(),n="";L.exists(e.image)?n=e.image:L.exists(t.previews)&&L.exists(t.previews.picture)?n=t.previews.picture:L.exists(t.thumbnail)?n=t.thumbnail:L.exists(t.prerolls)&&L.exists(t.prerolls.preroll)&&L.exists(t.prerolls.preroll.content)&&(n=t.prerolls.preroll.content),L.setBGImage(N,n)}function y(){N=document.createElement("div"),N.style.position="absolute",N.style.backgroundColor="#fff",N.style.backgroundPosition="center center",N.style.backgroundSize="cover",L.platform().os.mobile&&(N.style.backgroundSize="contain",N.style.backgroundRepeat="no-repeat"),e.backgroundSize&&(N.style.backgroundSize="contain"===e.backgroundSize?"contain":"cover"),e.pointer&&(N.style.cursor="pointer"),L.on("assetReady",function(){d()}),L.on(["play","autoNextShown"],function(){L.getStageType&&"audio"===L.getStageType()||(L.setBGImage(N,""),L.hidePlugin(x))}),L.on("autoNextCanceled",function(){d()}),L.on("stop",function(){L.isLooping()||L.exists(L.isPlayNext)&&L.isPlayNext()||(d(),L.showPlugin(x))}),L.on("finish",function(){L.isLooping()||L.isLastAsset()||(d(),L.showPlugin(x))}),N.onclick=function(){L.play()},e.parent.appendChild(N),L.onPluginsBuilt(function(){L.setElementSize(N,"width","100%",!1),L.setElementSize(N,"height","100%")})}function m(e){return!x&&(x=e,!0)}function v(e){return!w&&(w=e,!0)}function b(t){return e?(L=e.pluginApi,!1):(e=t,!0)}function h(e){return!I&&(I=e,!0)}if(!(this instanceof u))return new u(e);var x,w,P,S,e,k,z,I,L,N;P=r,S=n,k=o,z=i;return{getId:t,getLayer:s,getMode:a,getName:c,getParams:l,getType:p,getVersion:g,getWrapper:f,init:y,setId:m,setLayer:v,setParams:b,setWrapper:h}};s.prototype.name=n,s.prototype.version=i,s.prototype.type=o,s.prototype.mode=r,e.Cliplister.addPlugin(s)}(window,void 0);"use strict";!function(e,n){var i="BufferingSpinner",t="2.1",r="visual",o="inner",a=function s(e){function n(){return A}function a(){return E}function p(){return C}function l(){return x}function u(){return e}function d(){return L}function m(){return P}function c(){return S}function f(){z.style.display="block"}function g(){z.style.display="none"}function h(){if(!k())return!1;if("iOS"===e.pluginApi.platform().name&&"9"==e.pluginApi.platform().version||"Android"===e.pluginApi.platform().os.name||"IE"===e.pluginApi.platform().browser.name&&10==e.pluginApi.platform().browser.version)return!1;if("doc"===e.mode&&e.pluginApi.platform().os.mobile)return!1;if(z=document.createElement("div"),e.parent.appendChild(z),e.pluginApi.exists(e.image)){var n=document.createElement("img");n.style.position="absolute",n.style.position="absolute",z.appendChild(n),n.src=e.image}else{var i=document.createElement("div");i.classList.add("spinner");var t=document.createElement("div");t.classList.add("spinner-item1");var r=document.createElement("div");r.classList.add("spinner-item2");var o=document.createElement("div");o.classList.add("spinner-item3");var a=document.createElement("div");a.classList.add("spinner-item4"),i.appendChild(t),i.appendChild(r),i.appendChild(o),i.appendChild(a),z.appendChild(i)}var s=document.createElement("style");s.type="text/css",s.innerHTML=".spinner { position: relative; text-align: center;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}.spinner > div { width: 16px; height: 16px; background-color: #ccc; border-radius: 100%; display: inline-block; -webkit-animation: sk-bouncedelay 1.7s infinite ease-in-out both; animation: sk-bouncedelay 1.7s infinite ease-in-out both; margin-right: 5px;}.spinner .spinner-item1 { -webkit-animation-delay: -0.60s; animation-delay: -0.60s;}.spinner .spinner-item2 { -webkit-animation-delay: -0.40s; animation-delay: -0.40s;}.spinner .spinner-item3 { -webkit-animation-delay: -0.20s; animation-delay: -0.20s;}@-webkit-keyframes sk-bouncedelay { 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); opacity: 0; } 40% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }}@keyframes sk-bouncedelay { 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); opacity: 0; } 40% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }}",document.head.appendChild(s),e.pluginApi.onPluginsBuilt(function(){e.pluginApi.setElementPosition({element:z,position:"top",value:"50%",reposition:!1,fromMiddlePoint:{x:!0,y:!0}}),e.pluginApi.setElementPosition({element:z,position:"left",value:"50%",reposition:!1,fromMiddlePoint:{x:!0,y:!0}}),e.pluginApi.exists(e.image)?(e.pluginApi.setElementSize(z,"width",e.width,!1),e.pluginApi.setElementSize(z,"height",e.height)):(e.pluginApi.setElementSize(z,"width",100,!1),e.pluginApi.setElementSize(z,"height",16))}),e.parent.appendChild(z),e.pluginApi.on("buffering",f),e.pluginApi.on("bufferingDone",g)}function y(e){return!A&&(A=e,!0)}function b(e){return!E&&(E=e,!0)}function v(n){return!e&&(e=n,!0)}function w(e){return!S&&(S=e,!0)}function k(){if(e.image){if(!e.width)return e.pluginApi.log("The "+M.name+" plugin requires a width.",1),!1;if(!e.height)return e.pluginApi.log("The "+M.name+" plugin requires a height.",1),!1}return!0}if(!(this instanceof s))return new s(e);var A,E,C,x,e,L,P,S,z,M=this;return C=o,x=i,L=r,P=t,{getId:n,getLayer:a,getMode:p,getName:l,getParams:u,getType:d,getVersion:m,getWrapper:c,show:f,hide:g,init:h,setId:y,setLayer:b,setParams:v,setWrapper:w}};a.prototype.name=i,a.prototype.version=t,a.prototype.type=r,a.prototype.mode=o,e.Cliplister.addPlugin(a)}(window,void 0);"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}!function(e,t){var n="image360",i="1.10",r=function l(e){function t(){a(),n()}function n(){M.nextImage=function(){return h(),M},M.prevImage=function(){return g(),M},M.lastImage=function(){return b(),M},M.firstImage=function(){return v(),M},M.nextLvl=function(){return A(),M},M.prevLvl=function(){return x(),M},M.lastLvl=function(){return E(),M},M.firstLvl=function(){return w(),M},M.enterFullscreen=function(){return M},M.leaveFullscreen=function(){return M},M.onFullscreenChange=function(e){return M},M.showMedia=function(e){W(e)},M.zoomImage=function(){return{xml:i(C[S][_].dataset.url),thumb:C[S][_].src,asseturl:C[S][_].dataset.url,assetid:C[S][_].dataset.id,dimensions:{width:C[S][_].clientWidth,height:C[S][_].clientHeight},fulldimensions:F}}}function i(e,t,n,i,r){i="undefined"!=typeof i?"?format="+i:"?format=jpg",r="undefined"!=typeof r?"&strip="+(r?"yes":"no"):"&strip=yes",t="undefined"!=typeof t?"&x="+(t?t:"1"):"",n="undefined"!=typeof n?"&y="+(n?n:"1"):"";var l=e+i+r+t+n;return l}function r(e){return"true"===e.dataset.loaded}function a(){T=!!e.pluginApi.exists(e.params.multilvl)&&e.params.multilvl,L=document.createElement("div"),L.id="image360container",L.style.overflow="hidden",L.style.height="100%",L.style.width="100%",L.style.backgroundColor=e.pluginApi.getBackgroundColor(),L.style.backgroundSize="contain",L.style.backgroundPosition="center",L.style.backgroundRepeat="no-repeat",L.style.color="#FFFFFF",L.style.pointer="pointer",L.style.display="flex",e.parent.appendChild(L),O=document.createElement("div"),O.id="shadow",O.style.display="none",O.style.position="absolute",O.style.overflow="hidden",O.style.top="0px",O.style.right="0px",O.style.bottom="0px",O.style.left="0px",O.style.backgroundColor="black",O.style.opacity="0.25",L.appendChild(O);var t=document.createElement("style");t.type="text/css",t.innerHTML=".activityIndicator {height:40px;width:40px;-webkit-background-size:40px 40px;margin:0px auto;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;-webkit-animation-name:spinnerAnim;}@-webkit-keyframes spinnerAnim {0% { -webkit-transform:rotate(0deg);}100% { -webkit-transform:rotate(360deg);}} .nodisplay{opacity:0!important;}",document.head.appendChild(t);var n=!!e.pluginApi.exists(e.params.showIndicators)&&e.params.showIndicators;j=document.createElement("div"),j.id="readyHIndicator",j.innerHTML="H",j.style.display=n?"block":"none",j.style.position="absolute",j.style.overflow="hidden",j.style.bottom="10px",j.style.left="10px",j.style.width="2em",j.style.height="2em",j.style.lineHeight="2em",j.style.fontFamily="Verdana, Arial, Helvetica, sans-serif",j.style.textAlign="center",j.style.color="black",j.style.backgroundColor="darkred",j.style.zIndex="1",z=document.createElement("div"),z.id="readyVIndicator",z.innerHTML="V",z.style.display=T&&n?"block":"none",z.style.position="absolute",z.style.overflow="hidden",z.style.bottom="10px",z.style.left="50px",z.style.width="2em",z.style.height="2em",z.style.lineHeight="2em",z.style.fontFamily="Verdana, Arial, Helvetica, sans-serif",z.style.textAlign="center",z.style.color="black",z.style.backgroundColor="darkred",z.style.zIndex="1",L.appendChild(j),L.appendChild(z),_=0,S=0,C=[],C[S]=[],F={width:0,height:0},P=!1,T=!!e.pluginApi.exists(e.params.multilvl)&&e.params.multilvl}function o(e,t){t="undefined"!=typeof t?t:S;var n,i,r,l,a,o,s;l=e,r=m(l),i=m(r),n=m(i),a=y(l),o=y(a),s=y(o);for(var u=[l,a,r,o,i,s,n],p=C[t].map(function(e,t,n){return t}),f=p.concat(u).filter(function(e,t,n){return n.indexOf(e)===n.lastIndexOf(e)}),h=u.length,g=0;g<h;++g)c(u[g],u[g]==l);for(var v=f.length,b=0;b<v;++b)d(f[b])}function s(t,n){return new Promise(function(i,l){function a(i){n&&e.pluginApi.triggerListeners("buffering");var r=function l(t){var n=t.target;e.pluginApi.removeEvent(n,"load",l),V=n.clientWidth>=n.clientHeight,D=n.clientWidth/n.clientHeight,N=B>D,n.dataset.loaded="true",I(n),o()};e.pluginApi.addEvent(C[t][i],"load",r),e.pluginApi.setImgSrc(C[t][i],C[t][i].dataset.src)}function o(){n&&(v(),e.pluginApi.triggerListeners("firstImageLoaded"));for(var i=F.length,r=function(){a=F[l];var r=function o(t){var r=t.target;e.pluginApi.removeEvent(r,"load",o),++z,r.dataset.loaded="true",I(r),z>=i&&(n&&e.pluginApi.triggerListeners("bufferingDone"),n&&e.pluginApi.triggerListeners("initialImagesLoaded"),p(!0),s())};e.pluginApi.addEvent(C[t][a],"load",r),e.pluginApi.setImgSrc(C[t][a],C[t][a].dataset.src)},l=0;l<i;++l){var a;r()}}function s(){for(var n=j.length,l=0;l<n;++l){var a=j[l];e.pluginApi.addEvent(C[t][a],"load",function(){e.pluginApi.removeEvent(this,"load"),this.dataset.loaded="true",I(this),C[t].every(r)&&(f(!0),p(!0),i(t)),!T||C.every(function(e){return e.every(r)})}),e.pluginApi.setImgSrc(C[t][a],C[t][a].dataset.src)}}t=e.pluginApi.exists(t)?t:S,n=!!e.pluginApi.exists(n)&&n;var u,d,c,h,g,b,A,x,k,w,E,H,W,L,_,F=[],O=C[t].map(function(e,t,n){return t}),P=function(e){var t,n=e!==e;return t=n||"function"!=typeof Array.prototype.indexOf?function(e){var t=-1,i=-1;for(t=0;t<this.length;t++){var r=this[t];if(n&&r!==r||r===e){i=t;break}}return i}:Array.prototype.indexOf,t.call(this,e)>-1};x=0,O.length>1&&(P.call(F,k=y(x))||F.push(k),P.call(F,A=m(x))||F.push(A),P.call(F,w=y(k))||F.push(w),P.call(F,b=m(A))||F.push(b),P.call(F,E=y(w))||F.push(E),P.call(F,g=m(b))||F.push(g),P.call(F,H=y(E))||F.push(H),P.call(F,h=m(g))||F.push(h),P.call(F,W=y(H))||F.push(W),P.call(F,c=m(h))||F.push(c),P.call(F,L=y(W))||F.push(L),P.call(F,d=m(c))||F.push(d),P.call(F,_=y(L))||F.push(_),P.call(F,u=m(d))||F.push(u));var j=O.concat(F,x).filter(function(e,t,n){return n.indexOf(e)===n.lastIndexOf(e)}),z=0;a(x)})}function u(t){t=e.pluginApi.exists(t)?t:S,d(_,t)}function d(t,n){n=e.pluginApi.exists(n)?n:S,C[n][t].style.left="99999px",C[n][t].style.position="absolute"}function c(t,n,i){i="undefined"==typeof i?S:i,C[i][t].style.display="block",C[i][t].style.left="undefined"!=typeof n&&n?"":"99999px",C[i][t].style.position="undefined"!=typeof n&&n?"relative":"absolute",e.pluginApi.triggerListeners("imageDisplayed")}function p(e){R=!e,j.style.backgroundColor=e?"limegreen":"darkred"}function f(e){U=!e,z.style.backgroundColor=e?"limegreen":"darkred"}function h(){return!R&&(_===C[S].length-1?_=0:_++,void(r(C[S][_])&&o(_)))}function g(){return!R&&(0===_?_=C[S].length-1:_--,void(r(C[S][_])&&o(_)))}function y(e){return e===C[S].length-1?0:e+1}function m(e){return 0===e?C[S].length-1:e-1}function v(){_=0,o(_)}function b(){return!R&&(_=C[S].length-1,void o(_))}function A(){return!U&&(c(_,!0,S===C.length-1?C.length-1:S+1),u(),S===C.length-1?S=C.length-1:S++,o(_),void f(C[k(S)].every(r)))}function x(){c(_,!0,0===S?0:S-1),u(),0===S?S=0:S--,o(_)}function k(e){return e===C.length-1?C.length-1:e+1}function w(){S=0,o(_)}function E(){return!U&&(S=C.length-1,void o(_))}function I(t){e.pluginApi.removeEvent(t,"load");var n="undefined"==typeof t.clientWidth||0===t.clientWidth?V:t.clientWidth>t.clientHeight,r="undefined"==typeof t.clientWidth||0===t.clientWidth?D:t.clientWidth/t.clientHeight;isNaN(r);"undefined"==typeof t.clientWidth?N:B>r;if(n!=Y&&t.clientWidth!=t.clientHeight){var l=L.clientHeight||L.parentElement.parentElement.clientHeight,a=L.clientWidth||L.parentElement.parentElement.clientWidth;t.src=i(t.dataset.url,n?a:"99999",n?"99999":l)}t.style.maxWidth="100%",t.style.maxHeight="100%"}function H(e,t){t=!t&&e/16*9;var n=e/t,i=1/n,r=L.clientHeight||L.parentElement.parentElement.clientHeight,l=L.clientWidth||L.parentElement.parentElement.clientWidth,a=(parseInt(r),parseInt(l)/(n>1?1:2)),o={width:0,height:0};return a<=150?o.width=200:a<=350?o.width=400:a<=700?o.width=800:a<=1100?o.width=1200:o.width=1900,o.height=o.width*i,o}function W(t){function n(e){return e.reduce(function(e,t){return e.then(function(e){return s(e).then(function(e){return v.push(e)})})["catch"](console.error)},Promise.resolve())}var r=L.clientHeight||L.parentElement.parentElement.clientHeight,l=L.clientWidth||L.parentElement.parentElement.clientWidth;Y=l>=r,B=l/r;var a=t.defaultPositionY;_=t.defaultPositionX,S=t.defaultPositionY;for(var o=t.images.length,u=t.images[a].length,d=0;d<o;d++){C[d]=[];for(var c=0;c<u;c++){var p=(t.images[d][c].uuid,t.images[d][c].assetLink),f=L.clientHeight||L.parentElement.parentElement.clientHeight,h=L.clientWidth||L.parentElement.parentElement.clientWidth,g=(H(h,f),i(p,Y?h:99999,Y?99999:f)),y=document.createElement("img");y.id="img360"+e.pluginApi.pad(c,2),y.style.position="absolute",y.style.left="99999px",y.style.margin="auto",y.dataset.src=g,y.dataset.id=e.pluginApi.pad(c,2),y.dataset.url=p,y.dataset.loaded=!1,C[d].push(y),L.appendChild(y),c==u-1&&d==a&&s(a,!0)}}var m=_toConsumableArray(C.keys()),v=[];n(m)}if(!(this instanceof l))return new l(e);var L,C,_,S,T,F,O,P,j,z,M=this,V=!0,D=1,N=!0,Y=!0,B=1,R=!0,U=!0;return t(),this};r.prototype.type=n,r.prototype.version=i,e.Cliplister.addStage(r)}(window,void 0);"use strict";!function(e,t){var n="Turntable",i="1.3",o="visual",r="inner",u=function p(t){function u(){return x}function s(){return h}function a(){return P}function c(){return b}function l(){return t}function d(){return y}function m(){return I}function v(){return w}function g(){function n(){var e=Y?"touchmove":"mousemove";t.pluginApi.addEvent(M,e,r)}function i(){var e=Y?"touchmove":"mousemove";t.pluginApi.removeEvent(M,e,r)}function o(n){n=n||e.event,"ArrowUp"===n.key?(n.preventDefault(),X?t.pluginApi.nextLvl():t.pluginApi.lastImage()):"ArrowDown"===n.key?(n.preventDefault(),X?t.pluginApi.prevLvl():t.pluginApi.firstImage()):"ArrowLeft"===n.key?(n.preventDefault(),t.pluginApi.prevImage()):"ArrowRight"===n.key&&(n.preventDefault(),t.pluginApi.nextImage())}function r(e){var n=0,i=0;if(!Y&&q)n=e.movementX||e.mozMovementX||e.webkitMovementX||0,i=e.movementY||e.mozMovementY||e.webkitMovementY||0;else{var o=Y?e.touches[0].clientX:e.clientX,r=Y?e.touches[0].clientY:e.clientY;n=o-c,i=r-l,c=Y?e.touches[0].clientX:e.clientX,l=Y?e.touches[0].clientY:e.clientY}s%d==d-1?(Math.abs(n)>Math.abs(i)&&(n<0?z||D?t.pluginApi.nextImage():t.pluginApi.prevImage():z||D?t.pluginApi.prevImage():t.pluginApi.nextImage()),s=0):s++,a%m==m-1?(X&&Math.abs(n)<Math.abs(i)&&(i<0?z||R?t.pluginApi.nextLvl():t.pluginApi.prevLvl():z||R?t.pluginApi.prevLvl():t.pluginApi.nextLvl()),a=0):a++}if(M=document.createElement("div"),M.style.position="absolute",t.pluginApi.transparentBackground(M),t.parent.appendChild(M),M.style.cursor="pointer",Y="ontouchstart"in e||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0,E={x:5,y:5},t.pluginApi.exists(t.speed)){var u,p;Number.isInteger(parseInt(t.speed))&&(E=Math.abs(parseInt(t.speed))<10?{x:Math.abs(parseInt(t.speed)),y:Math.abs(parseInt(t.speed))}:{x:10,y:10}),((null===(u=t.speed)||void 0===u?void 0:u.x)||(null===(p=t.speed)||void 0===p?void 0:p.y))&&(t.pluginApi.exists(t.speed.x)&&(E.x=Math.abs(parseInt(t.speed.x))),t.pluginApi.exists(t.speed.y)&&(E.y=Math.abs(parseInt(t.speed.y))))}t.pluginApi.exists(t.speedX)&&Number.isInteger(parseInt(t.speedX))&&(E.x=Math.abs(parseInt(t.speedX))),t.pluginApi.exists(t.speedY)&&Number.isInteger(parseInt(t.speedY))&&(E.y=Math.abs(parseInt(t.speedY))),X=!!t.pluginApi.exists(t.multilvl)&&t.multilvl,q=!!t.pluginApi.exists(t.havePointerLock)&&t.havePointerLock,q&&(q="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document),z=t.inverted||!1,D=t.invertedX||!1,R=t.invertedY||!1,t.pluginApi.onPluginsBuilt(function(){t.pluginApi.on("initialImagesLoaded",function(){t.pluginApi.setElementSize(M,"width","100%",!1),t.pluginApi.setElementSize(M,"height","100%");var e=Y?"touchstart":"mousedown",o=Y?"touchend":"mouseup";t.pluginApi.addEvent(M,e,function(e){e.preventDefault(),q&&(M.requestPointerLock=M.requestPointerLock||M.mozRequestPointerLock||M.webkitRequestPointerLock,M.requestPointerLock()),n()}),t.pluginApi.addEvent(M,o,function(e){e.preventDefault(),q&&(document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock()),i()}),t.pluginApi.addEvent(M,"mouseleave",function(e){e.buttons&&(e.preventDefault(),q&&(document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock()),i())}),t.pluginApi.addEvent(M,"mouseenter",function(e){e.buttons&&(e.preventDefault(),q&&(M.requestPointerLock=M.requestPointerLock||M.mozRequestPointerLock||M.webkitRequestPointerLock,M.requestPointerLock()),n())})})}),t.pluginApi.addEvent(document,"keydown",o);var s=0,a=0,c=0,l=0,d=11-E.x,m=11-E.y}function f(e){return!x&&(x=e,!0)}function k(e){return!h&&(h=e,!0)}function A(e){return!t&&(t=e,!0)}function L(e){return!w&&(w=e,!0)}if(!(this instanceof p))return new p(t);var x,h,P,b,y,I,w,M,E,X,Y,q,z,D,R;return P=r,b=n,y=o,I=i,{getId:u,getLayer:s,getMode:a,getName:c,getParams:l,getType:d,getVersion:m,getWrapper:v,init:g,setId:f,setLayer:k,setParams:A,setWrapper:L}};u.prototype.name=n,u.prototype.version=i,u.prototype.type=o,u.prototype.mode=r,e.Cliplister.addPlugin(u)}(window,void 0);"use strict";

(function (window, undefined) {
  var TYPE = '3d';
  var VERSION = '1.1';

  var CL3DStage = function (params) {
    if (!(this instanceof CL3DStage)) {
      return new CL3DStage(params);
    }

    var self = this;
    var type = TYPE;

    var _inner, modelViewer;

    var listeners = {}; //tmp values

    function getType() {
      return type;
    } //let init;
    //let initApi;
    //let initStage;
    //let getSrc;


    function init() {
      initStage();
      initApi();
    }

    function initApi() {
      self.enterFullscreen = function () {
        enterFullscreen();
        return self;
      };

      self.leaveFullscreen = function () {
        leaveFullscreen();
        return self;
      };

      self.onFullscreenChange = function (callback) {
        onFullscreenChange(callback);
      };

      self.showMedia = function (uri) {
        showMedia(uri);
      };

      self.setOrbitPosition = function (azimuth, polar, radius, immediately) {
        setOrbitPosition(azimuth, polar, radius, immediately);
        return self;
      };

      self.setRotationCenter = function (x, y, z) {
        setRotationCenter(x, y, z);
        return self;
      };

      self.activateAR = function () {
        activateAR();
        return self;
      };

      self.getOrbitPosition = function () {
        return getOrbitPosition();
      };

      self.getRotationCenter = function () {
        return getRotationCenter();
      };

      self.getExposure = function () {
        return getExposure();
      };

      self.setExposure = function (value) {
        setExposure(value);
        return self;
      };

      self.getShadowIntensity = function () {
        return getShadowIntensity();
      };

      self.setShadowIntensity = function (value) {
        setShadowIntensity(value);
        return self;
      };

      self.getShadowSoftness = function () {
        return getShadowSoftness();
      };

      self.setShadowSoftness = function (value) {
        setShadowSoftness(value);
        return self;
      };

      self.getArPreferred = function () {
        return getArPreferred();
      };

      self.getArEnabled = function () {
        return getArEnabled();
      };

      self.getArPlacement = function () {
        return getArPlacement();
      };

      self.getArScale = function () {
        return getArScale();
      };
    }

    function initStage() {
      _inner = document.createElement('div');
      _inner.id = 'datacontainer';
      _inner.style.position = 'absolute';
      _inner.style.overflow = 'auto';
      _inner.style.top = '0px';
      _inner.style.right = '0px';
      _inner.style.bottom = '0px';
      _inner.style.left = '0px'; //_inner.style.backgroundColor = "#72818B";

      _inner.style.backgroundColor = params.pluginApi.getBackgroundColor();
      _inner.style.color = '#FFFFFF';
      _inner.style.pointer = 'col-resize';
      _inner.style.display = 'flex';
      modelViewer = document.createElement('model-viewer');
      modelViewer.style.height = '100%';
      modelViewer.style.width = '100%';
      modelViewer.classList.add('modelViewer');

      _inner.appendChild(modelViewer);

      params.parent.appendChild(_inner);
      var css = document.createElement('style');
      css.type = 'text/css';
      css.innerHTML = '.activityIndicator {height:40px;width:40px;-webkit-background-size:40px 40px;margin:0px auto;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;-webkit-animation-name:spinnerAnim;}@-webkit-keyframes spinnerAnim {0% { -webkit-transform:rotate(0deg);}100% { -webkit-transform:rotate(360deg);}} .nodisplay{opacity:0!important;}';
      document.head.appendChild(css);
    }

    function enterFullscreen() {
      if (_inner.requestFullscreen) {
        _inner.requestFullscreen();
      } else if (_inner.msRequestFullscreen) {
        _inner.msRequestFullscreen();
      } else if (_inner.mozRequestFullScreen) {
        _inner.mozRequestFullScreen();
      } else if (_inner.webkitRequestFullscreen) {
        _inner.webkitRequestFullscreen();
      }

      params.pluginApi.triggerListeners('fullscreenEnter');
    }

    function leaveFullscreen() {}

    function setOrbitPosition(azimuth, polar, radius, immediately) {
      //azimuthal and polar angles, and the distance
      //Accepts values of the form "$angle $angle $distance", like "10deg 75deg 1.5m"
      modelViewer.setAttribute('camera-orbit', "".concat(azimuth, "deg ").concat(polar, "deg ").concat(radius, "%"));

      if (params.pluginApi.exists(immediately) && immediately) {
        modelViewer.jumpCameraToGoal();
      }
    }

    function getOrbitPosition() {
      return modelViewer.getCameraOrbit;
    }

    function setRotationCenter(x, y, z) {
      //Set the starting and/or subsequent point the camera orbits around.
      // Accepts values of the form "$X $Y $Z", like "0m 1.5m -0.5m".
      if (x === 'auto') {
        modelViewer.setAttribute('camera-target', "auto auto auto");
      } else {
        modelViewer.setAttribute('camera-target', "".concat(x, "m ").concat(y, "m ").concat(z, "m"));
      }
    }

    function getRotationCenter() {
      return modelViewer.getCameraTarget();
    }

    function activateAR() {
      modelViewer.activateAR();
    }

    function setExposure(exposure) {
      modelViewer.exposure = exposure;
    }

    function setShadowIntensity(intensity) {
      modelViewer.shadowIntensity = intensity;
    }

    function setShadowSoftness(softness) {
      modelViewer.shadowSoftness = softness;
    }

    function getExposure() {
      return params.pluginApi.exists(modelViewer.exposure) ? modelViewer.exposure : 1;
    }

    function getShadowIntensity() {
      return modelViewer.shadowIntensity || 0;
    }

    function getShadowSoftness() {
      return modelViewer.shadowSoftness || 1;
    }

    function getArPreferred() {
      var _params$params$arPref;

      return (_params$params$arPref = params.params.arPreferred) !== null && _params$params$arPref !== void 0 ? _params$params$arPref : true;
    }

    function getArEnabled() {
      var _params$params$arEnab;

      return (_params$params$arEnab = params.params.arEnabled) !== null && _params$params$arEnab !== void 0 ? _params$params$arEnab : false;
    }

    function getArPlacement() {
      var _params$params$arPlac;

      return (_params$params$arPlac = params.params.arPlacement) !== null && _params$params$arPlac !== void 0 ? _params$params$arPlac : 'floor';
    }

    function getArScale() {
      var _params$params$arScal;

      return (_params$params$arScal = params.params.arScale) !== null && _params$params$arScal !== void 0 ? _params$params$arScal : 'auto';
    }

    function onFullscreenChange(callback) {
      if (_inner.requestFullScreen) {
        params.pluginApi.addEvent(_inner, 'fullscreenchange', function () {
          callback();
        });
      } else if (_inner.mozRequestFullScreen) {
        params.pluginApi.addEvent(_inner, 'mozfullscreenchange', function () {
          callback();
        });
      } else if (_inner.webkitRequestFullScreen) {
        params.pluginApi.addEvent(_inner, 'webkitfullscreenchange', function () {
          callback();
        });
      } else if (_inner.msRequestFullscreen) {
        params.pluginApi.addEvent(_inner, 'MSFullscreenChange', function () {
          callback();
        });
      } else {
        params.pluginApi.addEvent(_inner, 'webkitendfullscreen', function () {
          nativeFullscreen = false;
          pause();
          callback();
        });
        params.pluginApi.addEvent(_inner, 'webkitbeginfullscreen', function () {
          nativeFullscreen = true;
          callback();
        });
      }
    }

    function showMedia(data) {
      var _params$params$arPref2;

      var usdzNode = data.derivate.find(function (derivate) {
        return derivate.fileExtension === 'usdz';
      });
      var glbNode = data.derivate.find(function (derivate) {
        return derivate.fileExtension === 'glb';
      });
      var gltfNode = data.derivate.find(function (derivate) {
        return derivate.fileExtension === 'gltf';
      });
      var src = glbNode.assetLink,
          iossrc = usdzNode ? usdzNode.assetLink : false,
          cameraControls = params.params.cameraControls || false,
          autoRotate = params.params.autoRotate || false,
          arEnabled = params.params.arEnabled || false,
          arModes = params.params.arModes || 'webxr scene-viewer quick-look fallback',
          arScale = params.params.arScale || 'auto',
          arPlacement = params.params.arPlacement || 'floor',
          arPreferred = (_params$params$arPref2 = params.params.arPreferred) !== null && _params$params$arPref2 !== void 0 ? _params$params$arPref2 : true,
          poster = data.preview.assetLink || '',
          skybox = params.params.skybox || data.skybox || false,
          environment = params.params.environment || data.environment || false,
          hotspots = data.hotspots || false,
          pivotPoint = data.pivotpoint || false,
          exposure = params.params.exposure || data.exposure || 1,
          title = data.title || data.productshortdesc || '';
      params.pluginApi.setPluginsClickThrough(true);
      modelViewer.setAttribute('src', src);
      iossrc && modelViewer.setAttribute('ios-src', iossrc);
      modelViewer.setAttribute('alt', title);
      modelViewer.setAttribute('poster', poster);
      modelViewer.interactionPromptStyle = 'basic';
      modelViewer.setAttribute('reveal', 'auto');
      modelViewer.setAttribute('loading', 'eager');
      cameraControls && modelViewer.setAttribute('camera-controls', 'cameraControls');
      autoRotate && modelViewer.setAttribute('auto-rotate', '');
      skybox && modelViewer.setAttribute('skybox-image', skybox);
      environment && modelViewer.setAttribute('environment-image', environment);
      pivotPoint && modelViewer.setAttribute('camera-target', pivotPoint);
      exposure && modelViewer.setAttribute('exposure', exposure); // modelViewer.addEventListener('load', (event) => {
      //     params.pluginApi.triggerListeners('mediaReady');
      // });

      if (arEnabled) {
        modelViewer.setAttribute('ar', 'arEnabled');
        arModes && modelViewer.setAttribute('ar-modes', arModes);
        arScale && modelViewer.setAttribute('ar-scale', arScale);
        arPlacement && modelViewer.setAttribute('ar-placement', arPlacement);
        modelViewer.setAttribute('quick-look-browsers', 'safari chrome');
        modelViewer.addEventListener('ar-status', function (event) {
          if (event.detail.status === 'failed') {
            console.warn('AR trigger failed');
          }
        });
        var platform = params.pluginApi.platform();
        var shouldJumpToAR = platform.os.mobile && arPreferred;

        if (shouldJumpToAR) {
          console.info('Will Attempt To Launch AR Mode!'); // const output = document.getElementById("output");
          // output && (output.innerHTML += "\n Will Attempt To Launch AR Mode!");
          // Check whether this is an Android device.

          var isAndroid = /android/i.test(navigator.userAgent); // This fallback URL is used if the Google app is not installed and up to date.

          var fallbackUrl = location.href;
          var resizable = arScale === 'auto';
          var sceneViewerUrl = "intent://arvr.google.com/scene-viewer/1.0?file=".concat(src, "&mode=ar_only&resizable=").concat(resizable, "#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=").concat(fallbackUrl, ";end;"); // Create a link.

          var a = document.createElement('a');

          if (a.relList.supports("ar")) {
            // AR is available on iOS.
            var anchor = document.createElement('a');
            anchor.setAttribute('rel', 'ar');
            anchor.appendChild(document.createElement('img'));
            anchor.setAttribute('href', iossrc);
            anchor.click();
          } else {
            a.appendChild(document.createTextNode('AR'));
            a.href = sceneViewerUrl;
            a.click();
          }
        }
      }

      modelViewer.addEventListener('error', function (event) {
        var {
          type
        } = event.detail;
        console.log(event);
        var notice = document.createElement('div');
        notice.style.position = 'absolute';
        notice.style.backgroundColor = 'rgba(0,0,0,0.6)';
        notice.style.color = '#fff';
        notice.style.width = '100%';
        notice.innerHtml = 'An error occured. Please try again later.';
        modelViewer.setAttribute('src', null);
        modelViewer.setAttribute('ios-src', null);

        _inner.appendChild(notice);

        _inner.removeChild(modelViewer);

        if (type === 'webglcontextlost') {// WebGL crashed, do something to recover!
        }

        return false;
      });

      if (hotspots) {
        hotspots.forEach(function (hotspot, i) {
          var hotspotEl = document.createElement('button');
          hotspotEl.classList.add('hotspot');
          hotspotEl.setAttribute('slot', 'hotspot-' + i);
          hotspotEl.dataset.position = hotspot.position;
          hotspotEl.dataset.normal = hotspot.normal;
          hotspotEl.dataset.visibilityAttribute = 'visible';

          if (params.pluginApi.exists(hotspot.annotation)) {
            var annotationEl = document.createElement('div');
            annotationEl.classList.add('annotation');
            annotationEl.innerText = hotspot.annotation;
            hotspotEl.appendChild(annotationEl);
          }

          modelViewer.appendChild(hotspotEl);
        });
      }

      params.pluginApi.triggerListeners('mediaReady');
    }

    init();
    return this;
  };

  CL3DStage.prototype.type = TYPE;
  CL3DStage.prototype.version = VERSION;
  window.Cliplister.addStage(CL3DStage);
})(window, undefined);"use strict";

(function (window, undefined) {
  var NAME = 'Controls3D';
  var VERSION = '1.2';
  var TYPE = 'visual';
  var MODE = 'inner';

  var Plugin = function () {
    if (!(this instanceof Plugin)) {
      return new Plugin();
    }

    var id, layer, mode, name, params, type, version, wrapper, api;

    var _inner;

    mode = MODE;
    name = NAME;
    type = TYPE;
    version = VERSION;
    var visible = true;
    var mousemoveTimer;
    var height = 0;
    var labels = {
      de: ['Produkt im Raum platzieren', 'QR-Code mit Smartphone scannen'],
      en: ['Place the product in the room', 'Scan QR code with smartphone'],
      fr: ['Placer le produit dans la pièce', 'Scannez le code QR avec votre smartphone'],
      nl: ['Plaats product in de kamer', 'Scan QR-code met smartphone'],
      it: ['Collocare il prodotto nella stanza', 'Scansione del codice QR con lo smartphone'],
      pl: ['Umieść produkt w pomieszczeniu', 'Zeskanuj kod QR'],
      sv: ['Placera produkten i rummet', 'Skanna QR-koden med din smartphone']
    };
    var controlElements = {
      add: function (element, camelCase) {
        var number = null;
        var binding = camelCase;
        var numericBinding = /\s*(\d+)$/.exec(camelCase);

        if (numericBinding) {
          number = numericBinding[0];
          binding = camelCase.slice(0, numericBinding.index);
        }

        if (controlElements[binding]) {
          if (typeof controlElements[binding] == 'function') controlElements[binding](element);

          if (controlElements[binding].add) {
            controlElements[binding].add(element, binding, number);
          } else {
            if (!controlElements[binding].list) controlElements[binding].list = [];
            controlElements[binding].list.push(element);
          }
        }
      },
      clear: function (camelCase) {
        var binding = camelCase;

        if (controlElements[binding] && controlElements[binding].list) {
          controlElements[binding].list = [];
        }
      },
      controls: function (element) {
        var _position$reference, _position$distance;

        height = parseInt(getComputedStyle(element).height);
        var position = params.position;
        api.setElementSize(_inner, 'height', height);
        api.setElementPosition(_inner, (_position$reference = position === null || position === void 0 ? void 0 : position.reference) !== null && _position$reference !== void 0 ? _position$reference : 'bottom', (_position$distance = position === null || position === void 0 ? void 0 : position.distance) !== null && _position$distance !== void 0 ? _position$distance : "15%");
        api.enableMovementListening(id, _inner);
      },
      fullscreenEnter: function (element) {
        api.addEvent(element, 'click', api.enterFullscreen);
        api.on('fullscreenChange', function () {
          setVisible(false);

          if (api.isFullscreen()) {
            element.style.display = 'none'; //api.checkResize();
          } else {
            element.style.display = 'block'; //api.checkResize();
            //api.disableCSSTransition(_inner);
            //api.setElementPosition(_inner, "bottom", -(height + 1));
            //api.animateElementPosition(_inner, "bottom", -(height + 1), 1, function () {
            //}, false, true);
            //_inner.style.bottom = 0;
            // animateOut();
          }

          if (api.platform().browser.name == 'IE' && api.platform().browser.version == 11) {
            setTimeout(function () {
              api.checkResize();
            }, 750);
          } else {
            api.checkResize();
          }
        });
      },
      fullscreenLeave: function (element) {
        api.addEvent(element, 'click', api.leaveFullscreen);
        api.on('fullscreenChange', function () {
          setVisible(false);

          if (!api.isFullscreen()) {
            element.style.display = 'none'; //api.checkResize();
          } else {
            element.style.display = 'block'; //api.disableCSSTransition(_inner);
            //api.setElementPosition(_inner, "bottom", -(height + 1));
            //api.animateElementPosition(_inner, "bottom", -(height + 1), 1, function () {
            //}, false, true);
            //_inner.style.bottom = 0;
            // animateOut();
          }

          if (api.platform().browser.name == 'IE' && api.platform().browser.version == 11) {
            setTimeout(function () {
              api.checkResize();
            }, 750);
          } else {
            api.checkResize();
          }
        });
      },
      activateAr: function (element) {
        api.addEvent(element, 'click', function () {
          api.activateAR();
        });
      },
      showQr: function (element) {
        var _labels$qrLang$, _labels$qrLang;

        var validLanguages = Object.keys(labels);
        var browserLang = navigator.language.slice(0, 2);
        var qrLang = validLanguages.includes(browserLang) ? browserLang : 'en';
        var qrLabel = (_labels$qrLang$ = (_labels$qrLang = labels[qrLang]) === null || _labels$qrLang === void 0 ? void 0 : _labels$qrLang[0]) !== null && _labels$qrLang$ !== void 0 ? _labels$qrLang$ : labels['en'][0];
        element.append(qrLabel);
        api.addEvent(element, 'click', function () {
          api.showQr();
        });
      },
      viewTop: function (element) {
        api.addEvent(element, 'click', function () {
          api.setOrbitPositionTop();
        });
      },
      viewBottom: function (element) {
        api.addEvent(element, 'click', function () {
          api.setOrbitPositionBottom();
        });
      },
      viewFront: function (element) {
        api.addEvent(element, 'click', function () {
          api.setOrbitPositionFront();
        });
      },
      viewBack: function (element) {
        api.addEvent(element, 'click', function () {
          api.setOrbitPositionBack();
        });
      },
      viewLeft: function (element) {
        api.addEvent(element, 'click', function () {
          api.setOrbitPositionLeft();
        });
      },
      viewRight: function (element) {
        api.addEvent(element, 'click', function () {
          api.setOrbitPositionRight();
        });
      },
      exposureIncrease: function (element) {
        api.addEvent(element, 'click', function () {
          var newExposure = Math.min(api.getExposure() + 0.1, 2);
          api.setExposure(newExposure);
        });
      },
      exposureDecrease: function (element) {
        api.addEvent(element, 'click', function () {
          var newExposure = Math.max(api.getExposure() - 0.1, 0);
          api.setExposure(newExposure);
        });
      }
    };

    function animateIn() {
      if (!visible && !api.exists(params.animation) || !visible && params.animation) {
        setVisible(true);
        api.animateElementPosition(_inner, 'bottom', 1, 300, function () {}, false, true);
        api.showCursor();
      }
    }

    function animateOut(force) {
      return false;
    }

    function getId() {
      return id;
    }

    function getLayer() {
      return layer;
    }

    function getMode() {
      return mode;
    }

    function getName() {
      return name;
    }

    function getParams() {
      return params;
    }

    function getType() {
      return type;
    }

    function getVersion() {
      return version;
    }

    function getWrapper() {
      return wrapper;
    }

    function findAncestorWithBinding(elem, binding) {
      if (api.dataset(elem, 'clBinding') == binding) {
        return elem;
      }

      return findAncestorWithBinding(elem.parentNode, binding);
    }

    function findDescendantsWithBinding(elem, binding) {
      if (api.dataset(elem, 'clBinding') == binding) {
        return elem;
      }

      var childNodes = elem.childNodes;

      for (var i = 0; i < childNodes.length; i++) {
        if (childNodes[i].nodeType == 1) {
          var e = findDescendantsWithBinding(childNodes[i], binding);
          if (e) return e;
        }
      }
    }

    function checkBreakpoints() {
      var breakpoints = {};

      if (api.exists(params.breakpoints)) {
        breakpoints = params.breakpoints;

        _inner.classList.remove('cl-breakpoint-l');

        if (api.exists(breakpoints.s) && api.getStageDimension().width <= breakpoints.s) {
          _inner.classList.add('cl-breakpoint-s');
        } else {
          _inner.classList.remove('cl-breakpoint-s');

          if (api.exists(breakpoints.m) && api.getStageDimension().width <= breakpoints.m) {
            _inner.classList.add('cl-breakpoint-m');
          } else {
            _inner.classList.remove('cl-breakpoint-m');

            _inner.classList.add('cl-breakpoint-l');
          }
        }
      }

      var node_list = document.getElementsByClassName('containerTrigger');

      for (var i = 0; i < node_list.length; i++) {
        node_list[i].checked = false;
      }
    }

    function init() {
      _inner = document.createElement('div');
      _inner.style.position = 'relative';

      if (api.exists(params.template)) {
        if (params.template.type == 'external') {
          var pathToSource = params.template.source.replace(/[^\/]*$/, '');
          api.ajax(params.template.source, function (result) {
            var response = document.createElement('div');
            var responseText = result.responseText;
            responseText = responseText.replace(/(url\(['"]?)([\da-z\.\-_\/]+)(['"]?\))/g, '$1' + pathToSource + '$2$3');
            response.innerHTML = responseText;
            var style = document.createElement('style');
            style.type = 'text/css';
            style.appendChild(document.createTextNode(response.getElementsByTagName('style')[0].innerHTML));
            document.getElementsByTagName('head')[0].appendChild(style);
            _inner.innerHTML = response.querySelector('#cl-controls3d-wrapper').innerHTML;
            processControls();
          });
        }
      } else {
        //@controls-begin
        var css = '';
        var html = ''; //@controls-end

        var style = document.createElement('style');
        style.type = 'text/css';
        style.appendChild(document.createTextNode(css));
        document.getElementsByTagName('head')[0].appendChild(style);
        var dummyResponse = document.createElement('div');
        dummyResponse.innerHTML = html;
        _inner.innerHTML = dummyResponse.querySelector('#3d-controls').innerHTML;
        setTimeout(processControls, 1);
      }

      api.onPluginsBuilt(function () {
        api.disableCSSTransition(_inner);
        api.setElementSize(_inner, 'width', '100%', false);
        api.setElementSize(_inner, 'height', height);
        api.setElementPosition(_inner, "bottom", height + 100);
        checkBreakpoints();
        api.enableCSSTransition(_inner);
      });
      api.onMouseenter(_inner, function () {// mouseoverControls = true;
      });
      api.onMouseleave(_inner, function () {// mouseoverControls = false;
      });
      api.on('mouseenter', function () {
        // mouseoverPlayer = true;
        api.addEvent(document, 'mousemove', waitForNoMovement);
        animateIn();
      });
      api.on('mouseleave', function () {
        // mouseoverPlayer = false;
        animateOut();
        clearTimeout(mousemoveTimer);
        api.removeEvent(document, 'mousemove', waitForNoMovement);
      });
      api.on('resize', function () {
        api.disableCSSTransition(_inner);
        checkBreakpoints();
        api.enableCSSTransition(_inner);
        animateOut(); // <-2019-03-01 replace waitForNoMovement . Next step if buggy: wFNM without animateIn ?
      });
      animateOut();
    }

    function isVisible(elementName) {
      var isIOS = api.platform().os.name === 'iOS';
      var isAndroid = api.platform().os.name === 'Android';

      if (elementName === 'activate-ar' && !(isIOS || isAndroid)) {
        return false;
      }

      var hideable = ['activateAR', 'showQr', 'viewTop', 'viewBottom', 'viewFront', 'viewBack', 'viewLeft', 'viewRight', 'viewRight', 'exposureIncrease', 'exposureDecrease'];
      var _visible = true; // console.log(elementName);

      if (hideable.indexOf(elementName) >= 0) {
        if (params['whitelist'] && params['whitelist'].indexOf(elementName) == -1 || params.blacklist && params.blacklist.indexOf(elementName) > -1) {
          _visible = false;
        }
      }

      return _visible;
    }

    function debounce(func, wait, immediate) {
      var timeout;
      return function executedFunction() {
        var context = this;
        var args = arguments;

        var later = function () {
          timeout = null;
          if (!immediate) func.apply(context, args);
        };

        var callNow = immediate && !timeout;
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
        if (callNow) func.apply(context, args);
      };
    }

    function mouseDownAndMove(e, movementFn, mouseUpFn) {
      function throttled(delay, fn) {
        var lastCall = 0;
        return function () {
          var now = new Date().getTime();

          if (now - lastCall < delay) {
            return;
          }

          lastCall = now;
          return fn.apply(undefined, arguments);
        };
      }

      if (e.which == 1) {
        function callCallback(evnt) {
          if (movementFn !== undefined) {
            movementFn(evnt);
          }
        }

        function callMouseUpCallback(evnt) {
          // if (evnt.which == 1) api.removeEvent(document, "mousemove", callCallback);
          if (evnt.which == 1) api.removeEvent(document, 'mousemove', tHandler);
          api.removeEvent(document, 'mouseup', callMouseUpCallback);
          if (mouseUpFn) mouseUpFn(e);
        }

        var tHandler = throttled(20, callCallback);
        api.addEvent(document, 'mousemove', tHandler); // api.addEvent(document, "mousemove", callCallback);

        api.addEvent(document, 'mouseup', callMouseUpCallback);
      }
    }

    function processControls() {
      params.parent.appendChild(_inner);

      var elements = _inner.getElementsByTagName('*');

      for (var i = 0; i < elements.length; i++) {
        var element = elements[i];

        if (api.dataset(element, 'clBinding')) {
          var dashed = api.dataset(element, 'clBinding');
          var camelCase = api.dashSeparatedToCamelCase(dashed);
          controlElements.add(element, camelCase);

          if (!isVisible(dashed)) {
            element.style.display = 'none';
          }

          if (dashed === 'show-qr' && params.qrcode) {
            element.style.display = 'inline-block';
          }
        }
      }
    }

    function openInNewWindow(url) {
      var win = window.open(url, '_blank');
      win.focus();
    }

    function setId(_id) {
      if (!id) {
        id = _id;
        return true;
      }

      return false;
    }

    function setLayer(_layer) {
      if (!layer) {
        layer = _layer;
        return true;
      }

      return false;
    }

    function setParams(_params) {
      if (!params) {
        params = _params;
        api = params.pluginApi;
        return true;
      }

      return false;
    }

    function setWrapper(_wrapper) {
      if (!wrapper) {
        wrapper = _wrapper;
        return true;
      }

      return false;
    }

    function waitForNoMovement() {
      animateIn();
      clearTimeout(mousemoveTimer);
      mousemoveTimer = setTimeout(function () {
        animateOut(true);
      }, 2000);
    }

    return {
      getId: getId,
      getLayer: getLayer,
      getMode: getMode,
      getName: getName,
      getParams: getParams,
      getType: getType,
      getVersion: getVersion,
      getWrapper: getWrapper,
      init: init,
      setId: setId,
      setLayer: setLayer,
      setParams: setParams,
      setWrapper: setWrapper
    };

    function setVisible(v) {
      visible = v;
    }
  };

  Plugin.prototype.name = NAME;
  Plugin.prototype.version = VERSION;
  Plugin.prototype.type = TYPE;
  Plugin.prototype.mode = MODE;
  window.Cliplister.addPlugin(Plugin);
})(window, undefined);"use strict";

/*

REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REMOVE _typeof FROM MINIFIED FILE WHEN MODIFYING THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

*/
(function (window, undefined) {
  var NAME = "QRCode";
  var VERSION = "1.0";
  var TYPE = "visual";
  var MODE = "inner";

  var Plugin = function (params) {
    if (!(this instanceof Plugin)) {
      return new Plugin(params);
    }

    var self = this;
    var id, layer, mode, name, type, version, wrapper, api;
    var labels = {
      de: ['Produkt im Raum platzieren', 'QR-Code mit Smartphone scannen'],
      en: ['Place the product in the room', 'Scan QR code with smartphone'],
      fr: ['Placer le produit dans la pièce', 'Scannez le code QR avec votre smartphone'],
      nl: ['Plaats product in de kamer', 'Scan QR-code met smartphone'],
      it: ['Collocare il prodotto nella stanza', 'Scansione del codice QR con lo smartphone'],
      pl: ['Umieść produkt w pomieszczeniu', 'Zeskanuj kod QR'],
      sv: ['Placera produkten i rummet', 'Skanna QR-koden med din smartphone']
    };

    var _inner, qrCode;

    mode = MODE;
    name = NAME;
    type = TYPE;
    version = VERSION;

    function getId() {
      return id;
    }

    function getLayer() {
      return layer;
    }

    function getMode() {
      return mode;
    }

    function getName() {
      return name;
    }

    function getParams() {
      return params;
    }

    function getType() {
      return type;
    }

    function getVersion() {
      return version;
    }

    function getWrapper() {
      return wrapper;
    }

    function init() {
      var _labels$qrLang$, _labels$qrLang, _labels$en;

      api = params.pluginApi;
      if (!validateParameters()) return false;
      _inner = document.createElement("div"); // _inner.title = 'click to close';

      _inner.style.position = "absolute";
      _inner.style.width = "100%";
      _inner.style.height = "100%";
      _inner.style.overflow = 'auto';
      _inner.style.top = '0px';
      _inner.style.right = '0px';
      _inner.style.bottom = '0px';
      _inner.style.left = '0px';
      _inner.style.display = 'none';
      _inner.style.pointerEvents = 'all';
      _inner.style.opacity = '0';
      _inner.style.transition = 'opacity 0.15s linear';
      _inner.style.justifyContent = 'center';
      _inner.style.alignItems = 'center'; // _inner.style.backgroundColor = 'rgba(0,0,0,0.25)';

      qrCode = document.createElement('div');
      qrCode.id = 'cl-qrcode';
      qrCode.style.display = 'flex';
      qrCode.style.flexDirection = 'column';
      qrCode.style.overflow = 'auto';
      qrCode.style.margin = 'auto';
      qrCode.style.padding = '0 20px';
      qrCode.style.border = '1px solid #c4c4c4';
      qrCode.style.borderRadius = '4px';
      qrCode.style.maxWidth = '50%';
      qrCode.style.overflow = 'hidden';
      qrCode.style.backgroundColor = 'white'; // qrCode.style.flexBasis = '33%';

      _inner.appendChild(qrCode);

      var qrClose = document.createElement('div');
      qrClose.innerHTML = '&times;';
      qrClose.style.margin = '13px -5px 20px auto';
      qrClose.style.fontSize = '28pt';
      qrClose.style.lineHeight = '20px';
      qrClose.style.width = '20px';
      qrClose.style.height = '20px';
      qrClose.style.cursor = 'pointer';
      qrClose.onclick = hide;
      qrCode.appendChild(qrClose);
      var validLanguages = Object.keys(labels);
      var browserLang = navigator.language.slice(0, 2);
      var qrLang = validLanguages.includes(browserLang) ? browserLang : 'en';
      var qrLabel = (_labels$qrLang$ = (_labels$qrLang = labels[qrLang]) === null || _labels$qrLang === void 0 ? void 0 : _labels$qrLang[1]) !== null && _labels$qrLang$ !== void 0 ? _labels$qrLang$ : (_labels$en = labels['en']) === null || _labels$en === void 0 ? void 0 : _labels$en[1];
      var qrTitle = document.createElement('div');
      qrTitle.innerHTML = qrLabel;
      qrTitle.style.fontSize = '12pt';
      qrTitle.style.fontWeight = 'bold';
      qrTitle.style.textAlign = 'center';
      qrTitle.style.margin = 'auto';
      qrCode.appendChild(qrTitle);
      var qr = new QRious({
        value: 'loading...'
      });
      qr.image.style.boxSizing = 'border-box';
      qr.image.style.flex = '1 1 100%';
      qr.image.style.height = 'auto';
      qr.image.style.padding = '8% 0% 15%';
      qr.image.style.margin = 'auto';
      qr.image.style.imageRendering = 'pixelated';
      qrCode.appendChild(qr.image);
      api.on("mediaReady", function () {
        var landingPageLink = getLandingPageLink(api.getLandingPageLinkData(true)); // console.log({landingPageLink});

        qr.set({
          value: landingPageLink,
          size: 200,
          padding: 0
        });
      });
      params.parent.appendChild(_inner);
      api.on('showQr', function () {
        show();
      });
      api.on('hideQr', function () {
        hide();
      });
      api.onPluginsBuilt(function () {
        api.setElementSize(_inner, 'width', '100%', false);
        api.setElementSize(_inner, 'height', '100%', false);
      });
    }

    function getLandingPageLink(data) {
      var url = new URL(import.meta.url);
      var landingpageUrl = "".concat(data.landingpageBaseUrl).concat(url.search, "&").concat(new URLSearchParams(data.settings).toString(), "&autoARQR=true&module=true");
      var models = {
        glb: data.asset.derivate.find(function (d) {
          return d.fileExtension === 'glb';
        }),
        usdz: data.asset.derivate.find(function (d) {
          return d.fileExtension === 'usdz';
        })
      }; // stage.activateAR();
      // intent://arvr.google.com/scene-viewer/1.0?file=https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF/Avocado.gltf&mode=ar_only#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=https://developers.google.com/ar;end;
      // const intentString = `#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end;`
      // let arUrl = new URL('https://arvr.google.com/scene-viewer/1.1');
      // arUrl.searchParams.append("file", models.glb.assetLink);
      // arUrl.searchParams.append("mode", "ar_preferred");
      // arUrl.searchParams.append("link", landingpageUrl);
      // arUrl.searchParams.append("title", data.asset.title);
      // arUrl.searchParams.append("S.browser_fallback_url;", landingpageUrl);
      // arUrl += intentString;
      // console.log(arUrl)

      return landingpageUrl;
    }

    function hide() {
      _inner.style.display = 'none';
      _inner.style.opacity = 'none';
    }

    function show() {
      _inner.style.display = 'flex';
      _inner.style.opacity = '1';
    }

    function setId(_id) {
      if (!id) {
        id = _id;
        return true;
      }

      return false;
    }

    function setLayer(_layer) {
      if (!layer) {
        layer = _layer;
        return true;
      }

      return false;
    }

    function setParams(_params) {
      if (!params) {
        params = _params;
        api = params.pluginApi;
        return true;
      }

      return false;
    }

    function setWrapper(_wrapper) {
      if (!wrapper) {
        wrapper = _wrapper;
        return true;
      }

      return false;
    }

    function validateParameters() {
      // if(!params.width) {
      //     params.pluginApi.log("The " + self.name + " plugin requires a width.", 1);
      //     return false;
      // }
      // if(!params.height) {
      //     params.pluginApi.log("The " + self.name + " plugin requires a height.", 1);
      //     return false;
      // }
      return true;
    }

    return {
      getId: getId,
      getLayer: getLayer,
      getMode: getMode,
      getName: getName,
      getParams: getParams,
      getType: getType,
      getVersion: getVersion,
      getWrapper: getWrapper,
      init: init,
      setId: setId,
      setLayer: setLayer,
      setParams: setParams,
      setWrapper: setWrapper
    };
  };

  Plugin.prototype.name = NAME;
  Plugin.prototype.version = VERSION;
  Plugin.prototype.type = TYPE;
  Plugin.prototype.mode = MODE;
  window.Cliplister.addPlugin(Plugin);
})(window, undefined);
/*
 * QRious v4.0.2
 * Copyright (C) 2017 Alasdair Mercer
 * Copyright (C) 2010 Tom Zerucha
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : window.QRious = factory();
})(void 0, function () {
  'use strict';
  /*
   * Copyright (C) 2017 Alasdair Mercer, !ninja
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */

  /**
   * A bare-bones constructor for surrogate prototype swapping.
   *
   * @private
   * @constructor
   */

  var Constructor =
  /* istanbul ignore next */
  function () {};
  /**
   * A reference to <code>Object.prototype.hasOwnProperty</code>.
   *
   * @private
   * @type {Function}
   */


  var hasOwnProperty = Object.prototype.hasOwnProperty;
  /**
   * A reference to <code>Array.prototype.slice</code>.
   *
   * @private
   * @type {Function}
   */

  var slice = Array.prototype.slice;
  /**
   * Creates an object which inherits the given <code>prototype</code>.
   *
   * Optionally, the created object can be extended further with the specified <code>properties</code>.
   *
   * @param {Object} prototype - the prototype to be inherited by the created object
   * @param {Object} [properties] - the optional properties to be extended by the created object
   * @return {Object} The newly created object.
   * @private
   */

  function createObject(prototype, properties) {
    var result;
    /* istanbul ignore next */

    if (typeof Object.create === 'function') {
      result = Object.create(prototype);
    } else {
      Constructor.prototype = prototype;
      result = new Constructor();
      Constructor.prototype = null;
    }

    if (properties) {
      extendObject(true, result, properties);
    }

    return result;
  }
  /**
   * Extends the constructor to which this method is associated with the <code>prototype</code> and/or
   * <code>statics</code> provided.
   *
   * If <code>name</code> is provided, it will be used as the class name and can be accessed via a special
   * <code>class_</code> property on the child constructor, otherwise the class name of the super constructor will be used
   * instead. The class name may also be used string representation for instances of the child constructor (via
   * <code>toString</code>), but this is not applicable to the <i>lite</i> version of Nevis.
   *
   * If <code>constructor</code> is provided, it will be used as the constructor for the child, otherwise a simple
   * constructor which only calls the super constructor will be used instead.
   *
   * The super constructor can be accessed via a special <code>super_</code> property on the child constructor.
   *
   * @param {string} [name=this.class_] - the class name to be used for the child constructor
   * @param {Function} [constructor] - the constructor for the child
   * @param {Object} [prototype] - the prototype properties to be defined for the child
   * @param {Object} [statics] - the static properties to be defined for the child
   * @return {Function} The child <code>constructor</code> provided or the one created if none was given.
   * @public
   */


  function extend(name, constructor, prototype, statics) {
    var superConstructor = this;

    if (typeof name !== 'string') {
      statics = prototype;
      prototype = constructor;
      constructor = name;
      name = null;
    }

    if (typeof constructor !== 'function') {
      statics = prototype;
      prototype = constructor;

      constructor = function () {
        return superConstructor.apply(this, arguments);
      };
    }

    extendObject(false, constructor, superConstructor, statics);
    constructor.prototype = createObject(superConstructor.prototype, prototype);
    constructor.prototype.constructor = constructor;
    constructor.class_ = name || superConstructor.class_;
    constructor.super_ = superConstructor;
    return constructor;
  }
  /**
   * Extends the specified <code>target</code> object with the properties in each of the <code>sources</code> provided.
   *
   * if any source is <code>null</code> it will be ignored.
   *
   * @param {boolean} own - <code>true</code> to only copy <b>own</b> properties from <code>sources</code> onto
   * <code>target</code>; otherwise <code>false</code>
   * @param {Object} target - the target object which should be extended
   * @param {...Object} [sources] - the source objects whose properties are to be copied onto <code>target</code>
   * @return {void}
   * @private
   */


  function extendObject(own, target, sources) {
    sources = slice.call(arguments, 2);
    var property;
    var source;

    for (var i = 0, length = sources.length; i < length; i++) {
      source = sources[i];

      for (property in source) {
        if (!own || hasOwnProperty.call(source, property)) {
          target[property] = source[property];
        }
      }
    }
  }

  var extend_1 = extend;
  /**
   * The base class from which all others should extend.
   *
   * @public
   * @constructor
   */

  function Nevis() {}

  Nevis.class_ = 'Nevis';
  Nevis.super_ = Object;
  /**
   * Extends the constructor to which this method is associated with the <code>prototype</code> and/or
   * <code>statics</code> provided.
   *
   * If <code>name</code> is provided, it will be used as the class name and can be accessed via a special
   * <code>class_</code> property on the child constructor, otherwise the class name of the super constructor will be used
   * instead. The class name may also be used string representation for instances of the child constructor (via
   * <code>toString</code>), but this is not applicable to the <i>lite</i> version of Nevis.
   *
   * If <code>constructor</code> is provided, it will be used as the constructor for the child, otherwise a simple
   * constructor which only calls the super constructor will be used instead.
   *
   * The super constructor can be accessed via a special <code>super_</code> property on the child constructor.
   *
   * @param {string} [name=this.class_] - the class name to be used for the child constructor
   * @param {Function} [constructor] - the constructor for the child
   * @param {Object} [prototype] - the prototype properties to be defined for the child
   * @param {Object} [statics] - the static properties to be defined for the child
   * @return {Function} The child <code>constructor</code> provided or the one created if none was given.
   * @public
   * @static
   * @memberof Nevis
   */

  Nevis.extend = extend_1;
  var nevis = Nevis;
  var lite = nevis;
  /**
   * Responsible for rendering a QR code {@link Frame} on a specific type of element.
   *
   * A renderer may be dependant on the rendering of another element, so the ordering of their execution is important.
   *
   * The rendering of a element can be deferred by disabling the renderer initially, however, any attempt get the element
   * from the renderer will result in it being immediately enabled and the element being rendered.
   *
   * @param {QRious} qrious - the {@link QRious} instance to be used
   * @param {*} element - the element onto which the QR code is to be rendered
   * @param {boolean} [enabled] - <code>true</code> this {@link Renderer} is enabled; otherwise <code>false</code>.
   * @public
   * @class
   * @extends Nevis
   */

  var Renderer = lite.extend(function (qrious, element, enabled) {
    /**
     * The {@link QRious} instance.
     *
     * @protected
     * @type {QRious}
     * @memberof Renderer#
     */
    this.qrious = qrious;
    /**
     * The element onto which this {@link Renderer} is rendering the QR code.
     *
     * @protected
     * @type {*}
     * @memberof Renderer#
     */

    this.element = element;
    this.element.qrious = qrious;
    /**
     * Whether this {@link Renderer} is enabled.
     *
     * @protected
     * @type {boolean}
     * @memberof Renderer#
     */

    this.enabled = Boolean(enabled);
  }, {
    /**
     * Draws the specified QR code <code>frame</code> on the underlying element.
     *
     * Implementations of {@link Renderer} <b>must</b> override this method with their own specific logic.
     *
     * @param {Frame} frame - the {@link Frame} to be drawn
     * @return {void}
     * @protected
     * @abstract
     * @memberof Renderer#
     */
    draw: function (frame) {},

    /**
     * Returns the element onto which this {@link Renderer} is rendering the QR code.
     *
     * If this method is called while this {@link Renderer} is disabled, it will be immediately enabled and rendered
     * before the element is returned.
     *
     * @return {*} The element.
     * @public
     * @memberof Renderer#
     */
    getElement: function () {
      if (!this.enabled) {
        this.enabled = true;
        this.render();
      }

      return this.element;
    },

    /**
     * Calculates the size (in pixel units) to represent an individual module within the QR code based on the
     * <code>frame</code> provided.
     *
     * Any configured padding will be excluded from the returned size.
     *
     * The returned value will be at least one, even in cases where the size of the QR code does not fit its contents.
     * This is done so that the inevitable clipping is handled more gracefully since this way at least something is
     * displayed instead of just a blank space filled by the background color.
     *
     * @param {Frame} frame - the {@link Frame} from which the module size is to be derived
     * @return {number} The pixel size for each module in the QR code which will be no less than one.
     * @protected
     * @memberof Renderer#
     */
    getModuleSize: function (frame) {
      var qrious = this.qrious;
      var padding = qrious.padding || 0;
      var pixels = (qrious.size - padding * 2) / frame.width;
      return Math.max(1, pixels);
    },

    /**
     * Calculates the offset/padding (in pixel units) to be inserted before the QR code based on the <code>frame</code>
     * provided.
     *
     * The returned value will be zero if there is no available offset or if the size of the QR code does not fit its
     * contents. It will never be a negative value. This is done so that the inevitable clipping appears more naturally
     * and it is not clipped from all directions.
     *
     * @param {Frame} frame - the {@link Frame} from which the offset is to be derived
     * @return {number} The pixel offset for the QR code which will be no less than zero.
     * @protected
     * @memberof Renderer#
     */
    getOffset: function (frame) {
      var qrious = this.qrious;
      var padding = qrious.padding;

      if (padding != null) {
        return padding;
      }

      var moduleSize = this.getModuleSize(frame);
      var offset = Math.floor((qrious.size - moduleSize * frame.width) / 2);
      return Math.max(0, offset);
    },

    /**
     * Renders a QR code on the underlying element based on the <code>frame</code> provided.
     *
     * @param {Frame} frame - the {@link Frame} to be rendered
     * @return {void}
     * @public
     * @memberof Renderer#
     */
    render: function (frame) {
      if (this.enabled) {
        this.resize();
        this.reset();
        this.draw(frame);
      }
    },

    /**
     * Resets the underlying element, effectively clearing any previously rendered QR code.
     *
     * Implementations of {@link Renderer} <b>must</b> override this method with their own specific logic.
     *
     * @return {void}
     * @protected
     * @abstract
     * @memberof Renderer#
     */
    reset: function () {},

    /**
     * Ensures that the size of the underlying element matches that defined on the associated {@link QRious} instance.
     *
     * Implementations of {@link Renderer} <b>must</b> override this method with their own specific logic.
     *
     * @return {void}
     * @protected
     * @abstract
     * @memberof Renderer#
     */
    resize: function () {}
  });
  var Renderer_1 = Renderer;
  /**
   * An implementation of {@link Renderer} for working with <code>canvas</code> elements.
   *
   * @public
   * @class
   * @extends Renderer
   */

  var CanvasRenderer = Renderer_1.extend({
    /**
     * @override
     */
    draw: function (frame) {
      var i, j;
      var qrious = this.qrious;
      var moduleSize = this.getModuleSize(frame);
      var offset = this.getOffset(frame);
      var context = this.element.getContext('2d');
      context.fillStyle = qrious.foreground;
      context.globalAlpha = qrious.foregroundAlpha;

      for (i = 0; i < frame.width; i++) {
        for (j = 0; j < frame.width; j++) {
          if (frame.buffer[j * frame.width + i]) {
            context.fillRect(moduleSize * i + offset, moduleSize * j + offset, moduleSize, moduleSize);
          }
        }
      }
    },

    /**
     * @override
     */
    reset: function () {
      var qrious = this.qrious;
      var context = this.element.getContext('2d');
      var size = qrious.size;
      context.lineWidth = 1;
      context.clearRect(0, 0, size, size);
      context.fillStyle = qrious.background;
      context.globalAlpha = qrious.backgroundAlpha;
      context.fillRect(0, 0, size, size);
    },

    /**
     * @override
     */
    resize: function () {
      var element = this.element;
      element.width = element.height = this.qrious.size;
    }
  });
  var CanvasRenderer_1 = CanvasRenderer;
  /* eslint no-multi-spaces: "off" */

  /**
   * Contains alignment pattern information.
   *
   * @public
   * @class
   * @extends Nevis
   */

  var Alignment = lite.extend(null, {
    /**
     * The alignment pattern block.
     *
     * @public
     * @static
     * @type {number[]}
     * @memberof Alignment
     */
    BLOCK: [0, 11, 15, 19, 23, 27, 31, 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28]
  });
  var Alignment_1 = Alignment;
  /* eslint no-multi-spaces: "off" */

  /**
   * Contains error correction information.
   *
   * @public
   * @class
   * @extends Nevis
   */

  var ErrorCorrection = lite.extend(null, {
    /**
     * The error correction blocks.
     *
     * There are four elements per version. The first two indicate the number of blocks, then the data width, and finally
     * the ECC width.
     *
     * @public
     * @static
     * @type {number[]}
     * @memberof ErrorCorrection
     */
    BLOCKS: [1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30],

    /**
     * The final format bits with mask (level << 3 | mask).
     *
     * @public
     * @static
     * @type {number[]}
     * @memberof ErrorCorrection
     */
    FINAL_FORMAT: [// L
    0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, // M
    0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, // Q
    0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, // H
    0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b],

    /**
     * A map of human-readable ECC levels.
     *
     * @public
     * @static
     * @type {Object.<string, number>}
     * @memberof ErrorCorrection
     */
    LEVELS: {
      L: 1,
      M: 2,
      Q: 3,
      H: 4
    }
  });
  var ErrorCorrection_1 = ErrorCorrection;
  /**
   * Contains Galois field information.
   *
   * @public
   * @class
   * @extends Nevis
   */

  var Galois = lite.extend(null, {
    /**
     * The Galois field exponent table.
     *
     * @public
     * @static
     * @type {number[]}
     * @memberof Galois
     */
    EXPONENT: [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23, 0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1, 0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, 0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2, 0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce, 0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc, 0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54, 0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73, 0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff, 0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41, 0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6, 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09, 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16, 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00],

    /**
     * The Galois field log table.
     *
     * @public
     * @static
     * @type {number[]}
     * @memberof Galois
     */
    LOG: [0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, 0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71, 0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45, 0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6, 0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88, 0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40, 0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d, 0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57, 0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18, 0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e, 0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61, 0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2, 0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6, 0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a, 0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7, 0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf]
  });
  var Galois_1 = Galois;
  /**
   * Contains version pattern information.
   *
   * @public
   * @class
   * @extends Nevis
   */

  var Version = lite.extend(null, {
    /**
     * The version pattern block.
     *
     * @public
     * @static
     * @type {number[]}
     * @memberof Version
     */
    BLOCK: [0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, 0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9, 0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, 0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, 0x541, 0xc69]
  });
  var Version_1 = Version;
  /**
   * Generates information for a QR code frame based on a specific value to be encoded.
   *
   * @param {Frame~Options} options - the options to be used
   * @public
   * @class
   * @extends Nevis
   */

  var Frame = lite.extend(function (options) {
    var dataBlock, eccBlock, index, neccBlock1, neccBlock2;
    var valueLength = options.value.length;
    this._badness = [];
    this._level = ErrorCorrection_1.LEVELS[options.level];
    this._polynomial = [];
    this._value = options.value;
    this._version = 0;
    this._stringBuffer = [];

    while (this._version < 40) {
      this._version++;
      index = (this._level - 1) * 4 + (this._version - 1) * 16;
      neccBlock1 = ErrorCorrection_1.BLOCKS[index++];
      neccBlock2 = ErrorCorrection_1.BLOCKS[index++];
      dataBlock = ErrorCorrection_1.BLOCKS[index++];
      eccBlock = ErrorCorrection_1.BLOCKS[index];
      index = dataBlock * (neccBlock1 + neccBlock2) + neccBlock2 - 3 + (this._version <= 9);

      if (valueLength <= index) {
        break;
      }
    }

    this._dataBlock = dataBlock;
    this._eccBlock = eccBlock;
    this._neccBlock1 = neccBlock1;
    this._neccBlock2 = neccBlock2;
    /**
     * The data width is based on version.
     *
     * @public
     * @type {number}
     * @memberof Frame#
     */
    // FIXME: Ensure that it fits instead of being truncated.

    var width = this.width = 17 + 4 * this._version;
    /**
     * The image buffer.
     *
     * @public
     * @type {number[]}
     * @memberof Frame#
     */

    this.buffer = Frame._createArray(width * width);
    this._ecc = Frame._createArray(dataBlock + (dataBlock + eccBlock) * (neccBlock1 + neccBlock2) + neccBlock2);
    this._mask = Frame._createArray((width * (width + 1) + 1) / 2);

    this._insertFinders();

    this._insertAlignments(); // Insert single foreground cell.


    this.buffer[8 + width * (width - 8)] = 1;

    this._insertTimingGap();

    this._reverseMask();

    this._insertTimingRowAndColumn();

    this._insertVersion();

    this._syncMask();

    this._convertBitStream(valueLength);

    this._calculatePolynomial();

    this._appendEccToData();

    this._interleaveBlocks();

    this._pack();

    this._finish();
  }, {
    _addAlignment: function (x, y) {
      var i;
      var buffer = this.buffer;
      var width = this.width;
      buffer[x + width * y] = 1;

      for (i = -2; i < 2; i++) {
        buffer[x + i + width * (y - 2)] = 1;
        buffer[x - 2 + width * (y + i + 1)] = 1;
        buffer[x + 2 + width * (y + i)] = 1;
        buffer[x + i + 1 + width * (y + 2)] = 1;
      }

      for (i = 0; i < 2; i++) {
        this._setMask(x - 1, y + i);

        this._setMask(x + 1, y - i);

        this._setMask(x - i, y - 1);

        this._setMask(x + i, y + 1);
      }
    },
    _appendData: function (data, dataLength, ecc, eccLength) {
      var bit, i, j;
      var polynomial = this._polynomial;
      var stringBuffer = this._stringBuffer;

      for (i = 0; i < eccLength; i++) {
        stringBuffer[ecc + i] = 0;
      }

      for (i = 0; i < dataLength; i++) {
        bit = Galois_1.LOG[stringBuffer[data + i] ^ stringBuffer[ecc]];

        if (bit !== 255) {
          for (j = 1; j < eccLength; j++) {
            stringBuffer[ecc + j - 1] = stringBuffer[ecc + j] ^ Galois_1.EXPONENT[Frame._modN(bit + polynomial[eccLength - j])];
          }
        } else {
          for (j = ecc; j < ecc + eccLength; j++) {
            stringBuffer[j] = stringBuffer[j + 1];
          }
        }

        stringBuffer[ecc + eccLength - 1] = bit === 255 ? 0 : Galois_1.EXPONENT[Frame._modN(bit + polynomial[0])];
      }
    },
    _appendEccToData: function () {
      var i;
      var data = 0;
      var dataBlock = this._dataBlock;

      var ecc = this._calculateMaxLength();

      var eccBlock = this._eccBlock;

      for (i = 0; i < this._neccBlock1; i++) {
        this._appendData(data, dataBlock, ecc, eccBlock);

        data += dataBlock;
        ecc += eccBlock;
      }

      for (i = 0; i < this._neccBlock2; i++) {
        this._appendData(data, dataBlock + 1, ecc, eccBlock);

        data += dataBlock + 1;
        ecc += eccBlock;
      }
    },
    _applyMask: function (mask) {
      var r3x, r3y, x, y;
      var buffer = this.buffer;
      var width = this.width;

      switch (mask) {
        case 0:
          for (y = 0; y < width; y++) {
            for (x = 0; x < width; x++) {
              if (!(x + y & 1) && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;

        case 1:
          for (y = 0; y < width; y++) {
            for (x = 0; x < width; x++) {
              if (!(y & 1) && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;

        case 2:
          for (y = 0; y < width; y++) {
            for (r3x = 0, x = 0; x < width; x++, r3x++) {
              if (r3x === 3) {
                r3x = 0;
              }

              if (!r3x && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;

        case 3:
          for (r3y = 0, y = 0; y < width; y++, r3y++) {
            if (r3y === 3) {
              r3y = 0;
            }

            for (r3x = r3y, x = 0; x < width; x++, r3x++) {
              if (r3x === 3) {
                r3x = 0;
              }

              if (!r3x && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;

        case 4:
          for (y = 0; y < width; y++) {
            for (r3x = 0, r3y = y >> 1 & 1, x = 0; x < width; x++, r3x++) {
              if (r3x === 3) {
                r3x = 0;
                r3y = !r3y;
              }

              if (!r3y && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;

        case 5:
          for (r3y = 0, y = 0; y < width; y++, r3y++) {
            if (r3y === 3) {
              r3y = 0;
            }

            for (r3x = 0, x = 0; x < width; x++, r3x++) {
              if (r3x === 3) {
                r3x = 0;
              }

              if (!((x & y & 1) + !(!r3x | !r3y)) && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;

        case 6:
          for (r3y = 0, y = 0; y < width; y++, r3y++) {
            if (r3y === 3) {
              r3y = 0;
            }

            for (r3x = 0, x = 0; x < width; x++, r3x++) {
              if (r3x === 3) {
                r3x = 0;
              }

              if (!((x & y & 1) + (r3x && r3x === r3y) & 1) && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;

        case 7:
          for (r3y = 0, y = 0; y < width; y++, r3y++) {
            if (r3y === 3) {
              r3y = 0;
            }

            for (r3x = 0, x = 0; x < width; x++, r3x++) {
              if (r3x === 3) {
                r3x = 0;
              }

              if (!((r3x && r3x === r3y) + (x + y & 1) & 1) && !this._isMasked(x, y)) {
                buffer[x + y * width] ^= 1;
              }
            }
          }

          break;
      }
    },
    _calculateMaxLength: function () {
      return this._dataBlock * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
    },
    _calculatePolynomial: function () {
      var i, j;
      var eccBlock = this._eccBlock;
      var polynomial = this._polynomial;
      polynomial[0] = 1;

      for (i = 0; i < eccBlock; i++) {
        polynomial[i + 1] = 1;

        for (j = i; j > 0; j--) {
          polynomial[j] = polynomial[j] ? polynomial[j - 1] ^ Galois_1.EXPONENT[Frame._modN(Galois_1.LOG[polynomial[j]] + i)] : polynomial[j - 1];
        }

        polynomial[0] = Galois_1.EXPONENT[Frame._modN(Galois_1.LOG[polynomial[0]] + i)];
      } // Use logs for generator polynomial to save calculation step.


      for (i = 0; i <= eccBlock; i++) {
        polynomial[i] = Galois_1.LOG[polynomial[i]];
      }
    },
    _checkBadness: function () {
      var b, b1, h, x, y;
      var bad = 0;
      var badness = this._badness;
      var buffer = this.buffer;
      var width = this.width; // Blocks of same colour.

      for (y = 0; y < width - 1; y++) {
        for (x = 0; x < width - 1; x++) {
          // All foreground colour.
          if (buffer[x + width * y] && buffer[x + 1 + width * y] && buffer[x + width * (y + 1)] && buffer[x + 1 + width * (y + 1)] || // All background colour.
          !(buffer[x + width * y] || buffer[x + 1 + width * y] || buffer[x + width * (y + 1)] || buffer[x + 1 + width * (y + 1)])) {
            bad += Frame.N2;
          }
        }
      }

      var bw = 0; // X runs.

      for (y = 0; y < width; y++) {
        h = 0;
        badness[0] = 0;

        for (b = 0, x = 0; x < width; x++) {
          b1 = buffer[x + width * y];

          if (b === b1) {
            badness[h]++;
          } else {
            badness[++h] = 1;
          }

          b = b1;
          bw += b ? 1 : -1;
        }

        bad += this._getBadness(h);
      }

      if (bw < 0) {
        bw = -bw;
      }

      var count = 0;
      var big = bw;
      big += big << 2;
      big <<= 1;

      while (big > width * width) {
        big -= width * width;
        count++;
      }

      bad += count * Frame.N4; // Y runs.

      for (x = 0; x < width; x++) {
        h = 0;
        badness[0] = 0;

        for (b = 0, y = 0; y < width; y++) {
          b1 = buffer[x + width * y];

          if (b === b1) {
            badness[h]++;
          } else {
            badness[++h] = 1;
          }

          b = b1;
        }

        bad += this._getBadness(h);
      }

      return bad;
    },
    _convertBitStream: function (length) {
      var bit, i;
      var ecc = this._ecc;
      var version = this._version; // Convert string to bit stream. 8-bit data to QR-coded 8-bit data (numeric, alphanumeric, or kanji not supported).

      for (i = 0; i < length; i++) {
        ecc[i] = this._value.charCodeAt(i);
      }

      var stringBuffer = this._stringBuffer = ecc.slice();

      var maxLength = this._calculateMaxLength();

      if (length >= maxLength - 2) {
        length = maxLength - 2;

        if (version > 9) {
          length--;
        }
      } // Shift and re-pack to insert length prefix.


      var index = length;

      if (version > 9) {
        stringBuffer[index + 2] = 0;
        stringBuffer[index + 3] = 0;

        while (index--) {
          bit = stringBuffer[index];
          stringBuffer[index + 3] |= 255 & bit << 4;
          stringBuffer[index + 2] = bit >> 4;
        }

        stringBuffer[2] |= 255 & length << 4;
        stringBuffer[1] = length >> 4;
        stringBuffer[0] = 0x40 | length >> 12;
      } else {
        stringBuffer[index + 1] = 0;
        stringBuffer[index + 2] = 0;

        while (index--) {
          bit = stringBuffer[index];
          stringBuffer[index + 2] |= 255 & bit << 4;
          stringBuffer[index + 1] = bit >> 4;
        }

        stringBuffer[1] |= 255 & length << 4;
        stringBuffer[0] = 0x40 | length >> 4;
      } // Fill to end with pad pattern.


      index = length + 3 - (version < 10);

      while (index < maxLength) {
        stringBuffer[index++] = 0xec;
        stringBuffer[index++] = 0x11;
      }
    },
    _getBadness: function (length) {
      var i;
      var badRuns = 0;
      var badness = this._badness;

      for (i = 0; i <= length; i++) {
        if (badness[i] >= 5) {
          badRuns += Frame.N1 + badness[i] - 5;
        }
      } // FBFFFBF as in finder.


      for (i = 3; i < length - 1; i += 2) {
        if (badness[i - 2] === badness[i + 2] && badness[i + 2] === badness[i - 1] && badness[i - 1] === badness[i + 1] && badness[i - 1] * 3 === badness[i] && ( // Background around the foreground pattern? Not part of the specs.
        badness[i - 3] === 0 || i + 3 > length || badness[i - 3] * 3 >= badness[i] * 4 || badness[i + 3] * 3 >= badness[i] * 4)) {
          badRuns += Frame.N3;
        }
      }

      return badRuns;
    },
    _finish: function () {
      // Save pre-mask copy of frame.
      this._stringBuffer = this.buffer.slice();
      var currentMask, i;
      var bit = 0;
      var mask = 30000;
      /*
       * Using for instead of while since in original Arduino code if an early mask was "good enough" it wouldn't try for
       * a better one since they get more complex and take longer.
       */

      for (i = 0; i < 8; i++) {
        // Returns foreground-background imbalance.
        this._applyMask(i);

        currentMask = this._checkBadness(); // Is current mask better than previous best?

        if (currentMask < mask) {
          mask = currentMask;
          bit = i;
        } // Don't increment "i" to a void redoing mask.


        if (bit === 7) {
          break;
        } // Reset for next pass.


        this.buffer = this._stringBuffer.slice();
      } // Redo best mask as none were "good enough" (i.e. last wasn't bit).


      if (bit !== i) {
        this._applyMask(bit);
      } // Add in final mask/ECC level bytes.


      mask = ErrorCorrection_1.FINAL_FORMAT[bit + (this._level - 1 << 3)];
      var buffer = this.buffer;
      var width = this.width; // Low byte.

      for (i = 0; i < 8; i++, mask >>= 1) {
        if (mask & 1) {
          buffer[width - 1 - i + width * 8] = 1;

          if (i < 6) {
            buffer[8 + width * i] = 1;
          } else {
            buffer[8 + width * (i + 1)] = 1;
          }
        }
      } // High byte.


      for (i = 0; i < 7; i++, mask >>= 1) {
        if (mask & 1) {
          buffer[8 + width * (width - 7 + i)] = 1;

          if (i) {
            buffer[6 - i + width * 8] = 1;
          } else {
            buffer[7 + width * 8] = 1;
          }
        }
      }
    },
    _interleaveBlocks: function () {
      var i, j;
      var dataBlock = this._dataBlock;
      var ecc = this._ecc;
      var eccBlock = this._eccBlock;
      var k = 0;

      var maxLength = this._calculateMaxLength();

      var neccBlock1 = this._neccBlock1;
      var neccBlock2 = this._neccBlock2;
      var stringBuffer = this._stringBuffer;

      for (i = 0; i < dataBlock; i++) {
        for (j = 0; j < neccBlock1; j++) {
          ecc[k++] = stringBuffer[i + j * dataBlock];
        }

        for (j = 0; j < neccBlock2; j++) {
          ecc[k++] = stringBuffer[neccBlock1 * dataBlock + i + j * (dataBlock + 1)];
        }
      }

      for (j = 0; j < neccBlock2; j++) {
        ecc[k++] = stringBuffer[neccBlock1 * dataBlock + i + j * (dataBlock + 1)];
      }

      for (i = 0; i < eccBlock; i++) {
        for (j = 0; j < neccBlock1 + neccBlock2; j++) {
          ecc[k++] = stringBuffer[maxLength + i + j * eccBlock];
        }
      }

      this._stringBuffer = ecc;
    },
    _insertAlignments: function () {
      var i, x, y;
      var version = this._version;
      var width = this.width;

      if (version > 1) {
        i = Alignment_1.BLOCK[version];
        y = width - 7;

        for (;;) {
          x = width - 7;

          while (x > i - 3) {
            this._addAlignment(x, y);

            if (x < i) {
              break;
            }

            x -= i;
          }

          if (y <= i + 9) {
            break;
          }

          y -= i;

          this._addAlignment(6, y);

          this._addAlignment(y, 6);
        }
      }
    },
    _insertFinders: function () {
      var i, j, x, y;
      var buffer = this.buffer;
      var width = this.width;

      for (i = 0; i < 3; i++) {
        j = 0;
        y = 0;

        if (i === 1) {
          j = width - 7;
        }

        if (i === 2) {
          y = width - 7;
        }

        buffer[y + 3 + width * (j + 3)] = 1;

        for (x = 0; x < 6; x++) {
          buffer[y + x + width * j] = 1;
          buffer[y + width * (j + x + 1)] = 1;
          buffer[y + 6 + width * (j + x)] = 1;
          buffer[y + x + 1 + width * (j + 6)] = 1;
        }

        for (x = 1; x < 5; x++) {
          this._setMask(y + x, j + 1);

          this._setMask(y + 1, j + x + 1);

          this._setMask(y + 5, j + x);

          this._setMask(y + x + 1, j + 5);
        }

        for (x = 2; x < 4; x++) {
          buffer[y + x + width * (j + 2)] = 1;
          buffer[y + 2 + width * (j + x + 1)] = 1;
          buffer[y + 4 + width * (j + x)] = 1;
          buffer[y + x + 1 + width * (j + 4)] = 1;
        }
      }
    },
    _insertTimingGap: function () {
      var x, y;
      var width = this.width;

      for (y = 0; y < 7; y++) {
        this._setMask(7, y);

        this._setMask(width - 8, y);

        this._setMask(7, y + width - 7);
      }

      for (x = 0; x < 8; x++) {
        this._setMask(x, 7);

        this._setMask(x + width - 8, 7);

        this._setMask(x, width - 8);
      }
    },
    _insertTimingRowAndColumn: function () {
      var x;
      var buffer = this.buffer;
      var width = this.width;

      for (x = 0; x < width - 14; x++) {
        if (x & 1) {
          this._setMask(8 + x, 6);

          this._setMask(6, 8 + x);
        } else {
          buffer[8 + x + width * 6] = 1;
          buffer[6 + width * (8 + x)] = 1;
        }
      }
    },
    _insertVersion: function () {
      var i, j, x, y;
      var buffer = this.buffer;
      var version = this._version;
      var width = this.width;

      if (version > 6) {
        i = Version_1.BLOCK[version - 7];
        j = 17;

        for (x = 0; x < 6; x++) {
          for (y = 0; y < 3; y++, j--) {
            if (1 & (j > 11 ? version >> j - 12 : i >> j)) {
              buffer[5 - x + width * (2 - y + width - 11)] = 1;
              buffer[2 - y + width - 11 + width * (5 - x)] = 1;
            } else {
              this._setMask(5 - x, 2 - y + width - 11);

              this._setMask(2 - y + width - 11, 5 - x);
            }
          }
        }
      }
    },
    _isMasked: function (x, y) {
      var bit = Frame._getMaskBit(x, y);

      return this._mask[bit] === 1;
    },
    _pack: function () {
      var bit, i, j;
      var k = 1;
      var v = 1;
      var width = this.width;
      var x = width - 1;
      var y = width - 1; // Interleaved data and ECC codes.

      var length = (this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;

      for (i = 0; i < length; i++) {
        bit = this._stringBuffer[i];

        for (j = 0; j < 8; j++, bit <<= 1) {
          if (0x80 & bit) {
            this.buffer[x + width * y] = 1;
          } // Find next fill position.


          do {
            if (v) {
              x--;
            } else {
              x++;

              if (k) {
                if (y !== 0) {
                  y--;
                } else {
                  x -= 2;
                  k = !k;

                  if (x === 6) {
                    x--;
                    y = 9;
                  }
                }
              } else if (y !== width - 1) {
                y++;
              } else {
                x -= 2;
                k = !k;

                if (x === 6) {
                  x--;
                  y -= 8;
                }
              }
            }

            v = !v;
          } while (this._isMasked(x, y));
        }
      }
    },
    _reverseMask: function () {
      var x, y;
      var width = this.width;

      for (x = 0; x < 9; x++) {
        this._setMask(x, 8);
      }

      for (x = 0; x < 8; x++) {
        this._setMask(x + width - 8, 8);

        this._setMask(8, x);
      }

      for (y = 0; y < 7; y++) {
        this._setMask(8, y + width - 7);
      }
    },
    _setMask: function (x, y) {
      var bit = Frame._getMaskBit(x, y);

      this._mask[bit] = 1;
    },
    _syncMask: function () {
      var x, y;
      var width = this.width;

      for (y = 0; y < width; y++) {
        for (x = 0; x <= y; x++) {
          if (this.buffer[x + width * y]) {
            this._setMask(x, y);
          }
        }
      }
    }
  }, {
    _createArray: function (length) {
      var i;
      var array = [];

      for (i = 0; i < length; i++) {
        array[i] = 0;
      }

      return array;
    },
    _getMaskBit: function (x, y) {
      var bit;

      if (x > y) {
        bit = x;
        x = y;
        y = bit;
      }

      bit = y;
      bit += y * y;
      bit >>= 1;
      bit += x;
      return bit;
    },
    _modN: function (x) {
      while (x >= 255) {
        x -= 255;
        x = (x >> 8) + (x & 255);
      }

      return x;
    },
    // *Badness* coefficients.
    N1: 3,
    N2: 3,
    N3: 40,
    N4: 10
  });
  var Frame_1 = Frame;
  /**
   * The options used by {@link Frame}.
   *
   * @typedef {Object} Frame~Options
   * @property {string} level - The ECC level to be used.
   * @property {string} value - The value to be encoded.
   */

  /**
   * An implementation of {@link Renderer} for working with <code>img</code> elements.
   *
   * This depends on {@link CanvasRenderer} being executed first as this implementation simply applies the data URL from
   * the rendered <code>canvas</code> element as the <code>src</code> for the <code>img</code> element being rendered.
   *
   * @public
   * @class
   * @extends Renderer
   */

  var ImageRenderer = Renderer_1.extend({
    /**
     * @override
     */
    draw: function () {
      this.element.src = this.qrious.toDataURL();
    },

    /**
     * @override
     */
    reset: function () {
      this.element.src = '';
    },

    /**
     * @override
     */
    resize: function () {
      var element = this.element;
      element.width = element.height = this.qrious.size;
    }
  });
  var ImageRenderer_1 = ImageRenderer;
  /**
   * Defines an available option while also configuring how values are applied to the target object.
   *
   * Optionally, a default value can be specified as well a value transformer for greater control over how the option
   * value is applied.
   *
   * If no value transformer is specified, then any specified option will be applied directly. All values are maintained
   * on the target object itself as a field using the option name prefixed with a single underscore.
   *
   * When an option is specified as modifiable, the {@link OptionManager} will be required to include a setter for the
   * property that is defined on the target object that uses the option name.
   *
   * @param {string} name - the name to be used
   * @param {boolean} [modifiable] - <code>true</code> if the property defined on target objects should include a setter;
   * otherwise <code>false</code>
   * @param {*} [defaultValue] - the default value to be used
   * @param {Option~ValueTransformer} [valueTransformer] - the value transformer to be used
   * @public
   * @class
   * @extends Nevis
   */

  var Option = lite.extend(function (name, modifiable, defaultValue, valueTransformer) {
    /**
     * The name for this {@link Option}.
     *
     * @public
     * @type {string}
     * @memberof Option#
     */
    this.name = name;
    /**
     * Whether a setter should be included on the property defined on target objects for this {@link Option}.
     *
     * @public
     * @type {boolean}
     * @memberof Option#
     */

    this.modifiable = Boolean(modifiable);
    /**
     * The default value for this {@link Option}.
     *
     * @public
     * @type {*}
     * @memberof Option#
     */

    this.defaultValue = defaultValue;
    this._valueTransformer = valueTransformer;
  }, {
    /**
     * Transforms the specified <code>value</code> so that it can be applied for this {@link Option}.
     *
     * If a value transformer has been specified for this {@link Option}, it will be called upon to transform
     * <code>value</code>. Otherwise, <code>value</code> will be returned directly.
     *
     * @param {*} value - the value to be transformed
     * @return {*} The transformed value or <code>value</code> if no value transformer is specified.
     * @public
     * @memberof Option#
     */
    transform: function (value) {
      var transformer = this._valueTransformer;

      if (typeof transformer === 'function') {
        return transformer(value, this);
      }

      return value;
    }
  });
  var Option_1 = Option;
  /**
   * Returns a transformed value for the specified <code>value</code> to be applied for the <code>option</code> provided.
   *
   * @callback Option~ValueTransformer
   * @param {*} value - the value to be transformed
   * @param {Option} option - the {@link Option} for which <code>value</code> is being transformed
   * @return {*} The transform value.
   */

  /**
   * Contains utility methods that are useful throughout the library.
   *
   * @public
   * @class
   * @extends Nevis
   */

  var Utilities = lite.extend(null, {
    /**
     * Returns the absolute value of a given number.
     *
     * This method is simply a convenient shorthand for <code>Math.abs</code> while ensuring that nulls are returned as
     * <code>null</code> instead of zero.
     *
     * @param {number} value - the number whose absolute value is to be returned
     * @return {number} The absolute value of <code>value</code> or <code>null</code> if <code>value</code> is
     * <code>null</code>.
     * @public
     * @static
     * @memberof Utilities
     */
    abs: function (value) {
      return value != null ? Math.abs(value) : null;
    },

    /**
     * Returns whether the specified <code>object</code> has a property with the specified <code>name</code> as an own
     * (not inherited) property.
     *
     * @param {Object} object - the object on which the property is to be checked
     * @param {string} name - the name of the property to be checked
     * @return {boolean} <code>true</code> if <code>object</code> has an own property with <code>name</code>.
     * @public
     * @static
     * @memberof Utilities
     */
    hasOwn: function (object, name) {
      return Object.prototype.hasOwnProperty.call(object, name);
    },

    /**
     * A non-operation method that does absolutely nothing.
     *
     * @return {void}
     * @public
     * @static
     * @memberof Utilities
     */
    noop: function () {},

    /**
     * Transforms the specified <code>string</code> to upper case while remaining null-safe.
     *
     * @param {string} string - the string to be transformed to upper case
     * @return {string} <code>string</code> transformed to upper case if <code>string</code> is not <code>null</code>.
     * @public
     * @static
     * @memberof Utilities
     */
    toUpperCase: function (string) {
      return string != null ? string.toUpperCase() : null;
    }
  });
  var Utilities_1 = Utilities;
  /**
   * Manages multiple {@link Option} instances that are intended to be used by multiple implementations.
   *
   * Although the option definitions are shared between targets, the values are maintained on the targets themselves.
   *
   * @param {Option[]} options - the options to be used
   * @public
   * @class
   * @extends Nevis
   */

  var OptionManager = lite.extend(function (options) {
    /**
     * The available options for this {@link OptionManager}.
     *
     * @public
     * @type {Object.<string, Option>}
     * @memberof OptionManager#
     */
    this.options = {};
    options.forEach(function (option) {
      this.options[option.name] = option;
    }, this);
  }, {
    /**
     * Returns whether an option with the specified <code>name</code> is available.
     *
     * @param {string} name - the name of the {@link Option} whose existence is to be checked
     * @return {boolean} <code>true</code> if an {@link Option} exists with <code>name</code>; otherwise
     * <code>false</code>.
     * @public
     * @memberof OptionManager#
     */
    exists: function (name) {
      return this.options[name] != null;
    },

    /**
     * Returns the value of the option with the specified <code>name</code> on the <code>target</code> object provided.
     *
     * @param {string} name - the name of the {@link Option} whose value on <code>target</code> is to be returned
     * @param {Object} target - the object from which the value of the named {@link Option} is to be returned
     * @return {*} The value of the {@link Option} with <code>name</code> on <code>target</code>.
     * @public
     * @memberof OptionManager#
     */
    get: function (name, target) {
      return OptionManager._get(this.options[name], target);
    },

    /**
     * Returns a copy of all of the available options on the <code>target</code> object provided.
     *
     * @param {Object} target - the object from which the option name/value pairs are to be returned
     * @return {Object.<string, *>} A hash containing the name/value pairs of all options on <code>target</code>.
     * @public
     * @memberof OptionManager#
     */
    getAll: function (target) {
      var name;
      var options = this.options;
      var result = {};

      for (name in options) {
        if (Utilities_1.hasOwn(options, name)) {
          result[name] = OptionManager._get(options[name], target);
        }
      }

      return result;
    },

    /**
     * Initializes the available options for the <code>target</code> object provided and then applies the initial values
     * within the speciifed <code>options</code>.
     *
     * This method will throw an error if any of the names within <code>options</code> does not match an available option.
     *
     * This involves setting the default values and defining properties for all of the available options on
     * <code>target</code> before finally calling {@link OptionMananger#setAll} with <code>options</code> and
     * <code>target</code>. Any options that are configured to be modifiable will have a setter included in their defined
     * property that will allow its corresponding value to be modified.
     *
     * If a change handler is specified, it will be called whenever the value changes on <code>target</code> for a
     * modifiable option, but only when done so via the defined property's setter.
     *
     * @param {Object.<string, *>} options - the name/value pairs of the initial options to be set
     * @param {Object} target - the object on which the options are to be initialized
     * @param {Function} [changeHandler] - the function to be called whenever the value of an modifiable option changes on
     * <code>target</code>
     * @return {void}
     * @throws {Error} If <code>options</code> contains an invalid option name.
     * @public
     * @memberof OptionManager#
     */
    init: function (options, target, changeHandler) {
      if (typeof changeHandler !== 'function') {
        changeHandler = Utilities_1.noop;
      }

      var name, option;

      for (name in this.options) {
        if (Utilities_1.hasOwn(this.options, name)) {
          option = this.options[name];

          OptionManager._set(option, option.defaultValue, target);

          OptionManager._createAccessor(option, target, changeHandler);
        }
      }

      this._setAll(options, target, true);
    },

    /**
     * Sets the value of the option with the specified <code>name</code> on the <code>target</code> object provided to
     * <code>value</code>.
     *
     * This method will throw an error if <code>name</code> does not match an available option or matches an option that
     * cannot be modified.
     *
     * If <code>value</code> is <code>null</code> and the {@link Option} has a default value configured, then that default
     * value will be used instead. If the {@link Option} also has a value transformer configured, it will be used to
     * transform whichever value was determined to be used.
     *
     * This method returns whether the value of the underlying field on <code>target</code> was changed as a result.
     *
     * @param {string} name - the name of the {@link Option} whose value is to be set
     * @param {*} value - the value to be set for the named {@link Option} on <code>target</code>
     * @param {Object} target - the object on which <code>value</code> is to be set for the named {@link Option}
     * @return {boolean} <code>true</code> if the underlying field on <code>target</code> was changed; otherwise
     * <code>false</code>.
     * @throws {Error} If <code>name</code> is invalid or is for an option that cannot be modified.
     * @public
     * @memberof OptionManager#
     */
    set: function (name, value, target) {
      return this._set(name, value, target);
    },

    /**
     * Sets all of the specified <code>options</code> on the <code>target</code> object provided to their corresponding
     * values.
     *
     * This method will throw an error if any of the names within <code>options</code> does not match an available option
     * or matches an option that cannot be modified.
     *
     * If any value within <code>options</code> is <code>null</code> and the corresponding {@link Option} has a default
     * value configured, then that default value will be used instead. If an {@link Option} also has a value transformer
     * configured, it will be used to transform whichever value was determined to be used.
     *
     * This method returns whether the value for any of the underlying fields on <code>target</code> were changed as a
     * result.
     *
     * @param {Object.<string, *>} options - the name/value pairs of options to be set
     * @param {Object} target - the object on which the options are to be set
     * @return {boolean} <code>true</code> if any of the underlying fields on <code>target</code> were changed; otherwise
     * <code>false</code>.
     * @throws {Error} If <code>options</code> contains an invalid option name or an option that cannot be modiifed.
     * @public
     * @memberof OptionManager#
     */
    setAll: function (options, target) {
      return this._setAll(options, target);
    },
    _set: function (name, value, target, allowUnmodifiable) {
      var option = this.options[name];

      if (!option) {
        throw new Error('Invalid option: ' + name);
      }

      if (!option.modifiable && !allowUnmodifiable) {
        throw new Error('Option cannot be modified: ' + name);
      }

      return OptionManager._set(option, value, target);
    },
    _setAll: function (options, target, allowUnmodifiable) {
      if (!options) {
        return false;
      }

      var name;
      var changed = false;

      for (name in options) {
        if (Utilities_1.hasOwn(options, name) && this._set(name, options[name], target, allowUnmodifiable)) {
          changed = true;
        }
      }

      return changed;
    }
  }, {
    _createAccessor: function (option, target, changeHandler) {
      var descriptor = {
        get: function () {
          return OptionManager._get(option, target);
        }
      };

      if (option.modifiable) {
        descriptor.set = function (value) {
          if (OptionManager._set(option, value, target)) {
            changeHandler(value, option);
          }
        };
      }

      Object.defineProperty(target, option.name, descriptor);
    },
    _get: function (option, target) {
      return target['_' + option.name];
    },
    _set: function (option, value, target) {
      var fieldName = '_' + option.name;
      var oldValue = target[fieldName];
      var newValue = option.transform(value != null ? value : option.defaultValue);
      target[fieldName] = newValue;
      return newValue !== oldValue;
    }
  });
  var OptionManager_1 = OptionManager;
  /**
   * Called whenever the value of a modifiable {@link Option} is changed on a target object via the defined property's
   * setter.
   *
   * @callback OptionManager~ChangeHandler
   * @param {*} value - the new value for <code>option</code> on the target object
   * @param {Option} option - the modifable {@link Option} whose value has changed on the target object.
   * @return {void}
   */

  /**
   * A basic manager for {@link Service} implementations that are mapped to simple names.
   *
   * @public
   * @class
   * @extends Nevis
   */

  var ServiceManager = lite.extend(function () {
    this._services = {};
  }, {
    /**
     * Returns the {@link Service} being managed with the specified <code>name</code>.
     *
     * @param {string} name - the name of the {@link Service} to be returned
     * @return {Service} The {@link Service} is being managed with <code>name</code>.
     * @throws {Error} If no {@link Service} is being managed with <code>name</code>.
     * @public
     * @memberof ServiceManager#
     */
    getService: function (name) {
      var service = this._services[name];

      if (!service) {
        throw new Error('Service is not being managed with name: ' + name);
      }

      return service;
    },

    /**
     * Sets the {@link Service} implementation to be managed for the specified <code>name</code> to the
     * <code>service</code> provided.
     *
     * @param {string} name - the name of the {@link Service} to be managed with <code>name</code>
     * @param {Service} service - the {@link Service} implementation to be managed
     * @return {void}
     * @throws {Error} If a {@link Service} is already being managed with the same <code>name</code>.
     * @public
     * @memberof ServiceManager#
     */
    setService: function (name, service) {
      if (this._services[name]) {
        throw new Error('Service is already managed with name: ' + name);
      }

      if (service) {
        this._services[name] = service;
      }
    }
  });
  var ServiceManager_1 = ServiceManager;
  var optionManager = new OptionManager_1([new Option_1('background', true, 'white'), new Option_1('backgroundAlpha', true, 1, Utilities_1.abs), new Option_1('element'), new Option_1('foreground', true, 'black'), new Option_1('foregroundAlpha', true, 1, Utilities_1.abs), new Option_1('level', true, 'L', Utilities_1.toUpperCase), new Option_1('mime', true, 'image/png'), new Option_1('padding', true, null, Utilities_1.abs), new Option_1('size', true, 100, Utilities_1.abs), new Option_1('value', true, '')]);
  var serviceManager = new ServiceManager_1();
  /**
   * Enables configuration of a QR code generator which uses HTML5 <code>canvas</code> for rendering.
   *
   * @param {QRious~Options} [options] - the options to be used
   * @throws {Error} If any <code>options</code> are invalid.
   * @public
   * @class
   * @extends Nevis
   */

  var QRious = lite.extend(function (options) {
    optionManager.init(options, this, this.update.bind(this));
    var element = optionManager.get('element', this);
    var elementService = serviceManager.getService('element');
    var canvas = element && elementService.isCanvas(element) ? element : elementService.createCanvas();
    var image = element && elementService.isImage(element) ? element : elementService.createImage();
    this._canvasRenderer = new CanvasRenderer_1(this, canvas, true);
    this._imageRenderer = new ImageRenderer_1(this, image, image === element);
    this.update();
  }, {
    /**
     * Returns all of the options configured for this {@link QRious}.
     *
     * Any changes made to the returned object will not be reflected in the options themselves or their corresponding
     * underlying fields.
     *
     * @return {Object.<string, *>} A copy of the applied options.
     * @public
     * @memberof QRious#
     */
    get: function () {
      return optionManager.getAll(this);
    },

    /**
     * Sets all of the specified <code>options</code> and automatically updates this {@link QRious} if any of the
     * underlying fields are changed as a result.
     *
     * This is the preferred method for updating multiple options at one time to avoid unnecessary updates between
     * changes.
     *
     * @param {QRious~Options} options - the options to be set
     * @return {void}
     * @throws {Error} If any <code>options</code> are invalid or cannot be modified.
     * @public
     * @memberof QRious#
     */
    set: function (options) {
      if (optionManager.setAll(options, this)) {
        this.update();
      }
    },

    /**
     * Returns the image data URI for the generated QR code using the <code>mime</code> provided.
     *
     * @param {string} [mime] - the MIME type for the image
     * @return {string} The image data URI for the QR code.
     * @public
     * @memberof QRious#
     */
    toDataURL: function (mime) {
      return this.canvas.toDataURL(mime || this.mime);
    },

    /**
     * Updates this {@link QRious} by generating a new {@link Frame} and re-rendering the QR code.
     *
     * @return {void}
     * @protected
     * @memberof QRious#
     */
    update: function () {
      var frame = new Frame_1({
        level: this.level,
        value: this.value
      });

      this._canvasRenderer.render(frame);

      this._imageRenderer.render(frame);
    }
  }, {
    /**
     * Configures the <code>service</code> provided to be used by all {@link QRious} instances.
     *
     * @param {Service} service - the {@link Service} to be configured
     * @return {void}
     * @throws {Error} If a {@link Service} has already been configured with the same name.
     * @public
     * @static
     * @memberof QRious
     */
    use: function (service) {
      serviceManager.setService(service.getName(), service);
    }
  });
  Object.defineProperties(QRious.prototype, {
    canvas: {
      /**
       * Returns the <code>canvas</code> element being used to render the QR code for this {@link QRious}.
       *
       * @return {*} The <code>canvas</code> element.
       * @public
       * @memberof QRious#
       * @alias canvas
       */
      get: function () {
        return this._canvasRenderer.getElement();
      }
    },
    image: {
      /**
       * Returns the <code>img</code> element being used to render the QR code for this {@link QRious}.
       *
       * @return {*} The <code>img</code> element.
       * @public
       * @memberof QRious#
       * @alias image
       */
      get: function () {
        return this._imageRenderer.getElement();
      }
    }
  });
  var QRious_1$2 = QRious;
  /**
   * The options used by {@link QRious}.
   *
   * @typedef {Object} QRious~Options
   * @property {string} [background="white"] - The background color to be applied to the QR code.
   * @property {number} [backgroundAlpha=1] - The background alpha to be applied to the QR code.
   * @property {*} [element] - The element to be used to render the QR code which may either be an <code>canvas</code> or
   * <code>img</code>. The element(s) will be created if needed.
   * @property {string} [foreground="black"] - The foreground color to be applied to the QR code.
   * @property {number} [foregroundAlpha=1] - The foreground alpha to be applied to the QR code.
   * @property {string} [level="L"] - The error correction level to be applied to the QR code.
   * @property {string} [mime="image/png"] - The MIME type to be used to render the image for the QR code.
   * @property {number} [padding] - The padding for the QR code in pixels.
   * @property {number} [size=100] - The size of the QR code in pixels.
   * @property {string} [value=""] - The value to be encoded within the QR code.
   */

  var index = QRious_1$2;
  /**
   * Defines a service contract that must be met by all implementations.
   *
   * @public
   * @class
   * @extends Nevis
   */

  var Service = lite.extend({
    /**
     * Returns the name of this {@link Service}.
     *
     * @return {string} The service name.
     * @public
     * @abstract
     * @memberof Service#
     */
    getName: function () {}
  });
  var Service_1 = Service;
  /**
   * A service for working with elements.
   *
   * @public
   * @class
   * @extends Service
   */

  var ElementService = Service_1.extend({
    /**
     * Creates an instance of a canvas element.
     *
     * Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
     *
     * @return {*} The newly created canvas element.
     * @public
     * @abstract
     * @memberof ElementService#
     */
    createCanvas: function () {},

    /**
     * Creates an instance of a image element.
     *
     * Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
     *
     * @return {*} The newly created image element.
     * @public
     * @abstract
     * @memberof ElementService#
     */
    createImage: function () {},

    /**
     * @override
     */
    getName: function () {
      return 'element';
    },

    /**
     * Returns whether the specified <code>element</code> is a canvas.
     *
     * Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
     *
     * @param {*} element - the element to be checked
     * @return {boolean} <code>true</code> if <code>element</code> is a canvas; otherwise <code>false</code>.
     * @public
     * @abstract
     * @memberof ElementService#
     */
    isCanvas: function (element) {},

    /**
     * Returns whether the specified <code>element</code> is an image.
     *
     * Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
     *
     * @param {*} element - the element to be checked
     * @return {boolean} <code>true</code> if <code>element</code> is an image; otherwise <code>false</code>.
     * @public
     * @abstract
     * @memberof ElementService#
     */
    isImage: function (element) {}
  });
  var ElementService_1 = ElementService;
  /**
   * An implementation of {@link ElementService} intended for use within a browser environment.
   *
   * @public
   * @class
   * @extends ElementService
   */

  var BrowserElementService = ElementService_1.extend({
    /**
     * @override
     */
    createCanvas: function () {
      return document.createElement('canvas');
    },

    /**
     * @override
     */
    createImage: function () {
      return document.createElement('img');
    },

    /**
     * @override
     */
    isCanvas: function (element) {
      return element instanceof HTMLCanvasElement;
    },

    /**
     * @override
     */
    isImage: function (element) {
      return element instanceof HTMLImageElement;
    }
  });
  var BrowserElementService_1 = BrowserElementService;
  index.use(new BrowserElementService_1());
  var QRious_1 = index;
  return QRious_1;
});/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const t=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function e(e){return(i,n)=>void 0!==n?((t,e,i)=>{e.constructor.createProperty(i,t)})(e,i,n):t(e,i)
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */}var i;null===(i=window.HTMLSlotElement)||void 0===i||i.prototype.assignedElements;
/**
 * @license
 * Copyright 2010-2023 Three.js Authors
 * SPDX-License-Identifier: MIT
 */
const n="151",r=1,s=2,a=3,o=0,l=1,h=2,c=0,u=100,d=0,A=1,p=2,m=0,g=1,f=2,v=3,y=4,x=5,_=301,E=302,w=303,C=306,I=1e3,b=1001,S=1002,M=1003,B=1004,T=1005,R=1006,L=1007,D=1008,Q=1009,P=1014,U=1015,N=1016,F=1020,k=1023,O=1026,G=1027,H=1028,z=1030,V=33776,W=33777,q=33778,j=33779,Y=35840,J=35842,X=36196,K=37492,$=37496,Z=37808,tt=36492,et=2201,it=2202,nt=2300,rt=2301,st=2302,at=2400,ot=2401,lt=2402,ht=2500,ct=1,ut=2,dt=3e3,At=3001,pt=0,mt="srgb",gt="srgb-linear",ft="display-p3",vt=7680,yt=35044,xt="300 es",_t=1035;class Et{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const wt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Ct=1234567;const It=Math.PI/180,bt=180/Math.PI;function St(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(wt[255&t]+wt[t>>8&255]+wt[t>>16&255]+wt[t>>24&255]+"-"+wt[255&e]+wt[e>>8&255]+"-"+wt[e>>16&15|64]+wt[e>>24&255]+"-"+wt[63&i|128]+wt[i>>8&255]+"-"+wt[i>>16&255]+wt[i>>24&255]+wt[255&n]+wt[n>>8&255]+wt[n>>16&255]+wt[n>>24&255]).toLowerCase()}function Mt(t,e,i){return Math.max(e,Math.min(i,t))}function Bt(t,e){return(t%e+e)%e}function Tt(t,e,i){return(1-i)*t+i*e}function Rt(t){return 0==(t&t-1)&&0!==t}function Lt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Dt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Qt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Pt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Ut={DEG2RAD:It,RAD2DEG:bt,generateUUID:St,clamp:Mt,euclideanModulo:Bt,mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:Tt,damp:function(t,e,i,n){return Tt(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(Bt(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(Ct=t);let e=Ct+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*It},radToDeg:function(t){return t*bt},isPowerOfTwo:Rt,ceilPowerOfTwo:Lt,floorPowerOfTwo:Dt,setQuaternionFromProperEuler:function(t,e,i,n,r){const s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),h=s((e+n)/2),c=a((e+n)/2),u=s((e-n)/2),d=a((e-n)/2),A=s((n-e)/2),p=a((n-e)/2);switch(r){case"XYX":t.set(o*c,l*u,l*d,o*h);break;case"YZY":t.set(l*d,o*c,l*u,o*h);break;case"ZXZ":t.set(l*u,l*d,o*c,o*h);break;case"XZX":t.set(o*c,l*p,l*A,o*h);break;case"YXY":t.set(l*A,o*c,l*p,o*h);break;case"ZYZ":t.set(l*p,l*A,o*c,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Pt,denormalize:Qt};class Nt{constructor(t=0,e=0){Nt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Mt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ft{constructor(){Ft.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,i,n,r,s,a,o,l){const h=this.elements;return h[0]=t,h[1]=n,h[2]=a,h[3]=e,h[4]=r,h[5]=o,h[6]=i,h[7]=s,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],h=i[4],c=i[7],u=i[2],d=i[5],A=i[8],p=n[0],m=n[3],g=n[6],f=n[1],v=n[4],y=n[7],x=n[2],_=n[5],E=n[8];return r[0]=s*p+a*f+o*x,r[3]=s*m+a*v+o*_,r[6]=s*g+a*y+o*E,r[1]=l*p+h*f+c*x,r[4]=l*m+h*v+c*_,r[7]=l*g+h*y+c*E,r[2]=u*p+d*f+A*x,r[5]=u*m+d*v+A*_,r[8]=u*g+d*y+A*E,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8];return e*s*h-e*a*l-i*r*h+i*a*o+n*r*l-n*s*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=h*s-a*l,u=a*o-h*r,d=l*r-s*o,A=e*c+i*u+n*d;if(0===A)return this.set(0,0,0,0,0,0,0,0,0);const p=1/A;return t[0]=c*p,t[1]=(n*l-h*i)*p,t[2]=(a*i-n*s)*p,t[3]=u*p,t[4]=(h*e-n*o)*p,t[5]=(n*r-a*e)*p,t[6]=d*p,t[7]=(i*o-l*e)*p,t[8]=(s*e-i*r)*p,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*s+l*a)+s+t,-n*l,n*o,-n*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(kt.makeScale(t,e)),this}rotate(t){return this.premultiply(kt.makeRotation(-t)),this}translate(t,e){return this.premultiply(kt.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const kt=new Ft;function Ot(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Gt(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ht(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function zt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Vt=(new Ft).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Wt=(new Ft).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);const qt={[gt]:t=>t,[mt]:t=>t.convertSRGBToLinear(),[ft]:function(t){return t.convertSRGBToLinear().applyMatrix3(Wt)}},jt={[gt]:t=>t,[mt]:t=>t.convertLinearToSRGB(),[ft]:function(t){return t.applyMatrix3(Vt).convertLinearToSRGB()}},Yt={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return gt},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,i){if(!1===this.enabled||e===i||!e||!i)return t;const n=qt[e],r=jt[i];if(void 0===n||void 0===r)throw new Error(`Unsupported color space conversion, "${e}" to "${i}".`);return r(n(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}};let Jt;class Xt{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Jt&&(Jt=Gt("canvas")),Jt.width=t.width,Jt.height=t.height;const i=Jt.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=Jt}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Gt("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t<r.length;t++)r[t]=255*Ht(r[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Ht(e[t]/255)):e[t]=Ht(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}class Kt{constructor(t=null){this.isSource=!0,this.uuid=St(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push($t(n[e].image)):t.push($t(n[e]))}else t=$t(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function $t(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Xt.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Zt=0;class te extends Et{constructor(t=te.DEFAULT_IMAGE,e=te.DEFAULT_MAPPING,i=b,n=b,r=R,s=D,a=k,o=Q,l=te.DEFAULT_ANISOTROPY,h=dt){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Zt++}),this.uuid=St(),this.name="",this.source=new Kt(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Nt(0,0),this.repeat=new Nt(1,1),this.center=new Nt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ft,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case I:t.x=t.x-Math.floor(t.x);break;case b:t.x=t.x<0?0:1;break;case S:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case I:t.y=t.y-Math.floor(t.y);break;case b:t.y=t.y<0?0:1;break;case S:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}te.DEFAULT_IMAGE=null,te.DEFAULT_MAPPING=300,te.DEFAULT_ANISOTROPY=1;class ee{constructor(t=0,e=0,i=0,n=1){ee.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const s=.01,a=.1,o=t.elements,l=o[0],h=o[4],c=o[8],u=o[1],d=o[5],A=o[9],p=o[2],m=o[6],g=o[10];if(Math.abs(h-u)<s&&Math.abs(c-p)<s&&Math.abs(A-m)<s){if(Math.abs(h+u)<a&&Math.abs(c+p)<a&&Math.abs(A+m)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(d+1)/2,f=(g+1)/2,v=(h+u)/4,y=(c+p)/4,x=(A+m)/4;return t>o&&t>f?t<s?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=v/i,r=y/i):o>f?o<s?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(o),i=v/n,r=x/n):f<s?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(f),i=y/r,n=x/r),this.set(i,n,r,e),this}let f=Math.sqrt((m-A)*(m-A)+(c-p)*(c-p)+(u-h)*(u-h));return Math.abs(f)<.001&&(f=1),this.x=(m-A)/f,this.y=(c-p)/f,this.z=(u-h)/f,this.w=Math.acos((l+d+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ie extends Et{constructor(t=1,e=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new ee(0,0,t,e),this.scissorTest=!1,this.viewport=new ee(0,0,t,e);const n={width:t,height:e,depth:1};this.texture=new te(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:R,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?i.samples:0}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new Kt(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ne extends te{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=M,this.minFilter=M,this.wrapR=b,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class re extends te{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=M,this.minFilter=M,this.wrapR=b,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class se{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,s,a){let o=i[n+0],l=i[n+1],h=i[n+2],c=i[n+3];const u=r[s+0],d=r[s+1],A=r[s+2],p=r[s+3];if(0===a)return t[e+0]=o,t[e+1]=l,t[e+2]=h,void(t[e+3]=c);if(1===a)return t[e+0]=u,t[e+1]=d,t[e+2]=A,void(t[e+3]=p);if(c!==p||o!==u||l!==d||h!==A){let t=1-a;const e=o*u+l*d+h*A+c*p,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),s=Math.atan2(r,e*i);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*i;if(o=o*t+u*r,l=l*t+d*r,h=h*t+A*r,c=c*t+p*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=t,l*=t,h*=t,c*=t}}t[e]=o,t[e+1]=l,t[e+2]=h,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,n,r,s){const a=i[n],o=i[n+1],l=i[n+2],h=i[n+3],c=r[s],u=r[s+1],d=r[s+2],A=r[s+3];return t[e]=a*A+h*c+o*d-l*u,t[e+1]=o*A+h*u+l*c-a*d,t[e+2]=l*A+h*d+a*u-o*c,t[e+3]=h*A-a*c-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const i=t._x,n=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(i/2),h=a(n/2),c=a(r/2),u=o(i/2),d=o(n/2),A=o(r/2);switch(s){case"XYZ":this._x=u*h*c+l*d*A,this._y=l*d*c-u*h*A,this._z=l*h*A+u*d*c,this._w=l*h*c-u*d*A;break;case"YXZ":this._x=u*h*c+l*d*A,this._y=l*d*c-u*h*A,this._z=l*h*A-u*d*c,this._w=l*h*c+u*d*A;break;case"ZXY":this._x=u*h*c-l*d*A,this._y=l*d*c+u*h*A,this._z=l*h*A+u*d*c,this._w=l*h*c-u*d*A;break;case"ZYX":this._x=u*h*c-l*d*A,this._y=l*d*c+u*h*A,this._z=l*h*A-u*d*c,this._w=l*h*c+u*d*A;break;case"YZX":this._x=u*h*c+l*d*A,this._y=l*d*c+u*h*A,this._z=l*h*A-u*d*c,this._w=l*h*c-u*d*A;break;case"XZY":this._x=u*h*c-l*d*A,this._y=l*d*c-u*h*A,this._z=l*h*A+u*d*c,this._w=l*h*c+u*d*A;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],h=e[6],c=e[10],u=i+a+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(h-o)*t,this._y=(r-l)*t,this._z=(s-n)*t}else if(i>a&&i>c){const t=2*Math.sqrt(1+i-a-c);this._w=(h-o)/t,this._x=.25*t,this._y=(n+s)/t,this._z=(r+l)/t}else if(a>c){const t=2*Math.sqrt(1+a-i-c);this._w=(r-l)/t,this._x=(n+s)/t,this._y=.25*t,this._z=(o+h)/t}else{const t=2*Math.sqrt(1+c-i-a);this._w=(s-n)/t,this._x=(r+l)/t,this._y=(o+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Mt(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,h=e._w;return this._x=i*h+s*a+n*l-r*o,this._y=n*h+s*o+r*a-i*l,this._z=r*h+s*l+i*o-n*a,this._w=s*h-i*a-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,s=this._w;let a=s*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=i,this._y=n,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),h=Math.atan2(l,a),c=Math.sin((1-e)*h)/l,u=Math.sin(e*h)/l;return this._w=s*c+this._w*u,this._x=i*c+this._x*u,this._y=n*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ae{constructor(t=0,e=0,i=0){ae.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(le.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(le.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*n-a*i,h=o*i+a*e-r*n,c=o*n+r*i-s*e,u=-r*e-s*i-a*n;return this.x=l*o+u*-r+h*-a-c*-s,this.y=h*o+u*-s+c*-r-l*-a,this.z=c*o+u*-a+l*-s-h*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=n*o-r*a,this.y=r*s-i*o,this.z=i*a-n*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return oe.copy(this).projectOnVector(t),this.sub(oe)}reflect(t){return this.sub(oe.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Mt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const oe=new ae,le=new se;class he{constructor(t=new ae(1/0,1/0,1/0),e=new ae(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(ue.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(ue.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=ue.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),void 0!==t.boundingBox)null===t.boundingBox&&t.computeBoundingBox(),de.copy(t.boundingBox),de.applyMatrix4(t.matrixWorld),this.union(de);else{const i=t.geometry;if(void 0!==i)if(e&&void 0!==i.attributes&&void 0!==i.attributes.position){const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)ue.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(ue)}else null===i.boundingBox&&i.computeBoundingBox(),de.copy(i.boundingBox),de.applyMatrix4(t.matrixWorld),this.union(de)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,ue),ue.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ye),xe.subVectors(this.max,ye),Ae.subVectors(t.a,ye),pe.subVectors(t.b,ye),me.subVectors(t.c,ye),ge.subVectors(pe,Ae),fe.subVectors(me,pe),ve.subVectors(Ae,me);let e=[0,-ge.z,ge.y,0,-fe.z,fe.y,0,-ve.z,ve.y,ge.z,0,-ge.x,fe.z,0,-fe.x,ve.z,0,-ve.x,-ge.y,ge.x,0,-fe.y,fe.x,0,-ve.y,ve.x,0];return!!we(e,Ae,pe,me,xe)&&(e=[1,0,0,0,1,0,0,0,1],!!we(e,Ae,pe,me,xe)&&(_e.crossVectors(ge,fe),e=[_e.x,_e.y,_e.z],we(e,Ae,pe,me,xe)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ue).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(ue).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(ce[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ce[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ce[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ce[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ce[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ce[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ce[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ce[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ce)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const ce=[new ae,new ae,new ae,new ae,new ae,new ae,new ae,new ae],ue=new ae,de=new he,Ae=new ae,pe=new ae,me=new ae,ge=new ae,fe=new ae,ve=new ae,ye=new ae,xe=new ae,_e=new ae,Ee=new ae;function we(t,e,i,n,r){for(let s=0,a=t.length-3;s<=a;s+=3){Ee.fromArray(t,s);const a=r.x*Math.abs(Ee.x)+r.y*Math.abs(Ee.y)+r.z*Math.abs(Ee.z),o=e.dot(Ee),l=i.dot(Ee),h=n.dot(Ee);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>a)return!1}return!0}const Ce=new he,Ie=new ae,be=new ae;class Se{constructor(t=new ae,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):Ce.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Ie.subVectors(t,this.center);const e=Ie.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Ie,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(be.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ie.copy(t.center).add(be)),this.expandByPoint(Ie.copy(t.center).sub(be))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Me=new ae,Be=new ae,Te=new ae,Re=new ae,Le=new ae,De=new ae,Qe=new ae;class Pe{constructor(t=new ae,e=new ae(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Me)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Me.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Me.copy(this.origin).addScaledVector(this.direction,e),Me.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){Be.copy(t).add(e).multiplyScalar(.5),Te.copy(e).sub(t).normalize(),Re.copy(this.origin).sub(Be);const r=.5*t.distanceTo(e),s=-this.direction.dot(Te),a=Re.dot(this.direction),o=-Re.dot(Te),l=Re.lengthSq(),h=Math.abs(1-s*s);let c,u,d,A;if(h>0)if(c=s*o-a,u=s*a-o,A=r*h,c>=0)if(u>=-A)if(u<=A){const t=1/h;c*=t,u*=t,d=c*(c+s*u+2*a)+u*(s*c+u+2*o)+l}else u=r,c=Math.max(0,-(s*u+a)),d=-c*c+u*(u+2*o)+l;else u=-r,c=Math.max(0,-(s*u+a)),d=-c*c+u*(u+2*o)+l;else u<=-A?(c=Math.max(0,-(-s*r+a)),u=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+l):u<=A?(c=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(c=Math.max(0,-(s*r+a)),u=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+l);else u=s>0?-r:r,c=Math.max(0,-(s*u+a)),d=-c*c+u*(u+2*o)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,c),n&&n.copy(Be).addScaledVector(Te,u),d}intersectSphere(t,e){Me.subVectors(t.center,this.origin);const i=Me.dot(this.direction),n=Me.dot(Me)-i*i,r=t.radius*t.radius;if(n>r)return null;const s=Math.sqrt(r-n),a=i-s,o=i+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,a,o;const l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return l>=0?(i=(t.min.x-u.x)*l,n=(t.max.x-u.x)*l):(i=(t.max.x-u.x)*l,n=(t.min.x-u.x)*l),h>=0?(r=(t.min.y-u.y)*h,s=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,s=(t.min.y-u.y)*h),i>s||r>n?null:((r>i||isNaN(i))&&(i=r),(s<n||isNaN(n))&&(n=s),c>=0?(a=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(a=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),i>o||a>n?null:((a>i||i!=i)&&(i=a),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,Me)}intersectTriangle(t,e,i,n,r){Le.subVectors(e,t),De.subVectors(i,t),Qe.crossVectors(Le,De);let s,a=this.direction.dot(Qe);if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Re.subVectors(this.origin,t);const o=s*this.direction.dot(De.crossVectors(Re,De));if(o<0)return null;const l=s*this.direction.dot(Le.cross(Re));if(l<0)return null;if(o+l>a)return null;const h=-s*Re.dot(Qe);return h<0?null:this.at(h/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ue{constructor(){Ue.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,i,n,r,s,a,o,l,h,c,u,d,A,p,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=u,g[3]=d,g[7]=A,g[11]=p,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Ue).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/Ne.setFromMatrixColumn(t,0).length(),r=1/Ne.setFromMatrixColumn(t,1).length(),s=1/Ne.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=s*h,i=s*c,n=a*h,r=a*c;e[0]=o*h,e[4]=-o*c,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=n+i*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t+r*a,e[4]=n*a-i,e[8]=s*l,e[1]=s*c,e[5]=s*h,e[9]=-a,e[2]=i*a-n,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t-r*a,e[4]=-s*c,e[8]=n+i*a,e[1]=i+n*a,e[5]=s*h,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*h,i=s*c,n=a*h,r=a*c;e[0]=o*h,e[4]=n*l-i,e[8]=t*l+r,e[1]=o*c,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*h,e[4]=r-t*c,e[8]=n*c+i,e[1]=c,e[5]=s*h,e[9]=-a*h,e[2]=-l*h,e[6]=i*c+n,e[10]=t-r*c}else if("XZY"===t.order){const t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*h,e[4]=-c,e[8]=l*h,e[1]=t*c+r,e[5]=s*h,e[9]=i*c-n,e[2]=n*c-i,e[6]=a*h,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ke,t,Oe)}lookAt(t,e,i){const n=this.elements;return ze.subVectors(t,e),0===ze.lengthSq()&&(ze.z=1),ze.normalize(),Ge.crossVectors(i,ze),0===Ge.lengthSq()&&(1===Math.abs(i.z)?ze.x+=1e-4:ze.z+=1e-4,ze.normalize(),Ge.crossVectors(i,ze)),Ge.normalize(),He.crossVectors(ze,Ge),n[0]=Ge.x,n[4]=He.x,n[8]=ze.x,n[1]=Ge.y,n[5]=He.y,n[9]=ze.y,n[2]=Ge.z,n[6]=He.z,n[10]=ze.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],h=i[1],c=i[5],u=i[9],d=i[13],A=i[2],p=i[6],m=i[10],g=i[14],f=i[3],v=i[7],y=i[11],x=i[15],_=n[0],E=n[4],w=n[8],C=n[12],I=n[1],b=n[5],S=n[9],M=n[13],B=n[2],T=n[6],R=n[10],L=n[14],D=n[3],Q=n[7],P=n[11],U=n[15];return r[0]=s*_+a*I+o*B+l*D,r[4]=s*E+a*b+o*T+l*Q,r[8]=s*w+a*S+o*R+l*P,r[12]=s*C+a*M+o*L+l*U,r[1]=h*_+c*I+u*B+d*D,r[5]=h*E+c*b+u*T+d*Q,r[9]=h*w+c*S+u*R+d*P,r[13]=h*C+c*M+u*L+d*U,r[2]=A*_+p*I+m*B+g*D,r[6]=A*E+p*b+m*T+g*Q,r[10]=A*w+p*S+m*R+g*P,r[14]=A*C+p*M+m*L+g*U,r[3]=f*_+v*I+y*B+x*D,r[7]=f*E+v*b+y*T+x*Q,r[11]=f*w+v*S+y*R+x*P,r[15]=f*C+v*M+y*L+x*U,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],h=t[2],c=t[6],u=t[10],d=t[14];return t[3]*(+r*o*c-n*l*c-r*a*u+i*l*u+n*a*d-i*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-n*s*d+n*l*h-r*o*h)+t[11]*(+e*l*c-e*a*d-r*s*c+i*s*d+r*a*h-i*l*h)+t[15]*(-n*a*h-e*o*c+e*a*u+n*s*c-i*s*u+i*o*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=t[9],u=t[10],d=t[11],A=t[12],p=t[13],m=t[14],g=t[15],f=c*m*l-p*u*l+p*o*d-a*m*d-c*o*g+a*u*g,v=A*u*l-h*m*l-A*o*d+s*m*d+h*o*g-s*u*g,y=h*p*l-A*c*l+A*a*d-s*p*d-h*a*g+s*c*g,x=A*c*o-h*p*o-A*a*u+s*p*u+h*a*m-s*c*m,_=e*f+i*v+n*y+r*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const E=1/_;return t[0]=f*E,t[1]=(p*u*r-c*m*r-p*n*d+i*m*d+c*n*g-i*u*g)*E,t[2]=(a*m*r-p*o*r+p*n*l-i*m*l-a*n*g+i*o*g)*E,t[3]=(c*o*r-a*u*r-c*n*l+i*u*l+a*n*d-i*o*d)*E,t[4]=v*E,t[5]=(h*m*r-A*u*r+A*n*d-e*m*d-h*n*g+e*u*g)*E,t[6]=(A*o*r-s*m*r-A*n*l+e*m*l+s*n*g-e*o*g)*E,t[7]=(s*u*r-h*o*r+h*n*l-e*u*l-s*n*d+e*o*d)*E,t[8]=y*E,t[9]=(A*c*r-h*p*r-A*i*d+e*p*d+h*i*g-e*c*g)*E,t[10]=(s*p*r-A*a*r+A*i*l-e*p*l-s*i*g+e*a*g)*E,t[11]=(h*a*r-s*c*r-h*i*l+e*c*l+s*i*d-e*a*d)*E,t[12]=x*E,t[13]=(h*p*n-A*c*n+A*i*u-e*p*u-h*i*m+e*c*m)*E,t[14]=(A*a*n-s*p*n-A*i*o+e*p*o+s*i*m-e*a*m)*E,t[15]=(s*c*n-h*a*n+h*i*o-e*c*o-s*i*u+e*a*u)*E,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,a=t.y,o=t.z,l=r*s,h=r*a;return this.set(l*s+i,l*a-n*o,l*o+n*a,0,l*a+n*o,h*a+i,h*o-n*s,0,l*o-n*a,h*o+n*s,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,s){return this.set(1,i,r,0,t,1,s,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,h=s+s,c=a+a,u=r*l,d=r*h,A=r*c,p=s*h,m=s*c,g=a*c,f=o*l,v=o*h,y=o*c,x=i.x,_=i.y,E=i.z;return n[0]=(1-(p+g))*x,n[1]=(d+y)*x,n[2]=(A-v)*x,n[3]=0,n[4]=(d-y)*_,n[5]=(1-(u+g))*_,n[6]=(m+f)*_,n[7]=0,n[8]=(A+v)*E,n[9]=(m-f)*E,n[10]=(1-(u+p))*E,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=Ne.set(n[0],n[1],n[2]).length();const s=Ne.set(n[4],n[5],n[6]).length(),a=Ne.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],Fe.copy(this);const o=1/r,l=1/s,h=1/a;return Fe.elements[0]*=o,Fe.elements[1]*=o,Fe.elements[2]*=o,Fe.elements[4]*=l,Fe.elements[5]*=l,Fe.elements[6]*=l,Fe.elements[8]*=h,Fe.elements[9]*=h,Fe.elements[10]*=h,e.setFromRotationMatrix(Fe),i.x=r,i.y=s,i.z=a,this}makePerspective(t,e,i,n,r,s){const a=this.elements,o=2*r/(e-t),l=2*r/(i-n),h=(e+t)/(e-t),c=(i+n)/(i-n),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,n,r,s){const a=this.elements,o=1/(e-t),l=1/(i-n),h=1/(s-r),c=(e+t)*o,u=(i+n)*l,d=(s+r)*h;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-c,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Ne=new ae,Fe=new Ue,ke=new ae(0,0,0),Oe=new ae(1,1,1),Ge=new ae,He=new ae,ze=new ae,Ve=new Ue,We=new se;class qe{constructor(t=0,e=0,i=0,n=qe.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],s=n[4],a=n[8],o=n[1],l=n[5],h=n[9],c=n[2],u=n[6],d=n[10];switch(e){case"XYZ":this._y=Math.asin(Mt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Mt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(Mt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Mt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Mt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Mt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return Ve.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ve,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return We.setFromEuler(this),this.setFromQuaternion(We,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qe.DEFAULT_ORDER="XYZ";class je{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}isEnabled(t){return 0!=(this.mask&(1<<t|0))}}let Ye=0;const Je=new ae,Xe=new se,Ke=new Ue,$e=new ae,Ze=new ae,ti=new ae,ei=new se,ii=new ae(1,0,0),ni=new ae(0,1,0),ri=new ae(0,0,1),si={type:"added"},ai={type:"removed"};class oi extends Et{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ye++}),this.uuid=St(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=oi.DEFAULT_UP.clone();const t=new ae,e=new qe,i=new se,n=new ae(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ue},normalMatrix:{value:new Ft}}),this.matrix=new Ue,this.matrixWorld=new Ue,this.matrixAutoUpdate=oi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=oi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new je,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Xe.setFromAxisAngle(t,e),this.quaternion.multiply(Xe),this}rotateOnWorldAxis(t,e){return Xe.setFromAxisAngle(t,e),this.quaternion.premultiply(Xe),this}rotateX(t){return this.rotateOnAxis(ii,t)}rotateY(t){return this.rotateOnAxis(ni,t)}rotateZ(t){return this.rotateOnAxis(ri,t)}translateOnAxis(t,e){return Je.copy(t).applyQuaternion(this.quaternion),this.position.add(Je.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(ii,t)}translateY(t){return this.translateOnAxis(ni,t)}translateZ(t){return this.translateOnAxis(ri,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ke.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?$e.copy(t):$e.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),Ze.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ke.lookAt(Ze,$e,this.up):Ke.lookAt($e,Ze,this.up),this.quaternion.setFromRotationMatrix(Ke),n&&(Ke.extractRotation(n.matrixWorld),Xe.setFromRotationMatrix(Ke),this.quaternion.premultiply(Xe.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(si)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(ai)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(ai)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Ke.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ke.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ke),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e){let i=[];this[t]===e&&i.push(this);for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectsByProperty(t,e);r.length>0&&(i=i.concat(r))}return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ze,t,ti),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ze,ei,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){const n=e[i];!0!==n.matrixWorldAutoUpdate&&!0!==t||n.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){const i=t[e];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=s(t.geometries),n=s(t.materials),r=s(t.textures),a=s(t.images),o=s(t.shapes),l=s(t.skeletons),h=s(t.animations),c=s(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=n,i;function s(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}oi.DEFAULT_UP=new ae(0,1,0),oi.DEFAULT_MATRIX_AUTO_UPDATE=!0,oi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const li=new ae,hi=new ae,ci=new ae,ui=new ae,di=new ae,Ai=new ae,pi=new ae,mi=new ae,gi=new ae,fi=new ae;let vi=!1;class yi{constructor(t=new ae,e=new ae,i=new ae){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),li.subVectors(t,e),n.cross(li);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){li.subVectors(n,e),hi.subVectors(i,e),ci.subVectors(t,e);const s=li.dot(li),a=li.dot(hi),o=li.dot(ci),l=hi.dot(hi),h=hi.dot(ci),c=s*l-a*a;if(0===c)return r.set(-2,-1,-1);const u=1/c,d=(l*o-a*h)*u,A=(s*h-a*o)*u;return r.set(1-d-A,A,d)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,ui),ui.x>=0&&ui.y>=0&&ui.x+ui.y<=1}static getUV(t,e,i,n,r,s,a,o){return!1===vi&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),vi=!0),this.getInterpolation(t,e,i,n,r,s,a,o)}static getInterpolation(t,e,i,n,r,s,a,o){return this.getBarycoord(t,e,i,n,ui),o.setScalar(0),o.addScaledVector(r,ui.x),o.addScaledVector(s,ui.y),o.addScaledVector(a,ui.z),o}static isFrontFacing(t,e,i,n){return li.subVectors(i,e),hi.subVectors(t,e),li.cross(hi).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return li.subVectors(this.c,this.b),hi.subVectors(this.a,this.b),.5*li.cross(hi).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return yi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return yi.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return!1===vi&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),vi=!0),yi.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}getInterpolation(t,e,i,n,r){return yi.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return yi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return yi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let s,a;di.subVectors(n,i),Ai.subVectors(r,i),mi.subVectors(t,i);const o=di.dot(mi),l=Ai.dot(mi);if(o<=0&&l<=0)return e.copy(i);gi.subVectors(t,n);const h=di.dot(gi),c=Ai.dot(gi);if(h>=0&&c<=h)return e.copy(n);const u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return s=o/(o-h),e.copy(i).addScaledVector(di,s);fi.subVectors(t,r);const d=di.dot(fi),A=Ai.dot(fi);if(A>=0&&d<=A)return e.copy(r);const p=d*l-o*A;if(p<=0&&l>=0&&A<=0)return a=l/(l-A),e.copy(i).addScaledVector(Ai,a);const m=h*A-d*c;if(m<=0&&c-h>=0&&d-A>=0)return pi.subVectors(r,n),a=(c-h)/(c-h+(d-A)),e.copy(n).addScaledVector(pi,a);const g=1/(m+p+u);return s=p*g,a=u*g,e.copy(i).addScaledVector(di,s).addScaledVector(Ai,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let xi=0;class _i extends Et{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:xi++}),this.uuid=St(),this.name="",this.type="Material",this.blending=1,this.side=o,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=u,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vt,this.stencilZFail=vt,this.stencilZPass=vt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),this.side!==o&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(i.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}const Ei={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},wi={h:0,s:0,l:0},Ci={h:0,s:0,l:0};function Ii(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class bi{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=mt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Yt.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=Yt.workingColorSpace){return this.r=t,this.g=e,this.b=i,Yt.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=Yt.workingColorSpace){if(t=Bt(t,1),e=Mt(e,0,1),i=Mt(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Ii(r,n,t+1/3),this.g=Ii(r,n,t),this.b=Ii(r,n,t-1/3)}return Yt.toWorkingColorSpace(this,n),this}setStyle(t,e=mt){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=n[1],a=n[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,Yt.toWorkingColorSpace(this,e),i(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,Yt.toWorkingColorSpace(this,e),i(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const t=parseFloat(r[1])/360,n=parseFloat(r[2])/100,s=parseFloat(r[3])/100;return i(r[4]),this.setHSL(t,n,s,e)}break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(i,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=mt){const i=Ei[t.toLowerCase()];return void 0!==i?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ht(t.r),this.g=Ht(t.g),this.b=Ht(t.b),this}copyLinearToSRGB(t){return this.r=zt(t.r),this.g=zt(t.g),this.b=zt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=mt){return Yt.fromWorkingColorSpace(Si.copy(this),t),Mt(255*Si.r,0,255)<<16^Mt(255*Si.g,0,255)<<8^Mt(255*Si.b,0,255)<<0}getHexString(t=mt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Yt.workingColorSpace){Yt.fromWorkingColorSpace(Si.copy(this),e);const i=Si.r,n=Si.g,r=Si.b,s=Math.max(i,n,r),a=Math.min(i,n,r);let o,l;const h=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=h<=.5?t/(s+a):t/(2-s-a),s){case i:o=(n-r)/t+(n<r?6:0);break;case n:o=(r-i)/t+2;break;case r:o=(i-n)/t+4}o/=6}return t.h=o,t.s=l,t.l=h,t}getRGB(t,e=Yt.workingColorSpace){return Yt.fromWorkingColorSpace(Si.copy(this),e),t.r=Si.r,t.g=Si.g,t.b=Si.b,t}getStyle(t=mt){Yt.fromWorkingColorSpace(Si.copy(this),t);const e=Si.r,i=Si.g,n=Si.b;return t!==mt?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${255*e|0},${255*i|0},${255*n|0})`}offsetHSL(t,e,i){return this.getHSL(wi),wi.h+=t,wi.s+=e,wi.l+=i,this.setHSL(wi.h,wi.s,wi.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(wi),t.getHSL(Ci);const i=Tt(wi.h,Ci.h,e),n=Tt(wi.s,Ci.s,e),r=Tt(wi.l,Ci.l,e);return this.setHSL(i,n,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*n,this.g=r[1]*e+r[4]*i+r[7]*n,this.b=r[2]*e+r[5]*i+r[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Si=new bi;bi.NAMES=Ei;class Mi extends _i{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new bi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=d,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Bi=Ti();function Ti(){const t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),n=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(n[t]=0,n[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(n[t]=1024>>-e-14,n[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(n[t]=e+15<<10,n[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(n[t]=31744,n[256|t]=64512,r[t]=24,r[256|t]=24):(n[t]=31744,n[256|t]=64512,r[t]=13,r[256|t]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;0==(8388608&e);)e<<=1,i-=8388608;e&=-8388609,i+=947912704,s[t]=e|i}for(let t=1024;t<2048;++t)s[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}const Ri={toHalfFloat:function(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Mt(t,-65504,65504),Bi.floatView[0]=t;const e=Bi.uint32View[0],i=e>>23&511;return Bi.baseTable[i]+((8388607&e)>>Bi.shiftTable[i])},fromHalfFloat:function(t){const e=t>>10;return Bi.uint32View[0]=Bi.mantissaTable[Bi.offsetTable[e]+(1023&t)]+Bi.exponentTable[e],Bi.floatView[0]}},Li=new ae,Di=new Nt;class Qi{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=yt,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Di.fromBufferAttribute(this,e),Di.applyMatrix3(t),this.setXY(e,Di.x,Di.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Li.fromBufferAttribute(this,e),Li.applyMatrix3(t),this.setXYZ(e,Li.x,Li.y,Li.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Li.fromBufferAttribute(this,e),Li.applyMatrix4(t),this.setXYZ(e,Li.x,Li.y,Li.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Li.fromBufferAttribute(this,e),Li.applyNormalMatrix(t),this.setXYZ(e,Li.x,Li.y,Li.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Li.fromBufferAttribute(this,e),Li.transformDirection(t),this.setXYZ(e,Li.x,Li.y,Li.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Qt(e,this.array)),e}setX(t,e){return this.normalized&&(e=Pt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Qt(e,this.array)),e}setY(t,e){return this.normalized&&(e=Pt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Qt(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Pt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Qt(e,this.array)),e}setW(t,e){return this.normalized&&(e=Pt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Pt(e,this.array),i=Pt(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=Pt(e,this.array),i=Pt(i,this.array),n=Pt(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.normalized&&(e=Pt(e,this.array),i=Pt(i,this.array),n=Pt(n,this.array),r=Pt(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==yt&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class Pi extends Qi{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Ui extends Qi{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class Ni extends Qi{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Fi=0;const ki=new Ue,Oi=new oi,Gi=new ae,Hi=new he,zi=new he,Vi=new ae;class Wi extends Et{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Fi++}),this.uuid=St(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Ot(t)?Ui:Pi)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new Ft).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return ki.makeRotationFromQuaternion(t),this.applyMatrix4(ki),this}rotateX(t){return ki.makeRotationX(t),this.applyMatrix4(ki),this}rotateY(t){return ki.makeRotationY(t),this.applyMatrix4(ki),this}rotateZ(t){return ki.makeRotationZ(t),this.applyMatrix4(ki),this}translate(t,e,i){return ki.makeTranslation(t,e,i),this.applyMatrix4(ki),this}scale(t,e,i){return ki.makeScale(t,e,i),this.applyMatrix4(ki),this}lookAt(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gi).negate(),this.translate(Gi.x,Gi.y,Gi.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new Ni(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new he);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new ae(-1/0,-1/0,-1/0),new ae(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Hi.setFromBufferAttribute(i),this.morphTargetsRelative?(Vi.addVectors(this.boundingBox.min,Hi.min),this.boundingBox.expandByPoint(Vi),Vi.addVectors(this.boundingBox.max,Hi.max),this.boundingBox.expandByPoint(Vi)):(this.boundingBox.expandByPoint(Hi.min),this.boundingBox.expandByPoint(Hi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Se);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new ae,1/0);if(t){const i=this.boundingSphere.center;if(Hi.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];zi.setFromBufferAttribute(i),this.morphTargetsRelative?(Vi.addVectors(Hi.min,zi.min),Hi.expandByPoint(Vi),Vi.addVectors(Hi.max,zi.max),Hi.expandByPoint(Vi)):(Hi.expandByPoint(zi.min),Hi.expandByPoint(zi.max))}Hi.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)Vi.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Vi));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],a=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)Vi.fromBufferAttribute(s,e),a&&(Gi.fromBufferAttribute(t,e),Vi.add(Gi)),n=Math.max(n,i.distanceToSquared(Vi))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,s=e.uv.array,a=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Qi(new Float32Array(4*a),4));const o=this.getAttribute("tangent").array,l=[],h=[];for(let t=0;t<a;t++)l[t]=new ae,h[t]=new ae;const c=new ae,u=new ae,d=new ae,A=new Nt,p=new Nt,m=new Nt,g=new ae,f=new ae;function v(t,e,i){c.fromArray(n,3*t),u.fromArray(n,3*e),d.fromArray(n,3*i),A.fromArray(s,2*t),p.fromArray(s,2*e),m.fromArray(s,2*i),u.sub(c),d.sub(c),p.sub(A),m.sub(A);const r=1/(p.x*m.y-m.x*p.y);isFinite(r)&&(g.copy(u).multiplyScalar(m.y).addScaledVector(d,-p.y).multiplyScalar(r),f.copy(d).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(r),l[t].add(g),l[e].add(g),l[i].add(g),h[t].add(f),h[e].add(f),h[i].add(f))}let y=this.groups;0===y.length&&(y=[{start:0,count:i.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)v(i[t+0],i[t+1],i[t+2])}const x=new ae,_=new ae,E=new ae,w=new ae;function C(t){E.fromArray(r,3*t),w.copy(E);const e=l[t];x.copy(e),x.sub(E.multiplyScalar(E.dot(e))).normalize(),_.crossVectors(w,e);const i=_.dot(h[t])<0?-1:1;o[4*t]=x.x,o[4*t+1]=x.y,o[4*t+2]=x.z,o[4*t+3]=i}for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)C(i[t+0]),C(i[t+1]),C(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Qi(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new ae,r=new ae,s=new ae,a=new ae,o=new ae,l=new ae,h=new ae,c=new ae;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),A=t.getX(u+1),p=t.getX(u+2);n.fromBufferAttribute(e,d),r.fromBufferAttribute(e,A),s.fromBufferAttribute(e,p),h.subVectors(s,r),c.subVectors(n,r),h.cross(c),a.fromBufferAttribute(i,d),o.fromBufferAttribute(i,A),l.fromBufferAttribute(i,p),a.add(h),o.add(h),l.add(h),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(A,o.x,o.y,o.z),i.setXYZ(p,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),h.subVectors(s,r),c.subVectors(n,r),h.cross(c),i.setXYZ(t+0,h.x,h.y,h.z),i.setXYZ(t+1,h.x,h.y,h.z),i.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Vi.fromBufferAttribute(t,e),Vi.normalize(),t.setXYZ(e,Vi.x,Vi.y,Vi.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,s=new i.constructor(e.length*n);let a=0,o=0;for(let r=0,l=e.length;r<l;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)s[o++]=i[a++]}return new Qi(s,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Wi,i=this.index.array,n=this.attributes;for(const r in n){const s=t(n[r],i);e.setAttribute(r,s)}const r=this.morphAttributes;for(const n in r){const s=[],a=r[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);s.push(n)}e.morphAttributes[n]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,i=s.length;t<i;t++){const i=s[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],s=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];s.push(n.toJSON(t.data))}s.length>0&&(n[e]=s,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const qi=new Ue,ji=new Pe,Yi=new Se,Ji=new ae,Xi=new ae,Ki=new ae,$i=new ae,Zi=new ae,tn=new ae,en=new Nt,nn=new Nt,rn=new Nt,sn=new ae,an=new ae,on=new ae,ln=new ae,hn=new ae;class cn extends oi{constructor(t=new Wi,e=new Mi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,s=i.morphTargetsRelative;e.fromBufferAttribute(n,t);const a=this.morphTargetInfluences;if(r&&a){tn.set(0,0,0);for(let i=0,n=r.length;i<n;i++){const n=a[i],o=r[i];0!==n&&(Zi.fromBufferAttribute(o,t),s?tn.addScaledVector(Zi,n):tn.addScaledVector(Zi.sub(e),n))}e.add(tn)}return this.isSkinnedMesh&&this.applyBoneTransform(t,e),e}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),Yi.copy(i.boundingSphere),Yi.applyMatrix4(r),ji.copy(t.ray).recast(t.near),!1===Yi.containsPoint(ji.origin)){if(null===ji.intersectSphere(Yi,Ji))return;if(ji.origin.distanceToSquared(Ji)>(t.far-t.near)**2)return}if(qi.copy(r).invert(),ji.copy(t.ray).applyMatrix4(qi),null!==i.boundingBox&&!1===ji.intersectsBox(i.boundingBox))return;let s;const a=i.index,o=i.attributes.position,l=i.attributes.uv,h=i.attributes.uv2,c=i.attributes.normal,u=i.groups,d=i.drawRange;if(null!==a)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],o=n[r.materialIndex];for(let i=Math.max(r.start,d.start),n=Math.min(a.count,Math.min(r.start+r.count,d.start+d.count));i<n;i+=3){const n=a.getX(i),u=a.getX(i+1),d=a.getX(i+2);s=un(this,o,t,ji,l,h,c,n,u,d),s&&(s.faceIndex=Math.floor(i/3),s.face.materialIndex=r.materialIndex,e.push(s))}}else{for(let i=Math.max(0,d.start),r=Math.min(a.count,d.start+d.count);i<r;i+=3){const r=a.getX(i),o=a.getX(i+1),u=a.getX(i+2);s=un(this,n,t,ji,l,h,c,r,o,u),s&&(s.faceIndex=Math.floor(i/3),e.push(s))}}else if(void 0!==o)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],a=n[r.materialIndex];for(let i=Math.max(r.start,d.start),n=Math.min(o.count,Math.min(r.start+r.count,d.start+d.count));i<n;i+=3){s=un(this,a,t,ji,l,h,c,i,i+1,i+2),s&&(s.faceIndex=Math.floor(i/3),s.face.materialIndex=r.materialIndex,e.push(s))}}else{for(let i=Math.max(0,d.start),r=Math.min(o.count,d.start+d.count);i<r;i+=3){s=un(this,n,t,ji,l,h,c,i,i+1,i+2),s&&(s.faceIndex=Math.floor(i/3),e.push(s))}}}}function un(t,e,i,n,r,s,a,h,c,u){t.getVertexPosition(h,Xi),t.getVertexPosition(c,Ki),t.getVertexPosition(u,$i);const d=function(t,e,i,n,r,s,a,h){let c;if(c=e.side===l?n.intersectTriangle(a,s,r,!0,h):n.intersectTriangle(r,s,a,e.side===o,h),null===c)return null;hn.copy(h),hn.applyMatrix4(t.matrixWorld);const u=i.ray.origin.distanceTo(hn);return u<i.near||u>i.far?null:{distance:u,point:hn.clone(),object:t}}(t,e,i,n,Xi,Ki,$i,ln);if(d){r&&(en.fromBufferAttribute(r,h),nn.fromBufferAttribute(r,c),rn.fromBufferAttribute(r,u),d.uv=yi.getInterpolation(ln,Xi,Ki,$i,en,nn,rn,new Nt)),s&&(en.fromBufferAttribute(s,h),nn.fromBufferAttribute(s,c),rn.fromBufferAttribute(s,u),d.uv2=yi.getInterpolation(ln,Xi,Ki,$i,en,nn,rn,new Nt)),a&&(sn.fromBufferAttribute(a,h),an.fromBufferAttribute(a,c),on.fromBufferAttribute(a,u),d.normal=yi.getInterpolation(ln,Xi,Ki,$i,sn,an,on,new ae),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const t={a:h,b:c,c:u,normal:new ae,materialIndex:0};yi.getNormal(Xi,Ki,$i,t.normal),d.face=t}return d}class dn extends Wi{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};const a=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],h=[],c=[];let u=0,d=0;function A(t,e,i,n,r,s,A,p,m,g,f){const v=s/m,y=A/g,x=s/2,_=A/2,E=p/2,w=m+1,C=g+1;let I=0,b=0;const S=new ae;for(let s=0;s<C;s++){const a=s*y-_;for(let o=0;o<w;o++){const u=o*v-x;S[t]=u*n,S[e]=a*r,S[i]=E,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[i]=p>0?1:-1,h.push(S.x,S.y,S.z),c.push(o/m),c.push(1-s/g),I+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const i=u+e+w*t,n=u+e+w*(t+1),r=u+(e+1)+w*(t+1),s=u+(e+1)+w*t;o.push(i,n,s),o.push(n,r,s),b+=6}a.addGroup(d,b,f),d+=b,u+=I}A("z","y","x",-1,-1,i,e,t,s,r,0),A("z","y","x",1,-1,i,e,-t,s,r,1),A("x","z","y",1,1,t,i,e,n,s,2),A("x","z","y",1,-1,t,i,-e,n,s,3),A("x","y","z",1,-1,t,e,i,n,r,4),A("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new Ni(l,3)),this.setAttribute("normal",new Ni(h,3)),this.setAttribute("uv",new Ni(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new dn(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function An(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][n]=null):e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function pn(t){const e={};for(let i=0;i<t.length;i++){const n=An(t[i]);for(const t in n)e[t]=n[t]}return e}function mn(t){return null===t.getRenderTarget()&&t.outputEncoding===At?mt:gt}const gn={clone:An,merge:pn};class fn extends _i{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=An(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class vn extends oi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ue,this.projectionMatrix=new Ue,this.projectionMatrixInverse=new Ue}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class yn extends vn{constructor(t=50,e=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*bt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*It*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*bt*Math.atan(Math.tan(.5*It*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*It*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*n/t,e-=s.offsetY*i/a,n*=s.width/t,i*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const xn=-90;class _n extends oi{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i;const n=new yn(xn,1,t,e);n.layers=this.layers,n.up.set(0,1,0),n.lookAt(1,0,0),this.add(n);const r=new yn(xn,1,t,e);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const s=new yn(xn,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(0,1,0),this.add(s);const a=new yn(xn,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const o=new yn(xn,1,t,e);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);const l=new yn(xn,1,t,e);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,r,s,a,o,l]=this.children,h=t.getRenderTarget(),c=t.toneMapping,u=t.xr.enabled;t.toneMapping=m,t.xr.enabled=!1;const d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,s),t.setRenderTarget(i,3),t.render(e,a),t.setRenderTarget(i,4),t.render(e,o),i.texture.generateMipmaps=d,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(h),t.toneMapping=c,t.xr.enabled=u,i.texture.needsPMREMUpdate=!0}}class En extends te{constructor(t,e,i,n,r,s,a,o,l,h){super(t=void 0!==t?t:[],e=void 0!==e?e:_,i,n,r,s,a,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class wn extends ie{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];this.texture=new En(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:R}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new dn(5,5,5),r=new fn({name:"CubemapFromEquirect",uniforms:An(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:l,blending:c});r.uniforms.tEquirect.value=e;const s=new cn(n,r),a=e.minFilter;e.minFilter===D&&(e.minFilter=R);return new _n(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}const Cn=new ae,In=new ae,bn=new Ft;class Sn{constructor(t=new ae(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=Cn.subVectors(i,e).cross(In.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(Cn),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||bn.getNormalMatrix(t),n=this.coplanarPoint(Cn).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Mn=new Se,Bn=new ae;class Tn{constructor(t=new Sn,e=new Sn,i=new Sn,n=new Sn,r=new Sn,s=new Sn){this.planes=[t,e,i,n,r,s]}set(t,e,i,n,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],s=i[2],a=i[3],o=i[4],l=i[5],h=i[6],c=i[7],u=i[8],d=i[9],A=i[10],p=i[11],m=i[12],g=i[13],f=i[14],v=i[15];return e[0].setComponents(a-n,c-o,p-u,v-m).normalize(),e[1].setComponents(a+n,c+o,p+u,v+m).normalize(),e[2].setComponents(a+r,c+l,p+d,v+g).normalize(),e[3].setComponents(a-r,c-l,p-d,v-g).normalize(),e[4].setComponents(a-s,c-h,p-A,v-f).normalize(),e[5].setComponents(a+s,c+h,p+A,v+f).normalize(),this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Mn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Mn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Mn)}intersectsSprite(t){return Mn.center.set(0,0,0),Mn.radius=.7071067811865476,Mn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Mn)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(Bn.x=n.normal.x>0?t.max.x:t.min.x,Bn.y=n.normal.y>0?t.max.y:t.min.y,Bn.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Bn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Rn(){let t=null,e=!1,i=null,n=null;function r(e,s){i(e,s),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Ln(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const s=n.get(e);void 0===s?n.set(e,function(e,n){const r=e.array,s=e.usage,a=t.createBuffer();let o;if(t.bindBuffer(n,a),t.bufferData(n,r,s),e.onUploadCallback(),r instanceof Float32Array)o=5126;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!i)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");o=5131}else o=5123;else if(r instanceof Int16Array)o=5122;else if(r instanceof Uint32Array)o=5125;else if(r instanceof Int32Array)o=5124;else if(r instanceof Int8Array)o=5120;else if(r instanceof Uint8Array)o=5121;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);o=5121}return{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):s.version<e.version&&(!function(e,n,r){const s=n.array,a=n.updateRange;t.bindBuffer(r,e),-1===a.count?t.bufferSubData(r,0,s):(i?t.bufferSubData(r,a.offset*s.BYTES_PER_ELEMENT,s,a.offset,a.count):t.bufferSubData(r,a.offset*s.BYTES_PER_ELEMENT,s.subarray(a.offset,a.offset+a.count)),a.count=-1),n.onUploadCallback()}(s.buffer,e,r),s.version=e.version)}}}class Dn extends Wi{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,s=e/2,a=Math.floor(i),o=Math.floor(n),l=a+1,h=o+1,c=t/a,u=e/o,d=[],A=[],p=[],m=[];for(let t=0;t<h;t++){const e=t*u-s;for(let i=0;i<l;i++){const n=i*c-r;A.push(n,-e,0),p.push(0,0,1),m.push(i/a),m.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;d.push(i,n,s),d.push(n,r,s)}this.setIndex(d),this.setAttribute("position",new Ni(A,3)),this.setAttribute("normal",new Ni(p,3)),this.setAttribute("uv",new Ni(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Dn(t.width,t.height,t.widthSegments,t.heightSegments)}}const Qn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660,  0.0556434,\n\t\t-1.5371385,  1.8760108, -0.2040259,\n\t\t-0.4985314,  0.0415560,  1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n    float x2 = x * x;\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_NORMALMAP_TANGENTSPACE\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(  1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,  1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,  1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, vec2 fullSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\t\n\t\tvec2 lodFudge = pow( 1.95, lod ) / fullSize;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec2 fullSize = vec2( textureSize( sampler, 0 ) );\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_UV2\n\tattribute vec2 uv2;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Pn={common:{diffuse:{value:new bi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ft}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ft}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ft}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ft},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ft},normalScale:{value:new Nt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ft},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ft}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ft}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ft}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new bi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new bi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ft}},sprite:{diffuse:{value:new bi(16777215)},opacity:{value:1},center:{value:new Nt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaTest:{value:0}}},Un={basic:{uniforms:pn([Pn.common,Pn.specularmap,Pn.envmap,Pn.aomap,Pn.lightmap,Pn.fog]),vertexShader:Qn.meshbasic_vert,fragmentShader:Qn.meshbasic_frag},lambert:{uniforms:pn([Pn.common,Pn.specularmap,Pn.envmap,Pn.aomap,Pn.lightmap,Pn.emissivemap,Pn.bumpmap,Pn.normalmap,Pn.displacementmap,Pn.fog,Pn.lights,{emissive:{value:new bi(0)}}]),vertexShader:Qn.meshlambert_vert,fragmentShader:Qn.meshlambert_frag},phong:{uniforms:pn([Pn.common,Pn.specularmap,Pn.envmap,Pn.aomap,Pn.lightmap,Pn.emissivemap,Pn.bumpmap,Pn.normalmap,Pn.displacementmap,Pn.fog,Pn.lights,{emissive:{value:new bi(0)},specular:{value:new bi(1118481)},shininess:{value:30}}]),vertexShader:Qn.meshphong_vert,fragmentShader:Qn.meshphong_frag},standard:{uniforms:pn([Pn.common,Pn.envmap,Pn.aomap,Pn.lightmap,Pn.emissivemap,Pn.bumpmap,Pn.normalmap,Pn.displacementmap,Pn.roughnessmap,Pn.metalnessmap,Pn.fog,Pn.lights,{emissive:{value:new bi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qn.meshphysical_vert,fragmentShader:Qn.meshphysical_frag},toon:{uniforms:pn([Pn.common,Pn.aomap,Pn.lightmap,Pn.emissivemap,Pn.bumpmap,Pn.normalmap,Pn.displacementmap,Pn.gradientmap,Pn.fog,Pn.lights,{emissive:{value:new bi(0)}}]),vertexShader:Qn.meshtoon_vert,fragmentShader:Qn.meshtoon_frag},matcap:{uniforms:pn([Pn.common,Pn.bumpmap,Pn.normalmap,Pn.displacementmap,Pn.fog,{matcap:{value:null}}]),vertexShader:Qn.meshmatcap_vert,fragmentShader:Qn.meshmatcap_frag},points:{uniforms:pn([Pn.points,Pn.fog]),vertexShader:Qn.points_vert,fragmentShader:Qn.points_frag},dashed:{uniforms:pn([Pn.common,Pn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qn.linedashed_vert,fragmentShader:Qn.linedashed_frag},depth:{uniforms:pn([Pn.common,Pn.displacementmap]),vertexShader:Qn.depth_vert,fragmentShader:Qn.depth_frag},normal:{uniforms:pn([Pn.common,Pn.bumpmap,Pn.normalmap,Pn.displacementmap,{opacity:{value:1}}]),vertexShader:Qn.meshnormal_vert,fragmentShader:Qn.meshnormal_frag},sprite:{uniforms:pn([Pn.sprite,Pn.fog]),vertexShader:Qn.sprite_vert,fragmentShader:Qn.sprite_frag},background:{uniforms:{uvTransform:{value:new Ft},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qn.background_vert,fragmentShader:Qn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Qn.backgroundCube_vert,fragmentShader:Qn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qn.cube_vert,fragmentShader:Qn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qn.equirect_vert,fragmentShader:Qn.equirect_frag},distanceRGBA:{uniforms:pn([Pn.common,Pn.displacementmap,{referencePosition:{value:new ae},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qn.distanceRGBA_vert,fragmentShader:Qn.distanceRGBA_frag},shadow:{uniforms:pn([Pn.lights,Pn.fog,{color:{value:new bi(0)},opacity:{value:1}}]),vertexShader:Qn.shadow_vert,fragmentShader:Qn.shadow_frag}};Un.physical={uniforms:pn([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ft},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ft},clearcoatNormalScale:{value:new Nt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ft},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ft},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ft},sheen:{value:0},sheenColor:{value:new bi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ft},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ft},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ft},transmissionSamplerSize:{value:new Nt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ft},attenuationDistance:{value:0},attenuationColor:{value:new bi(0)},specularColor:{value:new bi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ft},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ft}}]),vertexShader:Qn.meshphysical_vert,fragmentShader:Qn.meshphysical_frag};const Nn={r:0,b:0,g:0};function Fn(t,e,i,n,r,s,a){const h=new bi(0);let c,u,d=!0===s?0:1,A=null,p=0,m=null;function g(e,i){e.getRGB(Nn,mn(t)),n.buffers.color.setClear(Nn.r,Nn.g,Nn.b,i,a)}return{getClearColor:function(){return h},setClearColor:function(t,e=1){h.set(t),d=e,g(h,d)},getClearAlpha:function(){return d},setClearAlpha:function(t){d=t,g(h,d)},render:function(n,s){let a=!1,f=!0===s.isScene?s.background:null;if(f&&f.isTexture){f=(s.backgroundBlurriness>0?i:e).get(f)}const v=t.xr,y=v.getSession&&v.getSession();y&&"additive"===y.environmentBlendMode&&(f=null),null===f?g(h,d):f&&f.isColor&&(g(f,1),a=!0),(t.autoClear||a)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.mapping===C)?(void 0===u&&(u=new cn(new dn(1,1,1),new fn({name:"BackgroundCubeMaterial",uniforms:An(Un.backgroundCube.uniforms),vertexShader:Un.backgroundCube.vertexShader,fragmentShader:Un.backgroundCube.fragmentShader,side:l,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=f,u.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=s.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=s.backgroundIntensity,u.material.toneMapped=f.encoding!==At,A===f&&p===f.version&&m===t.toneMapping||(u.material.needsUpdate=!0,A=f,p=f.version,m=t.toneMapping),u.layers.enableAll(),n.unshift(u,u.geometry,u.material,0,0,null)):f&&f.isTexture&&(void 0===c&&(c=new cn(new Dn(2,2),new fn({name:"BackgroundMaterial",uniforms:An(Un.background.uniforms),vertexShader:Un.background.vertexShader,fragmentShader:Un.background.fragmentShader,side:o,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=f,c.material.uniforms.backgroundIntensity.value=s.backgroundIntensity,c.material.toneMapped=f.encoding!==At,!0===f.matrixAutoUpdate&&f.updateMatrix(),c.material.uniforms.uvTransform.value.copy(f.matrix),A===f&&p===f.version&&m===t.toneMapping||(c.material.needsUpdate=!0,A=f,p=f.version,m=t.toneMapping),c.layers.enableAll(),n.unshift(c,c.geometry,c.material,0,0,null))}}}function kn(t,e,i,n){const r=t.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||null!==s,o={},l=A(null);let h=l,c=!1;function u(e){return n.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function d(e){return n.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function A(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function p(){const t=h.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function m(t){g(t,0)}function g(i,r){const s=h.newAttributes,a=h.enabledAttributes,o=h.attributeDivisors;if(s[i]=1,0===a[i]&&(t.enableVertexAttribArray(i),a[i]=1),o[i]!==r){(n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),o[i]=r}}function f(){const e=h.newAttributes,i=h.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function v(e,i,r,s,a,o){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,s,a,o):t.vertexAttribIPointer(e,i,r,a,o)}function y(){x(),c=!0,h!==l&&(h=l,u(h.object))}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,d,y,x){let _=!1;if(a){const e=function(e,i,r){const a=!0===r.wireframe;let l=o[e.id];void 0===l&&(l={},o[e.id]=l);let h=l[i.id];void 0===h&&(h={},l[i.id]=h);let c=h[a];void 0===c&&(c=A(n.isWebGL2?t.createVertexArray():s.createVertexArrayOES()),h[a]=c);return c}(y,d,l);h!==e&&(h=e,u(h.object)),_=function(t,e,i,n){const r=h.attributes,s=e.attributes;let a=0;const o=i.getAttributes();for(const e in o){if(o[e].location>=0){const i=r[e];let n=s[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;a++}}return h.attributesNum!==a||h.index!==n}(r,y,d,x),_&&function(t,e,i,n){const r={},s=e.attributes;let a=0;const o=i.getAttributes();for(const e in o){if(o[e].location>=0){let i=s[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[e]=n,a++}}h.attributes=r,h.attributesNum=a,h.index=n}(r,y,d,x)}else{const t=!0===l.wireframe;h.geometry===y.id&&h.program===d.id&&h.wireframe===t||(h.geometry=y.id,h.program=d.id,h.wireframe=t,_=!0)}null!==x&&i.update(x,34963),(_||c)&&(c=!1,function(r,s,a,o){if(!1===n.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=o.attributes,h=a.getAttributes(),c=s.defaultAttributeValues;for(const e in h){const n=h[e];if(n.location>=0){let s=l[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const e=s.normalized,a=s.itemSize,l=i.get(s);if(void 0===l)continue;const h=l.buffer,c=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const i=s.data,l=i.stride,d=s.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t<n.locationSize;t++)g(n.location+t,i.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<n.locationSize;t++)m(n.location+t);t.bindBuffer(34962,h);for(let t=0;t<n.locationSize;t++)v(n.location+t,a/n.locationSize,c,e,l*u,(d+a/n.locationSize*t)*u)}else{if(s.isInstancedBufferAttribute){for(let t=0;t<n.locationSize;t++)g(n.location+t,s.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let t=0;t<n.locationSize;t++)m(n.location+t);t.bindBuffer(34962,h);for(let t=0;t<n.locationSize;t++)v(n.location+t,a/n.locationSize,c,e,a*u,a/n.locationSize*t*u)}}else if(void 0!==c){const i=c[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n.location,i);break;case 3:t.vertexAttrib3fv(n.location,i);break;case 4:t.vertexAttrib4fv(n.location,i);break;default:t.vertexAttrib1fv(n.location,i)}}}}f()}(r,l,d,y),null!==x&&t.bindBuffer(34963,i.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){y();for(const t in o){const e=o[t];for(const t in e){const i=e[t];for(const t in i)d(i[t].object),delete i[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;const e=o[t.id];for(const t in e){const i=e[t];for(const t in i)d(i[t].object),delete i[t];delete e[t]}delete o[t.id]},releaseStatesOfProgram:function(t){for(const e in o){const i=o[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)d(n[t].object),delete n[t];delete i[t.id]}},initAttributes:p,enableAttribute:m,disableUnusedAttributes:f}}function On(t,e,i,n){const r=n.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,n){t.drawArrays(s,e,n),i.update(n,s,1)},this.renderInstances=function(n,a,o){if(0===o)return;let l,h;if(r)l=t,h="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[h](s,n,a,o),i.update(a,s,o)}}function Gn(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name;let a=void 0!==i.precision?i.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,c=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),A=t.getParameter(34076),p=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),f=t.getParameter(36349),v=u>0,y=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:A,maxAttributes:p,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:f,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:s?t.getParameter(36183):0}}function Hn(t){const e=this;let i=null,n=0,r=!1,s=!1;const a=new Sn,o=new Ft,l={value:null,needsUpdate:!1};function h(t,i,n,r){const s=null!==t?t.length:0;let h=null;if(0!==s){if(h=l.value,!0!==r||null===h){const e=n+4*s,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length<e)&&(h=new Float32Array(e));for(let e=0,i=n;e!==s;++e,i+=4)a.copy(t[e]).applyMatrix4(r,o),a.normal.toArray(h,i),h[i+3]=a.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const i=0!==t.length||e||0!==n||r;return r=e,n=t.length,i},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){i=h(t,e,0)},this.setState=function(a,o,c){const u=a.clippingPlanes,d=a.clipIntersection,A=a.clipShadows,p=t.get(a);if(!r||null===u||0===u.length||s&&!A)s?h(null):function(){l.value!==i&&(l.value=i,l.needsUpdate=n>0);e.numPlanes=n,e.numIntersection=0}();else{const t=s?0:n,e=4*t;let r=p.clippingState||null;l.value=r,r=h(u,o,e,c);for(let t=0;t!==e;++t)r[t]=i[t];p.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function zn(t){let e=new WeakMap;function i(t,e){return e===w?t.mapping=_:304===e&&(t.mapping=E),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const s=r.mapping;if(s===w||304===s){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const a=new wn(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",n),i(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class Vn extends vn{constructor(t=-1,e=1,i=1,n=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,s=i+t,a=n+e,o=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const Wn=4,qn=[.125,.215,.35,.446,.526,.582],jn=20,Yn=new Vn,Jn=new bi;let Xn=null;const Kn=(1+Math.sqrt(5))/2,$n=1/Kn,Zn=[new ae(1,1,1),new ae(-1,1,1),new ae(1,1,-1),new ae(-1,1,-1),new ae(0,Kn,$n),new ae(0,Kn,-$n),new ae($n,0,Kn),new ae(-$n,0,Kn),new ae(Kn,$n,0),new ae(-Kn,$n,0)];class tr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){Xn=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=rr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=nr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Xn),t.scissorTest=!1,ir(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===_||t.mapping===E?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Xn=this._renderer.getRenderTarget();const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:R,minFilter:R,generateMipmaps:!1,type:N,format:k,encoding:dt,depthBuffer:!1},n=er(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=er(t,e,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let r=t;const s=t-Wn+1+qn.length;for(let a=0;a<s;a++){const s=Math.pow(2,r);i.push(s);let o=1/s;a>t-Wn?o=qn[a-t+Wn-1]:0===a&&(o=0),n.push(o);const l=1/(s-2),h=-l,c=1+l,u=[h,h,c,h,c,c,h,h,c,c,h,c],d=6,A=6,p=3,m=2,g=1,f=new Float32Array(p*A*d),v=new Float32Array(m*A*d),y=new Float32Array(g*A*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];f.set(n,p*A*t),v.set(u,m*A*t);const r=[t,t,t,t,t,t];y.set(r,g*A*t)}const x=new Wi;x.setAttribute("position",new Qi(f,p)),x.setAttribute("uv",new Qi(v,m)),x.setAttribute("faceIndex",new Qi(y,g)),e.push(x),r>Wn&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(jn),r=new ae(0,1,0),s=new fn({name:"SphericalGaussianBlur",defines:{n:jn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:sr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:c,depthTest:!1,depthWrite:!1});return s}(n,t,e)}return n}_compileMaterial(t){const e=new cn(this._lodPlanes[0],t);this._renderer.compile(e,Yn)}_sceneToCubeUV(t,e,i,n){const r=new yn(90,1,e,i),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,h=o.autoClear,c=o.toneMapping;o.getClearColor(Jn),o.toneMapping=m,o.autoClear=!1;const u=new Mi({name:"PMREM.Background",side:l,depthWrite:!1,depthTest:!1}),d=new cn(new dn,u);let A=!1;const p=t.background;p?p.isColor&&(u.color.copy(p),t.background=null,A=!0):(u.color.copy(Jn),A=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(r.up.set(0,s[e],0),r.lookAt(a[e],0,0)):1===i?(r.up.set(0,0,s[e]),r.lookAt(0,a[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,a[e]));const l=this._cubeSize;ir(n,i*l,e>2?l:0,l,l),o.setRenderTarget(n),A&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=c,o.autoClear=h,t.background=p}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===_||t.mapping===E;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=rr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=nr());const r=n?this._cubemapMaterial:this._equirectMaterial,s=new cn(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const a=this._cubeSize;ir(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(s,Yn)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),n=Zn[(e-1)%Zn.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,i,n,"latitudinal",r),this._halfBlur(s,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,s,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const h=new cn(this._lodPlanes[n],l),c=l.uniforms,u=this._sizeLods[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/(2*jn-1),A=r/d,p=isFinite(r)?1+Math.floor(3*A):jn;p>jn&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${jn}`);const m=[];let g=0;for(let t=0;t<jn;++t){const e=t/A,i=Math.exp(-e*e/2);m.push(i),0===t?g+=i:t<p&&(g+=2*i)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;c.envMap.value=t.texture,c.samples.value=p,c.weights.value=m,c.latitudinal.value="latitudinal"===s,a&&(c.poleAxis.value=a);const{_lodMax:f}=this;c.dTheta.value=d,c.mipInt.value=f-i;const v=this._sizeLods[n];ir(e,3*v*(n>f-Wn?n-f+Wn:0),4*(this._cubeSize-v),3*v,2*v),o.setRenderTarget(e),o.render(h,Yn)}}function er(t,e,i){const n=new ie(t,e,i);return n.texture.mapping=C,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ir(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function nr(){return new fn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:sr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:c,depthTest:!1,depthWrite:!1})}function rr(){return new fn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:sr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:c,depthTest:!1,depthWrite:!1})}function sr(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function ar(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===w||304===s,o=s===_||s===E;if(a||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=e.get(r);return null===i&&(i=new tr(t)),n=a?i.fromEquirectangular(r,n):i.fromCubemap(r,n),e.set(r,n),n.texture}if(e.has(r))return e.get(r).texture;{const s=r.image;if(a&&s&&s.height>0||o&&s&&function(t){let e=0;const i=6;for(let n=0;n<i;n++)void 0!==t[n]&&e++;return e===i}(s)){null===i&&(i=new tr(t));const s=a?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,s),r.addEventListener("dispose",n),s.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function or(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function lr(t,e,i,n){const r={},s=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",a),delete r[o.id];const l=s.get(o);l&&(e.remove(l),s.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,r=t.attributes.position;let a=0;if(null!==n){const t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],s=t[e+2];i.push(n,r,r,s,s,n)}}else{const t=r.array;a=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const o=new(Ot(i)?Ui:Pi)(i,1);o.version=a;const l=s.get(t);l&&e.remove(l),s.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",a),r[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=s.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return s.get(t)}}}function hr(t,e,i,n){const r=n.isWebGL2;let s,a,o;this.setMode=function(t){s=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,n){t.drawElements(s,n,a,e*o),i.update(n,s,1)},this.renderInstances=function(n,l,h){if(0===h)return;let c,u;if(r)c=t,u="drawElementsInstanced";else if(c=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===c)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](s,l,a,n*o,h),i.update(l,s,h)}}function cr(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ur(t,e){return t[0]-e[0]}function dr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Ar(t,e,i){const n={},r=new Float32Array(8),s=new WeakMap,a=new ee,o=[];for(let t=0;t<8;t++)o[t]=[t,0];return{update:function(l,h,c){const u=l.morphTargetInfluences;if(!0===e.isWebGL2){const n=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,r=void 0!==n?n.length:0;let o=s.get(h);if(void 0===o||o.count!==r){void 0!==o&&o.texture.dispose();const t=void 0!==h.morphAttributes.position,i=void 0!==h.morphAttributes.normal,n=void 0!==h.morphAttributes.color,l=h.morphAttributes.position||[],c=h.morphAttributes.normal||[],u=h.morphAttributes.color||[];let d=0;!0===t&&(d=1),!0===i&&(d=2),!0===n&&(d=3);let A=h.attributes.position.count*d,p=1;A>e.maxTextureSize&&(p=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const m=new Float32Array(A*p*4*r),g=new ne(m,A,p,r);g.type=U,g.needsUpdate=!0;const f=4*d;for(let e=0;e<r;e++){const r=l[e],s=c[e],o=u[e],h=A*p*4*e;for(let e=0;e<r.count;e++){const l=e*f;!0===t&&(a.fromBufferAttribute(r,e),m[h+l+0]=a.x,m[h+l+1]=a.y,m[h+l+2]=a.z,m[h+l+3]=0),!0===i&&(a.fromBufferAttribute(s,e),m[h+l+4]=a.x,m[h+l+5]=a.y,m[h+l+6]=a.z,m[h+l+7]=0),!0===n&&(a.fromBufferAttribute(o,e),m[h+l+8]=a.x,m[h+l+9]=a.y,m[h+l+10]=a.z,m[h+l+11]=4===o.itemSize?a.w:1)}}o={count:r,texture:g,size:new Nt(A,p)},s.set(h,o),h.addEventListener("dispose",(function t(){g.dispose(),s.delete(h),h.removeEventListener("dispose",t)}))}let l=0;for(let t=0;t<u.length;t++)l+=u[t];const d=h.morphTargetsRelative?1:1-l;c.getUniforms().setValue(t,"morphTargetBaseInfluence",d),c.getUniforms().setValue(t,"morphTargetInfluences",u),c.getUniforms().setValue(t,"morphTargetsTexture",o.texture,i),c.getUniforms().setValue(t,"morphTargetsTextureSize",o.size)}else{const e=void 0===u?0:u.length;let i=n[h.id];if(void 0===i||i.length!==e){i=[];for(let t=0;t<e;t++)i[t]=[t,0];n[h.id]=i}for(let t=0;t<e;t++){const e=i[t];e[0]=t,e[1]=u[t]}i.sort(dr);for(let t=0;t<8;t++)t<e&&i[t][1]?(o[t][0]=i[t][0],o[t][1]=i[t][1]):(o[t][0]=Number.MAX_SAFE_INTEGER,o[t][1]=0);o.sort(ur);const s=h.morphAttributes.position,a=h.morphAttributes.normal;let l=0;for(let t=0;t<8;t++){const e=o[t],i=e[0],n=e[1];i!==Number.MAX_SAFE_INTEGER&&n?(s&&h.getAttribute("morphTarget"+t)!==s[i]&&h.setAttribute("morphTarget"+t,s[i]),a&&h.getAttribute("morphNormal"+t)!==a[i]&&h.setAttribute("morphNormal"+t,a[i]),r[t]=n,l+=n):(s&&!0===h.hasAttribute("morphTarget"+t)&&h.deleteAttribute("morphTarget"+t),a&&!0===h.hasAttribute("morphNormal"+t)&&h.deleteAttribute("morphNormal"+t),r[t]=0)}const d=h.morphTargetsRelative?1:1-l;c.getUniforms().setValue(t,"morphTargetBaseInfluence",d),c.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function pr(t,e,i,n){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const a=n.render.frame,o=t.geometry,l=e.get(t,o);return r.get(l)!==a&&(e.update(l),r.set(l,a)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",s)&&t.addEventListener("dispose",s),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}const mr=new te,gr=new ne,fr=new re,vr=new En,yr=[],xr=[],_r=new Float32Array(16),Er=new Float32Array(9),wr=new Float32Array(4);function Cr(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let s=yr[r];if(void 0===s&&(s=new Float32Array(r),yr[r]=s),0!==e){n.toArray(s,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(s,r)}return s}function Ir(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function br(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function Sr(t,e){let i=xr[e];void 0===i&&(i=new Int32Array(e),xr[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Mr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Br(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Ir(i,e))return;t.uniform2fv(this.addr,e),br(i,e)}}function Tr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Ir(i,e))return;t.uniform3fv(this.addr,e),br(i,e)}}function Rr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Ir(i,e))return;t.uniform4fv(this.addr,e),br(i,e)}}function Lr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Ir(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),br(i,e)}else{if(Ir(i,n))return;wr.set(n),t.uniformMatrix2fv(this.addr,!1,wr),br(i,n)}}function Dr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Ir(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),br(i,e)}else{if(Ir(i,n))return;Er.set(n),t.uniformMatrix3fv(this.addr,!1,Er),br(i,n)}}function Qr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Ir(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),br(i,e)}else{if(Ir(i,n))return;_r.set(n),t.uniformMatrix4fv(this.addr,!1,_r),br(i,n)}}function Pr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Ur(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Ir(i,e))return;t.uniform2iv(this.addr,e),br(i,e)}}function Nr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Ir(i,e))return;t.uniform3iv(this.addr,e),br(i,e)}}function Fr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Ir(i,e))return;t.uniform4iv(this.addr,e),br(i,e)}}function kr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Or(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Ir(i,e))return;t.uniform2uiv(this.addr,e),br(i,e)}}function Gr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Ir(i,e))return;t.uniform3uiv(this.addr,e),br(i,e)}}function Hr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Ir(i,e))return;t.uniform4uiv(this.addr,e),br(i,e)}}function zr(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2D(e||mr,r)}function Vr(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||fr,r)}function Wr(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||vr,r)}function qr(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||gr,r)}function jr(t,e){t.uniform1fv(this.addr,e)}function Yr(t,e){const i=Cr(e,this.size,2);t.uniform2fv(this.addr,i)}function Jr(t,e){const i=Cr(e,this.size,3);t.uniform3fv(this.addr,i)}function Xr(t,e){const i=Cr(e,this.size,4);t.uniform4fv(this.addr,i)}function Kr(t,e){const i=Cr(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function $r(t,e){const i=Cr(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Zr(t,e){const i=Cr(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function ts(t,e){t.uniform1iv(this.addr,e)}function es(t,e){t.uniform2iv(this.addr,e)}function is(t,e){t.uniform3iv(this.addr,e)}function ns(t,e){t.uniform4iv(this.addr,e)}function rs(t,e){t.uniform1uiv(this.addr,e)}function ss(t,e){t.uniform2uiv(this.addr,e)}function as(t,e){t.uniform3uiv(this.addr,e)}function os(t,e){t.uniform4uiv(this.addr,e)}function ls(t,e,i){const n=this.cache,r=e.length,s=Sr(i,r);Ir(n,s)||(t.uniform1iv(this.addr,s),br(n,s));for(let t=0;t!==r;++t)i.setTexture2D(e[t]||mr,s[t])}function hs(t,e,i){const n=this.cache,r=e.length,s=Sr(i,r);Ir(n,s)||(t.uniform1iv(this.addr,s),br(n,s));for(let t=0;t!==r;++t)i.setTexture3D(e[t]||fr,s[t])}function cs(t,e,i){const n=this.cache,r=e.length,s=Sr(i,r);Ir(n,s)||(t.uniform1iv(this.addr,s),br(n,s));for(let t=0;t!==r;++t)i.setTextureCube(e[t]||vr,s[t])}function us(t,e,i){const n=this.cache,r=e.length,s=Sr(i,r);Ir(n,s)||(t.uniform1iv(this.addr,s),br(n,s));for(let t=0;t!==r;++t)i.setTexture2DArray(e[t]||gr,s[t])}class ds{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Mr;case 35664:return Br;case 35665:return Tr;case 35666:return Rr;case 35674:return Lr;case 35675:return Dr;case 35676:return Qr;case 5124:case 35670:return Pr;case 35667:case 35671:return Ur;case 35668:case 35672:return Nr;case 35669:case 35673:return Fr;case 5125:return kr;case 36294:return Or;case 36295:return Gr;case 36296:return Hr;case 35678:case 36198:case 36298:case 36306:case 35682:return zr;case 35679:case 36299:case 36307:return Vr;case 35680:case 36300:case 36308:case 36293:return Wr;case 36289:case 36303:case 36311:case 36292:return qr}}(e.type)}}class As{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return jr;case 35664:return Yr;case 35665:return Jr;case 35666:return Xr;case 35674:return Kr;case 35675:return $r;case 35676:return Zr;case 5124:case 35670:return ts;case 35667:case 35671:return es;case 35668:case 35672:return is;case 35669:case 35673:return ns;case 5125:return rs;case 36294:return ss;case 36295:return as;case 36296:return os;case 35678:case 36198:case 36298:case 36306:case 35682:return ls;case 35679:case 36299:case 36307:return hs;case 35680:case 36300:case 36308:case 36293:return cs;case 36289:case 36303:case 36311:case 36292:return us}}(e.type)}}class ps{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const n=this.seq;for(let r=0,s=n.length;r!==s;++r){const s=n[r];s.setValue(t,e[s.id],i)}}}const ms=/(\w+)(\])?(\[|\.)?/g;function gs(t,e){t.seq.push(e),t.map[e.id]=e}function fs(t,e,i){const n=t.name,r=n.length;for(ms.lastIndex=0;;){const s=ms.exec(n),a=ms.lastIndex;let o=s[1];const l="]"===s[2],h=s[3];if(l&&(o|=0),void 0===h||"["===h&&a+2===r){gs(i,void 0===h?new ds(o,t,e):new As(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new ps(o),gs(i,t)),i=t}}}class vs{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);fs(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let r=0,s=e.length;r!==s;++r){const s=e[r],a=i[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,n)}}static seqWithValue(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i}}function ys(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}let xs=0;function _s(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const n=parseInt(s[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const i=t.split("\n"),n=[],r=Math.max(e-6,0),s=Math.min(e+6,i.length);for(let t=r;t<s;t++){const r=t+1;n.push(`${r===e?">":" "} ${r}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return r}function Es(t,e){const i=function(t){switch(t){case dt:return["Linear","( value )"];case At:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function ws(t,e){let i;switch(e){case g:i="Linear";break;case f:i="Reinhard";break;case v:i="OptimizedCineon";break;case y:i="ACESFilmic";break;case x:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Cs(t){return""!==t}function Is(t,e){const i=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function bs(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Ss=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ms(t){return t.replace(Ss,Bs)}function Bs(t,e){const i=Qn[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Ms(i)}const Ts=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Rs(t){return t.replace(Ts,Ls)}function Ls(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Ds(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Qs(t,e,i,n){const o=t.getContext(),l=i.defines;let h=i.vertexShader,c=i.fragmentShader;const u=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===r?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===s?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===a&&(e="SHADOWMAP_TYPE_VSM"),e}(i),g=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case _:case E:e="ENVMAP_TYPE_CUBE";break;case C:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),f=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===E&&(e="ENVMAP_MODE_REFRACTION");return e}(i),v=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case d:e="ENVMAP_BLENDING_MULTIPLY";break;case A:e="ENVMAP_BLENDING_MIX";break;case p:e="ENVMAP_BLENDING_ADD"}return e}(i),y=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),x=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Cs).join("\n")}(i),w=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(l),I=o.createProgram();let b,S,M=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(b=[w].filter(Cs).join("\n"),b.length>0&&(b+="\n"),S=[x,w].filter(Cs).join("\n"),S.length>0&&(S+="\n")):(b=[Ds(i),"#define SHADER_NAME "+i.shaderName,w,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs2?"#define USE_UV2":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Cs).join("\n"),S=[x,Ds(i),"#define SHADER_NAME "+i.shaderName,w,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.envMap?"#define "+f:"",i.envMap?"#define "+v:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs2?"#define USE_UV2":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==m?"#define TONE_MAPPING":"",i.toneMapping!==m?Qn.tonemapping_pars_fragment:"",i.toneMapping!==m?ws("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Qn.encodings_pars_fragment,Es("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Cs).join("\n")),h=Ms(h),h=Is(h,i),h=bs(h,i),c=Ms(c),c=Is(c,i),c=bs(c,i),h=Rs(h),c=Rs(c),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(M="#version 300 es\n",b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+b,S=["#define varying in",i.glslVersion===xt?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===xt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+S);const B=M+S+c,T=ys(o,35633,M+b+h),R=ys(o,35632,B);if(o.attachShader(I,T),o.attachShader(I,R),void 0!==i.index0AttributeName?o.bindAttribLocation(I,0,i.index0AttributeName):!0===i.morphTargets&&o.bindAttribLocation(I,0,"position"),o.linkProgram(I),t.debug.checkShaderErrors){const e=o.getProgramInfoLog(I).trim(),i=o.getShaderInfoLog(T).trim(),n=o.getShaderInfoLog(R).trim();let r=!0,s=!0;if(!1===o.getProgramParameter(I,35714))if(r=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(o,I,T,R);else{const t=_s(o,T,"vertex"),i=_s(o,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(I,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+i)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==i&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:i,prefix:b},fragmentShader:{log:n,prefix:S}})}let L,D;return o.deleteShader(T),o.deleteShader(R),this.getUniforms=function(){return void 0===L&&(L=new vs(o,I)),L},this.getAttributes=function(){return void 0===D&&(D=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r),s=n.name;let a=1;35674===n.type&&(a=2),35675===n.type&&(a=3),35676===n.type&&(a=4),i[s]={type:n.type,location:t.getAttribLocation(e,s),locationSize:a}}return i}(o,I)),D},this.destroy=function(){n.releaseStatesOfProgram(this),o.deleteProgram(I),this.program=void 0},this.name=i.shaderName,this.id=xs++,this.cacheKey=e,this.usedTimes=1,this.program=I,this.vertexShader=T,this.fragmentShader=R,this}let Ps=0;class Us{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),r=this._getShaderStage(i),s=this._getShaderCacheForMaterial(t);return!1===s.has(n)&&(s.add(n),n.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new Ns(t),e.set(t,i)),i}}class Ns{constructor(t){this.id=Ps++,this.code=t,this.usedTimes=0}}function Fs(t,e,i,n,r,s,a){const o=new je,c=new Us,u=[],d=r.isWebGL2,A=r.logarithmicDepthBuffer,p=r.vertexTextures;let g=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(t){return 1===t?"uv2":"uv"}return{getParameters:function(s,o,u,y,x){const _=y.fog,E=x.geometry,w=s.isMeshStandardMaterial?y.environment:null,I=(s.isMeshStandardMaterial?i:e).get(s.envMap||w),b=I&&I.mapping===C?I.image.height:null,S=f[s.type];null!==s.precision&&(g=r.getMaxPrecision(s.precision),g!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",g,"instead."));const M=E.morphAttributes.position||E.morphAttributes.normal||E.morphAttributes.color,B=void 0!==M?M.length:0;let T,R,L,D,Q=0;if(void 0!==E.morphAttributes.position&&(Q=1),void 0!==E.morphAttributes.normal&&(Q=2),void 0!==E.morphAttributes.color&&(Q=3),S){const t=Un[S];T=t.vertexShader,R=t.fragmentShader}else T=s.vertexShader,R=s.fragmentShader,c.update(s),L=c.getVertexShaderID(s),D=c.getFragmentShaderID(s);const P=t.getRenderTarget(),U=!0===x.isInstancedMesh,N=!!s.map,F=!!s.matcap,k=!!I,O=!!s.aoMap,G=!!s.lightMap,H=!!s.bumpMap,z=!!s.normalMap,V=!!s.displacementMap,W=!!s.emissiveMap,q=!!s.metalnessMap,j=!!s.roughnessMap,Y=s.clearcoat>0,J=s.iridescence>0,X=s.sheen>0,K=s.transmission>0,$=Y&&!!s.clearcoatMap,Z=Y&&!!s.clearcoatNormalMap,tt=Y&&!!s.clearcoatRoughnessMap,et=J&&!!s.iridescenceMap,it=J&&!!s.iridescenceThicknessMap,nt=X&&!!s.sheenColorMap,rt=X&&!!s.sheenRoughnessMap,st=!!s.specularMap,at=!!s.specularColorMap,ot=!!s.specularIntensityMap,lt=K&&!!s.transmissionMap,ht=K&&!!s.thicknessMap,ct=!!s.gradientMap,ut=!!s.alphaMap,mt=s.alphaTest>0,gt=!!s.extensions,ft=!!E.attributes.uv2;return{isWebGL2:d,shaderID:S,shaderName:s.type,vertexShader:T,fragmentShader:R,defines:s.defines,customVertexShaderID:L,customFragmentShaderID:D,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:g,instancing:U,instancingColor:U&&null!==x.instanceColor,supportsVertexTextures:p,outputEncoding:null===P?t.outputEncoding:!0===P.isXRRenderTarget?P.texture.encoding:dt,map:N,matcap:F,envMap:k,envMapMode:k&&I.mapping,envMapCubeUVHeight:b,aoMap:O,lightMap:G,bumpMap:H,normalMap:z,displacementMap:p&&V,emissiveMap:W,normalMapObjectSpace:z&&1===s.normalMapType,normalMapTangentSpace:z&&s.normalMapType===pt,decodeVideoTexture:N&&!0===s.map.isVideoTexture&&s.map.encoding===At,metalnessMap:q,roughnessMap:j,clearcoat:Y,clearcoatMap:$,clearcoatNormalMap:Z,clearcoatRoughnessMap:tt,iridescence:J,iridescenceMap:et,iridescenceThicknessMap:it,sheen:X,sheenColorMap:nt,sheenRoughnessMap:rt,specularMap:st,specularColorMap:at,specularIntensityMap:ot,transmission:K,transmissionMap:lt,thicknessMap:ht,gradientMap:ct,opaque:!1===s.transparent&&1===s.blending,alphaMap:ut,alphaTest:mt,combine:s.combine,mapUv:N&&v(s.map.channel),aoMapUv:O&&v(s.aoMap.channel),lightMapUv:G&&v(s.lightMap.channel),bumpMapUv:H&&v(s.bumpMap.channel),normalMapUv:z&&v(s.normalMap.channel),displacementMapUv:V&&v(s.displacementMap.channel),emissiveMapUv:W&&v(s.emissiveMap.channel),metalnessMapUv:q&&v(s.metalnessMap.channel),roughnessMapUv:j&&v(s.roughnessMap.channel),clearcoatMapUv:$&&v(s.clearcoatMap.channel),clearcoatNormalMapUv:Z&&v(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:tt&&v(s.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&v(s.iridescenceMap.channel),iridescenceThicknessMapUv:it&&v(s.iridescenceThicknessMap.channel),sheenColorMapUv:nt&&v(s.sheenColorMap.channel),sheenRoughnessMapUv:rt&&v(s.sheenRoughnessMap.channel),specularMapUv:st&&v(s.specularMap.channel),specularColorMapUv:at&&v(s.specularColorMap.channel),specularIntensityMapUv:ot&&v(s.specularIntensityMap.channel),transmissionMapUv:lt&&v(s.transmissionMap.channel),thicknessMapUv:ht&&v(s.thicknessMap.channel),alphaMapUv:ut&&v(s.alphaMap.channel),vertexTangents:z&&!!E.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!E.attributes.color&&4===E.attributes.color.itemSize,vertexUvs2:ft,pointsUvs:!0===x.isPoints&&!!E.attributes.uv&&(N||ut),fog:!!_,useFog:!0===s.fog,fogExp2:_&&_.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:A,skinning:!0===x.isSkinnedMesh,morphTargets:void 0!==E.morphAttributes.position,morphNormals:void 0!==E.morphAttributes.normal,morphColors:void 0!==E.morphAttributes.color,morphTargetsCount:B,morphTextureStride:Q,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:m,useLegacyLights:t.useLegacyLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===h,flipSided:s.side===l,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:gt&&!0===s.extensions.derivatives,extensionFragDepth:gt&&!0===s.extensions.fragDepth,extensionDrawBuffers:gt&&!0===s.extensions.drawBuffers,extensionShaderTextureLOD:gt&&!0===s.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||n.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0);e.supportsVertexTextures&&o.enable(1);e.instancing&&o.enable(2);e.instancingColor&&o.enable(3);e.matcap&&o.enable(4);e.envMap&&o.enable(5);e.normalMapObjectSpace&&o.enable(6);e.normalMapTangentSpace&&o.enable(7);e.clearcoat&&o.enable(8);e.iridescence&&o.enable(9);e.alphaTest&&o.enable(10);e.vertexColors&&o.enable(11);e.vertexAlphas&&o.enable(12);e.vertexUvs2&&o.enable(13);e.vertexTangents&&o.enable(14);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.skinning&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.morphColors&&o.enable(7);e.premultipliedAlpha&&o.enable(8);e.shadowMapEnabled&&o.enable(9);e.useLegacyLights&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.useDepthPacking&&o.enable(13);e.dithering&&o.enable(14);e.transmission&&o.enable(15);e.sheen&&o.enable(16);e.decodeVideoTexture&&o.enable(17);e.opaque&&o.enable(18);e.pointsUvs&&o.enable(19);t.push(o.mask)}(i,e),i.push(t.outputEncoding)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=f[t.type];let i;if(e){const t=Un[e];i=gn.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=u.length;t<e;t++){const e=u[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new Qs(t,i,e,s),u.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=u.indexOf(t);u[e]=u[u.length-1],u.pop(),t.destroy()}},releaseShaderCache:function(t){c.remove(t)},programs:u,dispose:function(){c.dispose()}}}function ks(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function Os(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Gs(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Hs(){const t=[];let e=0;const i=[],n=[],r=[];function s(i,n,r,s,a,o){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:s,renderOrder:i.renderOrder,z:a,group:o},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=s,l.renderOrder=i.renderOrder,l.z=a,l.group=o),e++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){e=0,i.length=0,n.length=0,r.length=0},push:function(t,e,a,o,l,h){const c=s(t,e,a,o,l,h);a.transmission>0?n.push(c):!0===a.transparent?r.push(c):i.push(c)},unshift:function(t,e,a,o,l,h){const c=s(t,e,a,o,l,h);a.transmission>0?n.unshift(c):!0===a.transparent?r.unshift(c):i.unshift(c)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||Os),n.length>1&&n.sort(e||Gs),r.length>1&&r.sort(e||Gs)}}}function zs(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let r;return void 0===n?(r=new Hs,t.set(e,[r])):i>=n.length?(r=new Hs,n.push(r)):r=n[i],r},dispose:function(){t=new WeakMap}}}function Vs(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new ae,color:new bi};break;case"SpotLight":i={position:new ae,direction:new ae,color:new bi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new ae,color:new bi,distance:0,decay:0};break;case"HemisphereLight":i={direction:new ae,skyColor:new bi,groundColor:new bi};break;case"RectAreaLight":i={color:new bi,position:new ae,halfWidth:new ae,halfHeight:new ae}}return t[e.id]=i,i}}}let Ws=0;function qs(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function js(t,e){const i=new Vs,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Nt};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Nt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let t=0;t<9;t++)r.probe.push(new ae);const s=new ae,a=new Ue,o=new Ue;return{setup:function(s,a){let o=0,l=0,h=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,u=0,d=0,A=0,p=0,m=0,g=0,f=0,v=0,y=0;s.sort(qs);const x=!0===a?Math.PI:1;for(let t=0,e=s.length;t<e;t++){const e=s[t],a=e.color,_=e.intensity,E=e.distance,w=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=a.r*_*x,l+=a.g*_*x,h+=a.b*_*x;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],_);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*x),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[c]=i,r.directionalShadowMap[c]=w,r.directionalShadowMatrix[c]=e.shadow.matrix,m++}r.directional[c]=t,c++}else if(e.isSpotLight){const t=i.get(e);t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(a).multiplyScalar(_*x),t.distance=E,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,r.spot[d]=t;const s=e.shadow;if(e.map&&(r.spotLightMap[v]=e.map,v++,s.updateMatrices(e),e.castShadow&&y++),r.spotLightMatrix[d]=s.matrix,e.castShadow){const t=n.get(e);t.shadowBias=s.bias,t.shadowNormalBias=s.normalBias,t.shadowRadius=s.radius,t.shadowMapSize=s.mapSize,r.spotShadow[d]=t,r.spotShadowMap[d]=w,f++}d++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(a).multiplyScalar(_),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[A]=t,A++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*x),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[u]=i,r.pointShadowMap[u]=w,r.pointShadowMatrix[u]=e.shadow.matrix,g++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(_*x),t.groundColor.copy(e.groundColor).multiplyScalar(_*x),r.hemi[p]=t,p++}}A>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Pn.LTC_FLOAT_1,r.rectAreaLTC2=Pn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Pn.LTC_HALF_1,r.rectAreaLTC2=Pn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;const _=r.hash;_.directionalLength===c&&_.pointLength===u&&_.spotLength===d&&_.rectAreaLength===A&&_.hemiLength===p&&_.numDirectionalShadows===m&&_.numPointShadows===g&&_.numSpotShadows===f&&_.numSpotMaps===v||(r.directional.length=c,r.spot.length=d,r.rectArea.length=A,r.point.length=u,r.hemi.length=p,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=f,r.spotShadowMap.length=f,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=f+v-y,r.spotLightMap.length=v,r.numSpotLightShadowsWithMaps=y,_.directionalLength=c,_.pointLength=u,_.spotLength=d,_.rectAreaLength=A,_.hemiLength=p,_.numDirectionalShadows=m,_.numPointShadows=g,_.numSpotShadows=f,_.numSpotMaps=v,r.version=Ws++)},setupView:function(t,e){let i=0,n=0,l=0,h=0,c=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(d.matrixWorld),s.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(u),i++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),s.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=r.rectArea[h];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),a.copy(d.matrixWorld),a.premultiply(u),o.extractRotation(a),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),h++}else if(d.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),n++}else if(d.isHemisphereLight){const t=r.hemi[c];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),c++}}},state:r}}function Ys(t,e){const i=new js(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(t){i.setup(n,t)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function Js(t,e){let i=new WeakMap;return{get:function(n,r=0){const s=i.get(n);let a;return void 0===s?(a=new Ys(t,e),i.set(n,[a])):r>=s.length?(a=new Ys(t,e),s.push(a)):a=s[r],a},dispose:function(){i=new WeakMap}}}class Xs extends _i{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Ks extends _i{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function $s(t,e,i){let n=new Tn;const s=new Nt,u=new Nt,d=new ee,A=new Xs({depthPacking:3201}),p=new Ks,m={},g=i.maxTextureSize,f={[o]:l,[l]:o,[h]:h},v=new fn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Nt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),y=v.clone();y.defines.HORIZONTAL_PASS=1;const x=new Wi;x.setAttribute("position",new Qi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new cn(x,v),E=this;function w(i,n){const r=e.update(_);v.defines.VSM_SAMPLES!==i.blurSamples&&(v.defines.VSM_SAMPLES=i.blurSamples,y.defines.VSM_SAMPLES=i.blurSamples,v.needsUpdate=!0,y.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new ie(s.x,s.y)),v.uniforms.shadow_pass.value=i.map.texture,v.uniforms.resolution.value=i.mapSize,v.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,v,_,null),y.uniforms.shadow_pass.value=i.mapPass.texture,y.uniforms.resolution.value=i.mapSize,y.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,y,_,null)}function C(e,i,n,r){let s=null;const o=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===n.isPointLight?p:A,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){const t=s.uuid,e=i.uuid;let n=m[t];void 0===n&&(n={},m[t]=n);let r=n[e];void 0===r&&(r=s.clone(),n[e]=r),s=r}if(s.visible=i.visible,s.wireframe=i.wireframe,s.side=r===a?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:f[i.side],s.alphaMap=i.alphaMap,s.alphaTest=i.alphaTest,s.map=i.map,s.clipShadows=i.clipShadows,s.clippingPlanes=i.clippingPlanes,s.clipIntersection=i.clipIntersection,s.displacementMap=i.displacementMap,s.displacementScale=i.displacementScale,s.displacementBias=i.displacementBias,s.wireframeLinewidth=i.wireframeLinewidth,s.linewidth=i.linewidth,!0===n.isPointLight&&!0===s.isMeshDistanceMaterial){t.properties.get(s).light=n}return s}function I(i,r,s,o,l){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===a)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let a=0,h=e.length;a<h;a++){const h=e[a],c=r[h.materialIndex];if(c&&c.visible){const e=C(i,c,o,l);t.renderBufferDirect(s,null,n,e,i,h)}}}else if(r.visible){const e=C(i,r,o,l);t.renderBufferDirect(s,null,n,e,i,null)}}const h=i.children;for(let t=0,e=h.length;t<e;t++)I(h[t],r,s,o,l)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=r,this.render=function(e,i,r){if(!1===E.enabled)return;if(!1===E.autoUpdate&&!1===E.needsUpdate)return;if(0===e.length)return;const o=t.getRenderTarget(),l=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),A=t.state;A.setBlending(c),A.buffers.color.setClear(1,1,1,1),A.buffers.depth.setTest(!0),A.setScissorTest(!1);for(let o=0,l=e.length;o<l;o++){const l=e[o],h=l.shadow;if(void 0===h){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;s.copy(h.mapSize);const c=h.getFrameExtents();if(s.multiply(c),u.copy(h.mapSize),(s.x>g||s.y>g)&&(s.x>g&&(u.x=Math.floor(g/c.x),s.x=u.x*c.x,h.mapSize.x=u.x),s.y>g&&(u.y=Math.floor(g/c.y),s.y=u.y*c.y,h.mapSize.y=u.y)),null===h.map){const t=this.type!==a?{minFilter:M,magFilter:M}:{};h.map=new ie(s.x,s.y,t),h.map.texture.name=l.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const p=h.getViewportCount();for(let t=0;t<p;t++){const e=h.getViewport(t);d.set(u.x*e.x,u.y*e.y,u.x*e.z,u.y*e.w),A.viewport(d),h.updateMatrices(l,t),n=h.getFrustum(),I(i,r,h.camera,l,this.type)}!0!==h.isPointLightShadow&&this.type===a&&w(h,r),h.needsUpdate=!1}E.needsUpdate=!1,t.setRenderTarget(o,l,h)}}function Zs(t,e,i){const n=i.isWebGL2;const r=new function(){let e=!1;const i=new ee;let n=null;const r=new ee(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,s,a,o){!0===o&&(e*=a,n*=a,s*=a),i.set(e,n,s,a),!1===r.equals(i)&&(t.clearColor(e,n,s,a),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},s=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?V(2929):W(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},a=new function(){let e=!1,i=null,n=null,r=null,s=null,a=null,o=null,l=null,h=null;return{setTest:function(t){e||(t?V(2960):W(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&r===i&&s===a||(t.stencilFunc(e,i,a),n=e,r=i,s=a)},setOp:function(e,i,n){a===e&&o===i&&l===n||(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,s=null,a=null,o=null,l=null,h=null}}},o=new WeakMap,d=new WeakMap;let A={},p={},m=new WeakMap,g=[],f=null,v=!1,y=null,x=null,_=null,E=null,w=null,C=null,I=null,b=!1,S=null,M=null,B=null,T=null,R=null;const L=t.getParameter(35661);let D=!1,Q=0;const P=t.getParameter(7938);-1!==P.indexOf("WebGL")?(Q=parseFloat(/^WebGL (\d)/.exec(P)[1]),D=Q>=1):-1!==P.indexOf("OpenGL ES")&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),D=Q>=2);let U=null,N={};const F=t.getParameter(3088),k=t.getParameter(2978),O=(new ee).fromArray(F),G=(new ee).fromArray(k);function H(e,i,n){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return s}const z={};function V(e){!0!==A[e]&&(t.enable(e),A[e]=!0)}function W(e){!1!==A[e]&&(t.disable(e),A[e]=!1)}z[3553]=H(3553,3553,1),z[34067]=H(34067,34069,6),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),V(2929),s.setFunc(3),J(!1),X(1),V(2884),Y(c);const q={[u]:32774,101:32778,102:32779};if(n)q[103]=32775,q[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(q[103]=t.MIN_EXT,q[104]=t.MAX_EXT)}const j={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function Y(e,i,n,r,s,a,o,l){if(e!==c){if(!1===v&&(V(3042),v=!0),5===e)s=s||i,a=a||n,o=o||r,i===x&&s===w||(t.blendEquationSeparate(q[i],q[s]),x=i,w=s),n===_&&r===E&&a===C&&o===I||(t.blendFuncSeparate(j[n],j[r],j[a],j[o]),_=n,E=r,C=a,I=o),y=e,b=!1;else if(e!==y||l!==b){if(x===u&&w===u||(t.blendEquation(32774),x=u,w=u),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}_=null,E=null,C=null,I=null,y=e,b=l}}else!0===v&&(W(3042),v=!1)}function J(e){S!==e&&(e?t.frontFace(2304):t.frontFace(2305),S=e)}function X(e){0!==e?(V(2884),e!==M&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):W(2884),M=e}function K(e,i,n){e?(V(32823),T===i&&R===n||(t.polygonOffset(i,n),T=i,R=n)):W(32823)}return{buffers:{color:r,depth:s,stencil:a},enable:V,disable:W,bindFramebuffer:function(e,i){return p[e]!==i&&(t.bindFramebuffer(e,i),p[e]=i,n&&(36009===e&&(p[36160]=i),36160===e&&(p[36009]=i)),!0)},drawBuffers:function(n,r){let s=g,a=!1;if(n)if(s=m.get(r),void 0===s&&(s=[],m.set(r,s)),n.isWebGLMultipleRenderTargets){const t=n.texture;if(s.length!==t.length||36064!==s[0]){for(let e=0,i=t.length;e<i;e++)s[e]=36064+e;s.length=t.length,a=!0}}else 36064!==s[0]&&(s[0]=36064,a=!0);else 1029!==s[0]&&(s[0]=1029,a=!0);a&&(i.isWebGL2?t.drawBuffers(s):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(s))},useProgram:function(e){return f!==e&&(t.useProgram(e),f=e,!0)},setBlending:Y,setMaterial:function(t,e){t.side===h?W(2884):V(2884);let i=t.side===l;e&&(i=!i),J(i),1===t.blending&&!1===t.transparent?Y(c):Y(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),r.setMask(t.colorWrite);const n=t.stencilWrite;a.setTest(n),n&&(a.setMask(t.stencilWriteMask),a.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),a.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),K(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?V(32926):W(32926)},setFlipSided:J,setCullFace:X,setLineWidth:function(e){e!==B&&(D&&t.lineWidth(e),B=e)},setPolygonOffset:K,setScissorTest:function(t){t?V(3089):W(3089)},activeTexture:function(e){void 0===e&&(e=33984+L-1),U!==e&&(t.activeTexture(e),U=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===U?33984+L-1:U);let r=N[n];void 0===r&&(r={type:void 0,texture:void 0},N[n]=r),r.type===e&&r.texture===i||(U!==n&&(t.activeTexture(n),U=n),t.bindTexture(e,i||z[e]),r.type=e,r.texture=i)},unbindTexture:function(){const e=N[U];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,i){let n=d.get(i);void 0===n&&(n=new WeakMap,d.set(i,n));let r=n.get(e);void 0===r&&(r=t.getUniformBlockIndex(i,e.name),n.set(e,r))},uniformBlockBinding:function(e,i){const n=d.get(i).get(e);o.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),o.set(i,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===O.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===G.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),G.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===n&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),A={},U=null,N={},p={},m=new WeakMap,g=[],f=null,v=!1,y=null,x=null,_=null,E=null,w=null,C=null,I=null,b=!1,S=null,M=null,B=null,T=null,R=null,O.set(0,0,t.canvas.width,t.canvas.height),G.set(0,0,t.canvas.width,t.canvas.height),r.reset(),s.reset(),a.reset()}}}function ta(t,e,i,n,r,s,a){const o=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,c=r.maxTextureSize,u=r.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,A="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let m;const g=new WeakMap;let f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function v(t,e){return f?new OffscreenCanvas(t,e):Gt("canvas")}function y(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?Dt:Math.floor,s=n(r*t.width),a=n(r*t.height);void 0===m&&(m=v(s,a));const o=i?v(s,a):m;o.width=s,o.height=a;return o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Rt(t.width)&&Rt(t.height)}function _(t,e){return t.generateMipmaps&&e&&t.minFilter!==M&&t.minFilter!==R}function E(e){t.generateMipmap(e)}function w(i,n,r,s,a=!1){if(!1===o)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let l=n;return 6403===n&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===n&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===n&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=s===At&&!1===a?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function C(t,e,i){return!0===_(t,i)||t.isFramebufferTexture&&t.minFilter!==M&&t.minFilter!==R?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function H(t){return t===M||t===B||t===T?9728:9729}function z(t){const e=t.target;e.removeEventListener("dispose",z),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,r=g.get(i);if(r){const n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&W(t),0===Object.keys(r).length&&g.delete(i)}n.remove(t)}(e),e.isVideoTexture&&p.delete(e)}function V(e){const i=e.target;i.removeEventListener("dispose",V),function(e){const i=e.texture,r=n.get(e),s=n.get(i);void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else{if(t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let e=0;e<r.__webglColorRenderbuffer.length;e++)r.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(r.__webglColorRenderbuffer[e]);r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),a.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}function W(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const r=e.source;delete g.get(r)[i.__cacheKey],a.memory.textures--}let q=0;function j(t,e){const r=n.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&r.__version!==t.version){const i=t.image;if(null===i)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==i.complete)return void $(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(3553,r.__webglTexture,33984+e)}const Y={[I]:10497,[b]:33071,[S]:33648},J={[M]:9728,[B]:9984,[T]:9986,[R]:9729,[L]:9985,[D]:9987};function X(i,s,a){if(a?(t.texParameteri(i,10242,Y[s.wrapS]),t.texParameteri(i,10243,Y[s.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,Y[s.wrapR]),t.texParameteri(i,10240,J[s.magFilter]),t.texParameteri(i,10241,J[s.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),s.wrapS===b&&s.wrapT===b||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,H(s.magFilter)),t.texParameteri(i,10241,H(s.minFilter)),s.minFilter!==M&&s.minFilter!==R&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(s.magFilter===M)return;if(s.minFilter!==T&&s.minFilter!==D)return;if(s.type===U&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&s.type===N&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||n.get(s).__currentAnisotropy)&&(t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy)}}function K(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",z));const r=i.source;let s=g.get(r);void 0===s&&(s={},g.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(i);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&W(i)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return n}function $(e,r,a){let l=3553;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(l=35866),r.isData3DTexture&&(l=32879);const h=K(e,r),u=r.source;i.bindTexture(l,e.__webglTexture,33984+a);const d=n.get(u);if(u.version!==d.__version||!0===h){i.activeTexture(33984+a),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=function(t){return!o&&(t.wrapS!==b||t.wrapT!==b||t.minFilter!==M&&t.minFilter!==R)}(r)&&!1===x(r.image);let n=y(r.image,e,!1,c);n=rt(r,n);const A=x(n)||o,p=s.convert(r.format,r.encoding);let m,g=s.convert(r.type),f=w(r.internalFormat,p,g,r.encoding,r.isVideoTexture);X(l,r,A);const v=r.mipmaps,I=o&&!0!==r.isVideoTexture,S=void 0===d.__version||!0===h,B=C(r,n,A);if(r.isDepthTexture)f=6402,o?f=r.type===U?36012:r.type===P?33190:r.type===F?35056:33189:r.type===U&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===O&&6402===f&&1012!==r.type&&r.type!==P&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=P,g=s.convert(r.type)),r.format===G&&6402===f&&(f=34041,r.type!==F&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=F,g=s.convert(r.type))),S&&(I?i.texStorage2D(3553,1,f,n.width,n.height):i.texImage2D(3553,0,f,n.width,n.height,0,p,g,null));else if(r.isDataTexture)if(v.length>0&&A){I&&S&&i.texStorage2D(3553,B,f,v[0].width,v[0].height);for(let t=0,e=v.length;t<e;t++)m=v[t],I?i.texSubImage2D(3553,t,0,0,m.width,m.height,p,g,m.data):i.texImage2D(3553,t,f,m.width,m.height,0,p,g,m.data);r.generateMipmaps=!1}else I?(S&&i.texStorage2D(3553,B,f,n.width,n.height),i.texSubImage2D(3553,0,0,0,n.width,n.height,p,g,n.data)):i.texImage2D(3553,0,f,n.width,n.height,0,p,g,n.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){I&&S&&i.texStorage3D(35866,B,f,v[0].width,v[0].height,n.depth);for(let t=0,e=v.length;t<e;t++)m=v[t],r.format!==k?null!==p?I?i.compressedTexSubImage3D(35866,t,0,0,0,m.width,m.height,n.depth,p,m.data,0,0):i.compressedTexImage3D(35866,t,f,m.width,m.height,n.depth,0,m.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?i.texSubImage3D(35866,t,0,0,0,m.width,m.height,n.depth,p,g,m.data):i.texImage3D(35866,t,f,m.width,m.height,n.depth,0,p,g,m.data)}else{I&&S&&i.texStorage2D(3553,B,f,v[0].width,v[0].height);for(let t=0,e=v.length;t<e;t++)m=v[t],r.format!==k?null!==p?I?i.compressedTexSubImage2D(3553,t,0,0,m.width,m.height,p,m.data):i.compressedTexImage2D(3553,t,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?i.texSubImage2D(3553,t,0,0,m.width,m.height,p,g,m.data):i.texImage2D(3553,t,f,m.width,m.height,0,p,g,m.data)}else if(r.isDataArrayTexture)I?(S&&i.texStorage3D(35866,B,f,n.width,n.height,n.depth),i.texSubImage3D(35866,0,0,0,0,n.width,n.height,n.depth,p,g,n.data)):i.texImage3D(35866,0,f,n.width,n.height,n.depth,0,p,g,n.data);else if(r.isData3DTexture)I?(S&&i.texStorage3D(32879,B,f,n.width,n.height,n.depth),i.texSubImage3D(32879,0,0,0,0,n.width,n.height,n.depth,p,g,n.data)):i.texImage3D(32879,0,f,n.width,n.height,n.depth,0,p,g,n.data);else if(r.isFramebufferTexture){if(S)if(I)i.texStorage2D(3553,B,f,n.width,n.height);else{let t=n.width,e=n.height;for(let n=0;n<B;n++)i.texImage2D(3553,n,f,t,e,0,p,g,null),t>>=1,e>>=1}}else if(v.length>0&&A){I&&S&&i.texStorage2D(3553,B,f,v[0].width,v[0].height);for(let t=0,e=v.length;t<e;t++)m=v[t],I?i.texSubImage2D(3553,t,0,0,p,g,m):i.texImage2D(3553,t,f,p,g,m);r.generateMipmaps=!1}else I?(S&&i.texStorage2D(3553,B,f,n.width,n.height),i.texSubImage2D(3553,0,0,0,p,g,n)):i.texImage2D(3553,0,f,p,g,n);_(r,A)&&E(l),d.__version=u.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}function Z(e,r,a,o,l){const h=s.convert(a.format,a.encoding),c=s.convert(a.type),u=w(a.internalFormat,h,c,a.encoding);n.get(r).__hasExternalTextures||(32879===l||35866===l?i.texImage3D(l,0,u,r.width,r.height,r.depth,0,h,c,null):i.texImage2D(l,0,u,r.width,r.height,0,h,c,null)),i.bindFramebuffer(36160,e),nt(r)?d.framebufferTexture2DMultisampleEXT(36160,o,l,n.get(a).__webglTexture,0,it(r)):(3553===l||l>=34069&&l<=34074)&&t.framebufferTexture2D(36160,o,l,n.get(a).__webglTexture,0),i.bindFramebuffer(36160,null)}function tt(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n||nt(i)){const e=i.depthTexture;e&&e.isDepthTexture&&(e.type===U?r=36012:e.type===P&&(r=33190));const n=it(i);nt(i)?d.renderbufferStorageMultisampleEXT(36161,n,r,i.width,i.height):t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){const r=it(i);n&&!1===nt(i)?t.renderbufferStorageMultisample(36161,r,35056,i.width,i.height):nt(i)?d.renderbufferStorageMultisampleEXT(36161,r,35056,i.width,i.height):t.renderbufferStorage(36161,34041,i.width,i.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let r=0;r<e.length;r++){const a=e[r],o=s.convert(a.format,a.encoding),l=s.convert(a.type),h=w(a.internalFormat,o,l,a.encoding),c=it(i);n&&!1===nt(i)?t.renderbufferStorageMultisample(36161,c,h,i.width,i.height):nt(i)?d.renderbufferStorageMultisampleEXT(36161,c,h,i.width,i.height):t.renderbufferStorage(36161,h,i.width,i.height)}}t.bindRenderbuffer(36161,null)}function et(e){const r=n.get(e),s=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),j(r.depthTexture,0);const s=n.get(r.depthTexture).__webglTexture,a=it(r);if(r.depthTexture.format===O)nt(r)?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,s,0,a):t.framebufferTexture2D(36160,36096,3553,s,0);else{if(r.depthTexture.format!==G)throw new Error("Unknown depthTexture format");nt(r)?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,s,0,a):t.framebufferTexture2D(36160,33306,3553,s,0)}}(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(36160,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),tt(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),tt(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function it(t){return Math.min(u,t.samples)}function nt(t){const i=n.get(t);return o&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function rt(t,i){const n=t.encoding,r=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===_t||n!==dt&&(n===At?!1===o?!0===e.has("EXT_sRGB")&&r===k?(t.format=_t,t.minFilter=R,t.generateMipmaps=!1):i=Xt.sRGBToLinear(i):r===k&&s===Q||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",n)),i}this.allocateTextureUnit=function(){const t=q;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),q+=1,t},this.resetTextureUnits=function(){q=0},this.setTexture2D=j,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?$(r,t,e):i.bindTexture(35866,r.__webglTexture,33984+e)},this.setTexture3D=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?$(r,t,e):i.bindTexture(32879,r.__webglTexture,33984+e)},this.setTextureCube=function(e,r){const a=n.get(e);e.version>0&&a.__version!==e.version?function(e,r,a){if(6!==r.image.length)return;const l=K(e,r),c=r.source;i.bindTexture(34067,e.__webglTexture,33984+a);const u=n.get(c);if(c.version!==u.__version||!0===l){i.activeTexture(33984+a),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=r.isCompressedTexture||r.image[0].isCompressedTexture,n=r.image[0]&&r.image[0].isDataTexture,d=[];for(let t=0;t<6;t++)d[t]=e||n?n?r.image[t].image:r.image[t]:y(r.image[t],!1,!0,h),d[t]=rt(r,d[t]);const A=d[0],p=x(A)||o,m=s.convert(r.format,r.encoding),g=s.convert(r.type),f=w(r.internalFormat,m,g,r.encoding),v=o&&!0!==r.isVideoTexture,I=void 0===u.__version||!0===l;let b,S=C(r,A,p);if(X(34067,r,p),e){v&&I&&i.texStorage2D(34067,S,f,A.width,A.height);for(let t=0;t<6;t++){b=d[t].mipmaps;for(let e=0;e<b.length;e++){const n=b[e];r.format!==k?null!==m?v?i.compressedTexSubImage2D(34069+t,e,0,0,n.width,n.height,m,n.data):i.compressedTexImage2D(34069+t,e,f,n.width,n.height,0,n.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):v?i.texSubImage2D(34069+t,e,0,0,n.width,n.height,m,g,n.data):i.texImage2D(34069+t,e,f,n.width,n.height,0,m,g,n.data)}}}else{b=r.mipmaps,v&&I&&(b.length>0&&S++,i.texStorage2D(34067,S,f,d[0].width,d[0].height));for(let t=0;t<6;t++)if(n){v?i.texSubImage2D(34069+t,0,0,0,d[t].width,d[t].height,m,g,d[t].data):i.texImage2D(34069+t,0,f,d[t].width,d[t].height,0,m,g,d[t].data);for(let e=0;e<b.length;e++){const n=b[e].image[t].image;v?i.texSubImage2D(34069+t,e+1,0,0,n.width,n.height,m,g,n.data):i.texImage2D(34069+t,e+1,f,n.width,n.height,0,m,g,n.data)}}else{v?i.texSubImage2D(34069+t,0,0,0,m,g,d[t]):i.texImage2D(34069+t,0,f,m,g,d[t]);for(let e=0;e<b.length;e++){const n=b[e];v?i.texSubImage2D(34069+t,e+1,0,0,m,g,n.image[t]):i.texImage2D(34069+t,e+1,f,m,g,n.image[t])}}}_(r,p)&&E(34067),u.__version=c.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(a,e,r):i.bindTexture(34067,a.__webglTexture,33984+r)},this.rebindTextures=function(t,e,i){const r=n.get(t);void 0!==e&&Z(r.__webglFramebuffer,t,t.texture,36064,3553),void 0!==i&&et(t)},this.setupRenderTarget=function(e){const l=e.texture,h=n.get(e),c=n.get(l);e.addEventListener("dispose",V),!0!==e.isWebGLMultipleRenderTargets&&(void 0===c.__webglTexture&&(c.__webglTexture=t.createTexture()),c.__version=l.version,a.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,A=x(e)||o;if(u){h.__webglFramebuffer=[];for(let e=0;e<6;e++)h.__webglFramebuffer[e]=t.createFramebuffer()}else{if(h.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const i=e.texture;for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&e.samples>0&&!1===nt(e)){const n=d?l:[l];h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer);for(let i=0;i<n.length;i++){const r=n[i];h.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(36161,h.__webglColorRenderbuffer[i]);const a=s.convert(r.format,r.encoding),o=s.convert(r.type),l=w(r.internalFormat,a,o,r.encoding,!0===e.isXRRenderTarget),c=it(e);t.renderbufferStorageMultisample(36161,c,l,e.width,e.height),t.framebufferRenderbuffer(36160,36064+i,36161,h.__webglColorRenderbuffer[i])}t.bindRenderbuffer(36161,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),tt(h.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}}if(u){i.bindTexture(34067,c.__webglTexture),X(34067,l,A);for(let t=0;t<6;t++)Z(h.__webglFramebuffer[t],e,l,36064,34069+t);_(l,A)&&E(34067),i.unbindTexture()}else if(d){const t=e.texture;for(let r=0,s=t.length;r<s;r++){const s=t[r],a=n.get(s);i.bindTexture(3553,a.__webglTexture),X(3553,s,A),Z(h.__webglFramebuffer,e,s,36064+r,3553),_(s,A)&&E(3553)}i.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(o?t=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(t,c.__webglTexture),X(t,l,A),Z(h.__webglFramebuffer,e,l,36064,t),_(l,A)&&E(t),i.unbindTexture()}e.depthBuffer&&et(e)},this.updateRenderTargetMipmap=function(t){const e=x(t)||o,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let s=0,a=r.length;s<a;s++){const a=r[s];if(_(a,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=n.get(a).__webglTexture;i.bindTexture(e,r),E(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(o&&e.samples>0&&!1===nt(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=e.width,a=e.height;let o=16384;const l=[],h=e.stencilBuffer?33306:36096,c=n.get(e),u=!0===e.isWebGLMultipleRenderTargets;if(u)for(let e=0;e<r.length;e++)i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,null),i.bindFramebuffer(36160,c.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,null,0);i.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,c.__webglFramebuffer);for(let i=0;i<r.length;i++){l.push(36064+i),e.depthBuffer&&l.push(h);const d=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===d&&(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024)),u&&t.framebufferRenderbuffer(36008,36064,36161,c.__webglColorRenderbuffer[i]),!0===d&&(t.invalidateFramebuffer(36008,[h]),t.invalidateFramebuffer(36009,[h])),u){const e=n.get(r[i]).__webglTexture;t.framebufferTexture2D(36009,36064,3553,e,0)}t.blitFramebuffer(0,0,s,a,0,0,s,a,o,9728),A&&t.invalidateFramebuffer(36008,l)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),u)for(let e=0;e<r.length;e++){i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,c.__webglColorRenderbuffer[e]);const s=n.get(r[e]).__webglTexture;i.bindFramebuffer(36160,c.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,s,0)}i.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=et,this.setupFrameBufferTexture=Z,this.useMultisampledRTT=nt}function ea(t,e,i){const n=i.isWebGL2;return{convert:function(i,r=null){let s;if(i===Q)return 5121;if(1017===i)return 32819;if(1018===i)return 32820;if(1010===i)return 5120;if(1011===i)return 5122;if(1012===i)return 5123;if(1013===i)return 5124;if(i===P)return 5125;if(i===U)return 5126;if(i===N)return n?5131:(s=e.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(1021===i)return 6406;if(i===k)return 6408;if(1024===i)return 6409;if(1025===i)return 6410;if(i===O)return 6402;if(i===G)return 34041;if(i===_t)return s=e.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(i===H)return 6403;if(1029===i)return 36244;if(i===z)return 33319;if(1031===i)return 33320;if(1033===i)return 36249;if(i===V||i===W||i===q||i===j)if(r===At){if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(i===V)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===W)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===q)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===j)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=e.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(i===V)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===W)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===q)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===j)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===Y||35841===i||i===J||35843===i){if(s=e.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(i===Y)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===J)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===X)return s=e.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===K||i===$){if(s=e.get("WEBGL_compressed_texture_etc"),null===s)return null;if(i===K)return r===At?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===$)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(i===Z||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(s=e.get("WEBGL_compressed_texture_astc"),null===s)return null;if(i===Z)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return r===At?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===tt){if(s=e.get("EXT_texture_compression_bptc"),null===s)return null;if(i===tt)return r===At?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===i||36284===i||36285===i||36286===i){if(s=e.get("EXT_texture_compression_rgtc"),null===s)return null;if(i===tt)return s.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===F?n?34042:(s=e.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}class ia extends yn{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class na extends oi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ra={type:"move"};class sa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new na,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new na,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ae,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ae),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new na,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ae,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ae),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i),r=this._getHandJoint(l,n);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=n.position.distanceTo(r.position),o=.02,h=.005;l.inputState.pinching&&a>o+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(n=e.getPose(t.targetRaySpace,i),null===n&&null!==r&&(n=r),null!==n&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ra)))}return null!==a&&(a.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new na;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class aa extends te{constructor(t,e,i,n,r,s,a,o,l,h){if((h=void 0!==h?h:O)!==O&&h!==G)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===O&&(i=P),void 0===i&&h===G&&(i=F),super(null,n,r,s,a,o,h,i,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:M,this.minFilter=void 0!==o?o:M,this.flipY=!1,this.generateMipmaps=!1}}class oa extends Et{constructor(t,e){super();const i=this;let n=null,r=1,s=null,a="local-floor",o=1,l=null,h=null,c=null,u=null,d=null,A=null;const p=e.getContextAttributes();let m=null,g=null;const f=[],v=[],y=new Set,x=new Map,_=new yn;_.layers.enable(1),_.viewport=new ee;const E=new yn;E.layers.enable(2),E.viewport=new ee;const w=[_,E],C=new ia;C.layers.enable(1),C.layers.enable(2);let I=null,b=null;function S(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const i=f[e];void 0!==i&&i.dispatchEvent({type:t.type,data:t.inputSource})}function M(){n.removeEventListener("select",S),n.removeEventListener("selectstart",S),n.removeEventListener("selectend",S),n.removeEventListener("squeeze",S),n.removeEventListener("squeezestart",S),n.removeEventListener("squeezeend",S),n.removeEventListener("end",M),n.removeEventListener("inputsourceschange",B);for(let t=0;t<f.length;t++){const e=v[t];null!==e&&(v[t]=null,f[t].disconnect(e))}I=null,b=null,t.setRenderTarget(m),d=null,u=null,c=null,n=null,g=null,U.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function B(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=v.indexOf(i);n>=0&&(v[n]=null,f[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=v.indexOf(i);if(-1===n){for(let t=0;t<f.length;t++){if(t>=v.length){v.push(i),n=t;break}if(null===v[t]){v[t]=i,n=t;break}}if(-1===n)break}const r=f[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=f[t];return void 0===e&&(e=new sa,f[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=f[t];return void 0===e&&(e=new sa,f[t]=e),e.getGripSpace()},this.getHand=function(t){let e=f[t];return void 0===e&&(e=new sa,f[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return c},this.getFrame=function(){return A},this.getSession=function(){return n},this.setSession=async function(h){if(n=h,null!==n){if(m=t.getRenderTarget(),n.addEventListener("select",S),n.addEventListener("selectstart",S),n.addEventListener("selectend",S),n.addEventListener("squeeze",S),n.addEventListener("squeezestart",S),n.addEventListener("squeezeend",S),n.addEventListener("end",M),n.addEventListener("inputsourceschange",B),!0!==p.xrCompatible&&await e.makeXRCompatible(),void 0===n.renderState.layers||!1===t.capabilities.isWebGL2){const i={antialias:void 0!==n.renderState.layers||p.antialias,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:d}),g=new ie(d.framebufferWidth,d.framebufferHeight,{format:k,type:Q,encoding:t.outputEncoding,stencilBuffer:p.stencil})}else{let i=null,s=null,a=null;p.depth&&(a=p.stencil?35056:33190,i=p.stencil?G:O,s=p.stencil?F:P);const o={colorFormat:32856,depthFormat:a,scaleFactor:r};c=new XRWebGLBinding(n,e),u=c.createProjectionLayer(o),n.updateRenderState({layers:[u]}),g=new ie(u.textureWidth,u.textureHeight,{format:k,type:Q,depthTexture:new aa(u.textureWidth,u.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:p.stencil,encoding:t.outputEncoding,samples:p.antialias?4:0});t.properties.get(g).__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await n.requestReferenceSpace(a),U.setContext(n),U.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const T=new ae,R=new ae;function L(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;C.near=E.near=_.near=t.near,C.far=E.far=_.far=t.far,I===C.near&&b===C.far||(n.updateRenderState({depthNear:C.near,depthFar:C.far}),I=C.near,b=C.far);const e=t.parent,i=C.cameras;L(C,e);for(let t=0;t<i.length;t++)L(i[t],e);2===i.length?function(t,e,i){T.setFromMatrixPosition(e.matrixWorld),R.setFromMatrixPosition(i.matrixWorld);const n=T.distanceTo(R),r=e.projectionMatrix.elements,s=i.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=a*c,A=a*u,p=n/(-c+u),m=p*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=a+p,f=o+p,v=d-m,y=A+(n-m),x=l*o/f*g,_=h*o/f*g;t.projectionMatrix.makePerspective(v,y,x,_,g,f),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(C,_,E):C.projectionMatrix.copy(_.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld));t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0);const n=t.children;for(let t=0,e=n.length;t<e;t++)n[t].updateMatrixWorld(!0);t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*bt*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,C,e)},this.getCamera=function(){return C},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(t){o=t,null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)},this.getPlanes=function(){return y};let D=null;const U=new Rn;U.setAnimationLoop((function(e,n){if(h=n.getViewerPose(l||s),A=n,null!==h){const e=h.views;null!==d&&(t.setRenderTargetFramebuffer(g,d.framebuffer),t.setRenderTarget(g));let i=!1;e.length!==C.cameras.length&&(C.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const r=e[n];let s=null;if(null!==d)s=d.getViewport(r);else{const e=c.getViewSubImage(u,r);s=e.viewport,0===n&&(t.setRenderTargetTextures(g,e.colorTexture,u.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(g))}let a=w[n];void 0===a&&(a=new yn,a.layers.enable(n),a.viewport=new ee,w[n]=a),a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(r.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(s.x,s.y,s.width,s.height),0===n&&(C.matrix.copy(a.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===i&&C.cameras.push(a)}}for(let t=0;t<f.length;t++){const e=v[t],i=f[t];null!==e&&void 0!==i&&i.update(e,n,l||s)}if(D&&D(e,n),n.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:n.detectedPlanes});let t=null;for(const e of y)n.detectedPlanes.has(e)||(null===t&&(t=[]),t.push(e));if(null!==t)for(const e of t)y.delete(e),x.delete(e),i.dispatchEvent({type:"planeremoved",data:e});for(const t of n.detectedPlanes)if(y.has(t)){const e=x.get(t);t.lastChangedTime>e&&(x.set(t,t.lastChangedTime),i.dispatchEvent({type:"planechanged",data:t}))}else y.add(t),x.set(t,n.lastChangedTime),i.dispatchEvent({type:"planeadded",data:t})}A=null})),this.setAnimationLoop=function(t){D=t},this.dispose=function(){}}}function la(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map,i(r.map,n.mapTransform)),r.alphaMap&&(n.alphaMap.value=r.alphaMap,i(r.alphaMap,n.alphaMapTransform)),r.bumpMap&&(n.bumpMap.value=r.bumpMap,i(r.bumpMap,n.bumpMapTransform),n.bumpScale.value=r.bumpScale,r.side===l&&(n.bumpScale.value*=-1)),r.normalMap&&(n.normalMap.value=r.normalMap,i(r.normalMap,n.normalMapTransform),n.normalScale.value.copy(r.normalScale),r.side===l&&n.normalScale.value.negate()),r.displacementMap&&(n.displacementMap.value=r.displacementMap,i(r.displacementMap,n.displacementMapTransform),n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap,i(r.emissiveMap,n.emissiveMapTransform)),r.specularMap&&(n.specularMap.value=r.specularMap,i(r.specularMap,n.specularMapTransform)),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);const s=e.get(r).envMap;if(s&&(n.envMap.value=s,n.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;const e=!0===t.useLegacyLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*e,i(r.lightMap,n.lightMapTransform)}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity,i(r.aoMap,n.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,mn(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(t,r):r.isMeshToonMaterial?(n(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(n(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(n(t,r),function(t,n){t.metalness.value=n.metalness,n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap,i(n.metalnessMap,t.metalnessMapTransform));t.roughness.value=n.roughness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap,i(n.roughnessMap,t.roughnessMapTransform));const r=e.get(n).envMap;r&&(t.envMapIntensity.value=n.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===l&&t.clearcoatNormalScale.value.negate()));e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(n(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?n(t,r):r.isMeshDistanceMaterial?(n(t,r),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?n(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ha(t,e,i,n){let r={},s={},a=[];const o=i.isWebGL2?t.getParameter(35375):0;function l(t,e,i){const n=t.value;if(void 0===i[e]){if("number"==typeof n)i[e]=n;else{const t=Array.isArray(n)?n:[n],r=[];for(let e=0;e<t.length;e++)r.push(t[e].clone());i[e]=r}return!0}if("number"==typeof n){if(i[e]!==n)return i[e]=n,!0}else{const t=Array.isArray(i[e])?i[e]:[i[e]],r=Array.isArray(n)?n:[n];for(let e=0;e<t.length;e++){const i=t[e];if(!1===i.equals(r[e]))return i.copy(r[e]),!0}}return!1}function h(t){const e={boundary:0,storage:0};return"number"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function c(e){const i=e.target;i.removeEventListener("dispose",c);const n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(r[i.id]),delete r[i.id],delete s[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,u){let d=r[i.id];void 0===d&&(!function(t){const e=t.uniforms;let i=0;const n=16;let r=0;for(let t=0,s=e.length;t<s;t++){const s=e[t],a={boundary:0,storage:0},o=Array.isArray(s.value)?s.value:[s.value];for(let t=0,e=o.length;t<e;t++){const e=h(o[t]);a.boundary+=e.boundary,a.storage+=e.storage}if(s.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),s.__offset=i,t>0){r=i%n;0!==r&&n-r-a.boundary<0&&(i+=n-r,s.__offset=i)}i+=a.storage}r=i%n,r>0&&(i+=n-r);t.__size=i,t.__cache={}}(i),d=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(35345,n),t.bufferData(35345,r,s),t.bindBuffer(35345,null),t.bindBufferBase(35345,i,n),n}(i),r[i.id]=d,i.addEventListener("dispose",c));const A=u.program;n.updateUBOMapping(i,A);const p=e.render.frame;s[i.id]!==p&&(!function(e){const i=r[e.id],n=e.uniforms,s=e.__cache;t.bindBuffer(35345,i);for(let e=0,i=n.length;e<i;e++){const i=n[e];if(!0===l(i,e,s)){const e=i.__offset,n=Array.isArray(i.value)?i.value:[i.value];let r=0;for(let s=0;s<n.length;s++){const a=n[s],o=h(a);"number"==typeof a?(i.__data[0]=a,t.bufferSubData(35345,e+r,i.__data)):a.isMatrix3?(i.__data[0]=a.elements[0],i.__data[1]=a.elements[1],i.__data[2]=a.elements[2],i.__data[3]=a.elements[0],i.__data[4]=a.elements[3],i.__data[5]=a.elements[4],i.__data[6]=a.elements[5],i.__data[7]=a.elements[0],i.__data[8]=a.elements[6],i.__data[9]=a.elements[7],i.__data[10]=a.elements[8],i.__data[11]=a.elements[0]):(a.toArray(i.__data,r),r+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(35345,e,i.__data)}}t.bindBuffer(35345,null)}(i),s[i.id]=p)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);a=[],r={},s={}}}}function ca(){const t=Gt("canvas");return t.style.display="block",t}class ua{constructor(t={}){const{canvas:e=ca(),context:i=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:d=!1,powerPreference:A="default",failIfMajorPerformanceCaveat:p=!1}=t;let g;this.isWebGLRenderer=!0,g=null!==i?i.getContextAttributes().alpha:a;let f=null,v=null;const y=[],x=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=dt,this.useLegacyLights=!0,this.toneMapping=m,this.toneMappingExposure=1;const _=this;let E=!1,w=0,C=0,I=null,b=-1,S=null;const M=new ee,B=new ee;let T=null,R=e.width,L=e.height,P=1,F=null,O=null;const G=new ee(0,0,R,L),H=new ee(0,0,R,L);let z=!1;const V=new Tn;let W=!1,q=!1,j=null;const Y=new Ue,J=new ae,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function K(){return null===I?P:1}let $,Z,tt,et,it,nt,rt,st,at,ot,lt,ht,ct,ut,At,pt,mt,gt,ft,vt,yt,xt,_t,Et,wt=i;function Ct(t,i){for(let n=0;n<t.length;n++){const r=t[n],s=e.getContext(r,i);if(null!==s)return s}return null}try{const t={alpha:!0,depth:r,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:d,powerPreference:A,failIfMajorPerformanceCaveat:p};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${n}`),e.addEventListener("webglcontextlost",St,!1),e.addEventListener("webglcontextrestored",Mt,!1),e.addEventListener("webglcontextcreationerror",Bt,!1),null===wt){const e=["webgl2","webgl","experimental-webgl"];if(!0===_.isWebGL1Renderer&&e.shift(),wt=Ct(e,t),null===wt)throw Ct(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===wt.getShaderPrecisionFormat&&(wt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function It(){$=new or(wt),Z=new Gn(wt,$,t),$.init(Z),xt=new ea(wt,$,Z),tt=new Zs(wt,$,Z),et=new cr,it=new ks,nt=new ta(wt,$,tt,it,Z,xt,et),rt=new zn(_),st=new ar(_),at=new Ln(wt,Z),_t=new kn(wt,$,at,Z),ot=new lr(wt,at,et,_t),lt=new pr(wt,ot,at,et),ft=new Ar(wt,Z,nt),pt=new Hn(it),ht=new Fs(_,rt,st,$,Z,_t,pt),ct=new la(_,it),ut=new zs,At=new Js($,Z),gt=new Fn(_,rt,st,tt,lt,g,u),mt=new $s(_,lt,Z),Et=new ha(wt,et,Z,tt),vt=new On(wt,$,et,Z),yt=new hr(wt,$,et,Z),et.programs=ht.programs,_.capabilities=Z,_.extensions=$,_.properties=it,_.renderLists=ut,_.shadowMap=mt,_.state=tt,_.info=et}It();const bt=new oa(_,wt);function St(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function Mt(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;const t=et.autoReset,e=mt.enabled,i=mt.autoUpdate,n=mt.needsUpdate,r=mt.type;It(),et.autoReset=t,mt.enabled=e,mt.autoUpdate=i,mt.needsUpdate=n,mt.type=r}function Bt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Tt(t){const e=t.target;e.removeEventListener("dispose",Tt),function(t){(function(t){const e=it.get(t).programs;void 0!==e&&(e.forEach((function(t){ht.releaseProgram(t)})),t.isShaderMaterial&&ht.releaseShaderCache(t))})(t),it.remove(t)}(e)}this.xr=bt,this.getContext=function(){return wt},this.getContextAttributes=function(){return wt.getContextAttributes()},this.forceContextLoss=function(){const t=$.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=$.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(R,L,!1))},this.getSize=function(t){return t.set(R,L)},this.setSize=function(t,i,n=!0){bt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,L=i,e.width=Math.floor(t*P),e.height=Math.floor(i*P),!0===n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(R*P,L*P).floor()},this.setDrawingBufferSize=function(t,i,n){R=t,L=i,P=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return t.copy(M)},this.getViewport=function(t){return t.copy(G)},this.setViewport=function(t,e,i,n){t.isVector4?G.set(t.x,t.y,t.z,t.w):G.set(t,e,i,n),tt.viewport(M.copy(G).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(H)},this.setScissor=function(t,e,i,n){t.isVector4?H.set(t.x,t.y,t.z,t.w):H.set(t,e,i,n),tt.scissor(B.copy(H).multiplyScalar(P).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(t){tt.setScissorTest(z=t)},this.setOpaqueSort=function(t){F=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(gt.getClearColor())},this.setClearColor=function(){gt.setClearColor.apply(gt,arguments)},this.getClearAlpha=function(){return gt.getClearAlpha()},this.setClearAlpha=function(){gt.setClearAlpha.apply(gt,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;t&&(n|=16384),e&&(n|=256),i&&(n|=1024),wt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",St,!1),e.removeEventListener("webglcontextrestored",Mt,!1),e.removeEventListener("webglcontextcreationerror",Bt,!1),ut.dispose(),At.dispose(),it.dispose(),rt.dispose(),st.dispose(),lt.dispose(),_t.dispose(),Et.dispose(),ht.dispose(),bt.dispose(),bt.removeEventListener("sessionstart",Lt),bt.removeEventListener("sessionend",Dt),j&&(j.dispose(),j=null),Qt.stop()},this.renderBufferDirect=function(t,e,i,n,r,s){null===e&&(e=X);const a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,i,n,r){!0!==e.isScene&&(e=X);nt.resetTextureUnits();const s=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===I?_.outputEncoding:!0===I.isXRRenderTarget?I.texture.encoding:dt,l=(n.isMeshStandardMaterial?st:rt).get(n.envMap||a),h=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,c=!!n.normalMap&&!!i.attributes.tangent,u=!!i.morphAttributes.position,d=!!i.morphAttributes.normal,A=!!i.morphAttributes.color,p=n.toneMapped?_.toneMapping:m,g=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,f=void 0!==g?g.length:0,y=it.get(n),x=v.state.lights;if(!0===W&&(!0===q||t!==S)){const e=t===S&&n.id===b;pt.setState(n,t,e)}let E=!1;n.version===y.__version?y.needsLights&&y.lightsStateVersion!==x.state.version||y.outputEncoding!==o||r.isInstancedMesh&&!1===y.instancing?E=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?E=!0:r.isSkinnedMesh||!0!==y.skinning?y.envMap!==l||!0===n.fog&&y.fog!==s?E=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===pt.numPlanes&&y.numIntersection===pt.numIntersection?(y.vertexAlphas!==h||y.vertexTangents!==c||y.morphTargets!==u||y.morphNormals!==d||y.morphColors!==A||y.toneMapping!==p||!0===Z.isWebGL2&&y.morphTargetsCount!==f)&&(E=!0):E=!0:E=!0:E=!0:(E=!0,y.__version=n.version);let w=y.currentProgram;!0===E&&(w=kt(n,e,r));let C=!1,M=!1,B=!1;const T=w.getUniforms(),R=y.uniforms;tt.useProgram(w.program)&&(C=!0,M=!0,B=!0);n.id!==b&&(b=n.id,M=!0);if(C||S!==t){if(T.setValue(wt,"projectionMatrix",t.projectionMatrix),Z.logarithmicDepthBuffer&&T.setValue(wt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),S!==t&&(S=t,M=!0,B=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=T.map.cameraPosition;void 0!==e&&e.setValue(wt,J.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&T.setValue(wt,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||r.isSkinnedMesh)&&T.setValue(wt,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){T.setOptional(wt,r,"bindMatrix"),T.setOptional(wt,r,"bindMatrixInverse");const t=r.skeleton;t&&(Z.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(wt,"boneTexture",t.boneTexture,nt),T.setValue(wt,"boneTextureSize",t.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const D=i.morphAttributes;(void 0!==D.position||void 0!==D.normal||void 0!==D.color&&!0===Z.isWebGL2)&&ft.update(r,i,w);(M||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,T.setValue(wt,"receiveShadow",r.receiveShadow));n.isMeshGouraudMaterial&&null!==n.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);M&&(T.setValue(wt,"toneMappingExposure",_.toneMappingExposure),y.needsLights&&(U=B,(Q=R).ambientLightColor.needsUpdate=U,Q.lightProbe.needsUpdate=U,Q.directionalLights.needsUpdate=U,Q.directionalLightShadows.needsUpdate=U,Q.pointLights.needsUpdate=U,Q.pointLightShadows.needsUpdate=U,Q.spotLights.needsUpdate=U,Q.spotLightShadows.needsUpdate=U,Q.rectAreaLights.needsUpdate=U,Q.hemisphereLights.needsUpdate=U),s&&!0===n.fog&&ct.refreshFogUniforms(R,s),ct.refreshMaterialUniforms(R,n,P,L,j),vs.upload(wt,y.uniformsList,R,nt));var Q,U;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(vs.upload(wt,y.uniformsList,R,nt),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&T.setValue(wt,"center",r.center);if(T.setValue(wt,"modelViewMatrix",r.modelViewMatrix),T.setValue(wt,"normalMatrix",r.normalMatrix),T.setValue(wt,"modelMatrix",r.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++)if(Z.isWebGL2){const i=t[e];Et.update(i,w),Et.bind(i,w)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return w}(t,e,i,n,r);tt.setMaterial(n,a);let l=i.index,h=1;!0===n.wireframe&&(l=ot.getWireframeAttribute(i),h=2);const c=i.drawRange,u=i.attributes.position;let d=c.start*h,A=(c.start+c.count)*h;null!==s&&(d=Math.max(d,s.start*h),A=Math.min(A,(s.start+s.count)*h)),null!==l?(d=Math.max(d,0),A=Math.min(A,l.count)):null!=u&&(d=Math.max(d,0),A=Math.min(A,u.count));const p=A-d;if(p<0||p===1/0)return;let g;_t.setup(r,n,o,i,l);let f=vt;if(null!==l&&(g=at.get(l),f=yt,f.setIndex(g)),r.isMesh)!0===n.wireframe?(tt.setLineWidth(n.wireframeLinewidth*K()),f.setMode(1)):f.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),tt.setLineWidth(t*K()),r.isLineSegments?f.setMode(1):r.isLineLoop?f.setMode(2):f.setMode(3)}else r.isPoints?f.setMode(0):r.isSprite&&f.setMode(4);if(r.isInstancedMesh)f.renderInstances(d,p,r.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);f.renderInstances(d,p,e)}else f.render(d,p)},this.compile=function(t,e){function i(t,e,i){!0===t.transparent&&t.side===h&&!1===t.forceSinglePass?(t.side=l,t.needsUpdate=!0,kt(t,e,i),t.side=o,t.needsUpdate=!0,kt(t,e,i),t.side=h):kt(t,e,i)}v=At.get(t),v.init(),x.push(v),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(v.pushLight(t),t.castShadow&&v.pushShadow(t))})),v.setupLights(_.useLegacyLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){i(n[r],t,e)}else i(n,t,e)})),x.pop(),v=null};let Rt=null;function Lt(){Qt.stop()}function Dt(){Qt.start()}const Qt=new Rn;function Pt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)v.pushLight(t),t.castShadow&&v.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||V.intersectsSprite(t)){n&&J.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Y);const e=lt.update(t),r=t.material;r.visible&&f.push(t,e,r,i,J.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==et.render.frame&&(t.skeleton.update(),t.skeleton.frame=et.render.frame),!t.frustumCulled||V.intersectsObject(t))){n&&J.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Y);const e=lt.update(t),r=t.material;if(Array.isArray(r)){const n=e.groups;for(let s=0,a=n.length;s<a;s++){const a=n[s],o=r[a.materialIndex];o&&o.visible&&f.push(t,e,o,i,J.z,a)}}else r.visible&&f.push(t,e,r,i,J.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Pt(r[t],e,i,n)}function Ut(t,e,i,n){const r=t.opaque,s=t.transmissive,a=t.transparent;v.setupLightsView(i),!0===W&&pt.setGlobalState(_.clippingPlanes,i),s.length>0&&function(t,e,i,n){if(null===j){const t=Z.isWebGL2;j=new ie(1024,1024,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")?N:Q,minFilter:D,samples:t&&!0===c?4:0})}const r=_.getRenderTarget();_.setRenderTarget(j),_.clear();const s=_.toneMapping;_.toneMapping=m,Nt(t,i,n),nt.updateMultisampleRenderTarget(j),nt.updateRenderTargetMipmap(j);let a=!1;for(let t=0,r=e.length;t<r;t++){const r=e[t],s=r.object,o=r.geometry,c=r.material,u=r.group;if(c.side===h&&s.layers.test(n.layers)){const t=c.side;c.side=l,c.needsUpdate=!0,Ft(s,i,n,o,c,u),c.side=t,c.needsUpdate=!0,a=!0}}!0===a&&(nt.updateMultisampleRenderTarget(j),nt.updateRenderTargetMipmap(j));_.setRenderTarget(r),_.toneMapping=s}(r,s,e,i),n&&tt.viewport(M.copy(n)),r.length>0&&Nt(r,e,i),s.length>0&&Nt(s,e,i),a.length>0&&Nt(a,e,i),tt.buffers.depth.setTest(!0),tt.buffers.depth.setMask(!0),tt.buffers.color.setMask(!0),tt.setPolygonOffset(!1)}function Nt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],a=s.object,o=s.geometry,l=null===n?s.material:n,h=s.group;a.layers.test(i.layers)&&Ft(a,e,i,o,l,h)}}function Ft(t,e,i,n,r,s){t.onBeforeRender(_,e,i,n,r,s),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(_,e,i,n,t,s),!0===r.transparent&&r.side===h&&!1===r.forceSinglePass?(r.side=l,r.needsUpdate=!0,_.renderBufferDirect(i,e,n,r,t,s),r.side=o,r.needsUpdate=!0,_.renderBufferDirect(i,e,n,r,t,s),r.side=h):_.renderBufferDirect(i,e,n,r,t,s),t.onAfterRender(_,e,i,n,r,s)}function kt(t,e,i){!0!==e.isScene&&(e=X);const n=it.get(t),r=v.state.lights,s=v.state.shadowsArray,a=r.state.version,o=ht.getParameters(t,r.state,s,e,i),l=ht.getProgramCacheKey(o);let h=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?st:rt).get(t.envMap||n.environment),void 0===h&&(t.addEventListener("dispose",Tt),h=new Map,n.programs=h);let c=h.get(l);if(void 0!==c){if(n.currentProgram===c&&n.lightsStateVersion===a)return Ot(t,o),c}else o.uniforms=ht.getUniforms(t),t.onBuild(i,o,_),t.onBeforeCompile(o,_),c=ht.acquireProgram(o,l),h.set(l,c),n.uniforms=o.uniforms;const u=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=pt.uniform),Ot(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotLightMatrix.value=r.state.spotLightMatrix,u.spotLightMap.value=r.state.spotLightMap,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const d=c.getUniforms(),A=vs.seqWithValue(d.seq,u);return n.currentProgram=c,n.uniformsList=A,c}function Ot(t,e){const i=it.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Qt.setAnimationLoop((function(t){Rt&&Rt(t)})),"undefined"!=typeof self&&Qt.setContext(self),this.setAnimationLoop=function(t){Rt=t,bt.setAnimationLoop(t),null===t?Qt.stop():Qt.start()},bt.addEventListener("sessionstart",Lt),bt.addEventListener("sessionend",Dt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===E)return;!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===bt.enabled&&!0===bt.isPresenting&&(!0===bt.cameraAutoUpdate&&bt.updateCamera(e),e=bt.getCamera()),!0===t.isScene&&t.onBeforeRender(_,t,e,I),v=At.get(t,x.length),v.init(),x.push(v),Y.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),V.setFromProjectionMatrix(Y),q=this.localClippingEnabled,W=pt.init(this.clippingPlanes,q),f=ut.get(t,y.length),f.init(),y.push(f),Pt(t,e,0,_.sortObjects),f.finish(),!0===_.sortObjects&&f.sort(F,O),!0===W&&pt.beginShadows();const i=v.state.shadowsArray;if(mt.render(i,t,e),!0===W&&pt.endShadows(),!0===this.info.autoReset&&this.info.reset(),gt.render(f,t),v.setupLights(_.useLegacyLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];Ut(f,t,n,n.viewport)}}else Ut(f,t,e);null!==I&&(nt.updateMultisampleRenderTarget(I),nt.updateRenderTargetMipmap(I)),!0===t.isScene&&t.onAfterRender(_,t,e),_t.resetDefaultState(),b=-1,S=null,x.pop(),v=x.length>0?x[x.length-1]:null,y.pop(),f=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(t,e,i){it.get(t.texture).__webglTexture=e,it.get(t.depthTexture).__webglTexture=i;const n=it.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===$.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const i=it.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){I=t,w=e,C=i;let n=!0,r=null,s=!1,a=!1;if(t){const i=it.get(t);void 0!==i.__useDefaultFramebuffer?(tt.bindFramebuffer(36160,null),n=!1):void 0===i.__webglFramebuffer?nt.setupRenderTarget(t):i.__hasExternalTextures&&nt.rebindTextures(t,it.get(t.texture).__webglTexture,it.get(t.depthTexture).__webglTexture);const o=t.texture;(o.isData3DTexture||o.isDataArrayTexture||o.isCompressedArrayTexture)&&(a=!0);const l=it.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=l[e],s=!0):r=Z.isWebGL2&&t.samples>0&&!1===nt.useMultisampledRTT(t)?it.get(t).__webglMultisampledFramebuffer:l,M.copy(t.viewport),B.copy(t.scissor),T=t.scissorTest}else M.copy(G).multiplyScalar(P).floor(),B.copy(H).multiplyScalar(P).floor(),T=z;if(tt.bindFramebuffer(36160,r)&&Z.drawBuffers&&n&&tt.drawBuffers(t,r),tt.viewport(M),tt.scissor(B),tt.setScissorTest(T),s){const n=it.get(t.texture);wt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(a){const n=it.get(t.texture),r=e||0;wt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}b=-1},this.readRenderTargetPixels=function(t,e,i,n,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=it.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){tt.bindFramebuffer(36160,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==k&&xt.convert(o)!==wt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=l===N&&($.has("EXT_color_buffer_half_float")||Z.isWebGL2&&$.has("EXT_color_buffer_float"));if(!(l===Q||xt.convert(l)===wt.getParameter(35738)||l===U&&(Z.isWebGL2||$.has("OES_texture_float")||$.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&wt.readPixels(e,i,n,r,xt.convert(o),xt.convert(l),s)}finally{const t=null!==I?it.get(I).__webglFramebuffer:null;tt.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n);nt.setTexture2D(e,0),wt.copyTexSubImage2D(3553,i,0,0,t.x,t.y,r,s),tt.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,s=e.image.height,a=xt.convert(i.format),o=xt.convert(i.type);nt.setTexture2D(i,0),wt.pixelStorei(37440,i.flipY),wt.pixelStorei(37441,i.premultiplyAlpha),wt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?wt.texSubImage2D(3553,n,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?wt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):wt.texSubImage2D(3553,n,t.x,t.y,a,o,e.image),0===n&&i.generateMipmaps&&wt.generateMipmap(3553),tt.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(_.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=xt.convert(n.format),h=xt.convert(n.type);let c;if(n.isData3DTexture)nt.setTexture3D(n,0),c=32879;else{if(!n.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");nt.setTexture2DArray(n,0),c=35866}wt.pixelStorei(37440,n.flipY),wt.pixelStorei(37441,n.premultiplyAlpha),wt.pixelStorei(3317,n.unpackAlignment);const u=wt.getParameter(3314),d=wt.getParameter(32878),A=wt.getParameter(3316),p=wt.getParameter(3315),m=wt.getParameter(32877),g=i.isCompressedTexture?i.mipmaps[0]:i.image;wt.pixelStorei(3314,g.width),wt.pixelStorei(32878,g.height),wt.pixelStorei(3316,t.min.x),wt.pixelStorei(3315,t.min.y),wt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isData3DTexture?wt.texSubImage3D(c,r,e.x,e.y,e.z,s,a,o,l,h,g.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),wt.compressedTexSubImage3D(c,r,e.x,e.y,e.z,s,a,o,l,g.data)):wt.texSubImage3D(c,r,e.x,e.y,e.z,s,a,o,l,h,g),wt.pixelStorei(3314,u),wt.pixelStorei(32878,d),wt.pixelStorei(3316,A),wt.pixelStorei(3315,p),wt.pixelStorei(32877,m),0===r&&n.generateMipmaps&&wt.generateMipmap(c),tt.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?nt.setTextureCube(t,0):t.isData3DTexture?nt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?nt.setTexture2DArray(t,0):nt.setTexture2D(t,0),tt.unbindTexture()},this.resetState=function(){w=0,C=0,I=null,tt.reset(),_t.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}}(class extends ua{}).prototype.isWebGL1Renderer=!0;class da extends oi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(t){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=t}}class Aa{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=yt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=St()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=St()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=St()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const pa=new ae;class ma{constructor(t,e,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)pa.fromBufferAttribute(this,e),pa.applyMatrix4(t),this.setXYZ(e,pa.x,pa.y,pa.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)pa.fromBufferAttribute(this,e),pa.applyNormalMatrix(t),this.setXYZ(e,pa.x,pa.y,pa.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)pa.fromBufferAttribute(this,e),pa.transformDirection(t),this.setXYZ(e,pa.x,pa.y,pa.z);return this}setX(t,e){return this.normalized&&(e=Pt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Pt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Pt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Pt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Qt(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Qt(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Qt(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Qt(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pt(e,this.array),i=Pt(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pt(e,this.array),i=Pt(i,this.array),n=Pt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=Pt(e,this.array),i=Pt(i,this.array),n=Pt(n,this.array),r=Pt(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new Qi(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ma(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const ga=new ae,fa=new ee,va=new ee,ya=new ae,xa=new Ue,_a=new ae;class Ea extends cn{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ue,this.bindMatrixInverse=new Ue,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new he),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)_a.fromBufferAttribute(e,t),this.applyBoneTransform(t,_a),this.boundingBox.expandByPoint(_a)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Se),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)_a.fromBufferAttribute(e,t),this.applyBoneTransform(t,_a),this.boundingSphere.expandByPoint(_a)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new ee,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.fromBufferAttribute(e,i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const i=this.skeleton,n=this.geometry;fa.fromBufferAttribute(n.attributes.skinIndex,t),va.fromBufferAttribute(n.attributes.skinWeight,t),ga.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=va.getComponent(t);if(0!==n){const r=fa.getComponent(t);xa.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(ya.copy(ga).applyMatrix4(xa),n)}}return e.applyMatrix4(this.bindMatrixInverse)}boneTransform(t,e){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(t,e)}}class wa extends oi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ca extends te{constructor(t=null,e=1,i=1,n,r,s,a,o,l=M,h=M,c,u){super(null,s,a,o,l,h,n,r,c,u),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ia=new Ue,ba=new Ue;class Sa{constructor(t=[],e=[]){this.uuid=St(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Ue)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Ue;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let n=0,r=t.length;n<r;n++){const r=t[n]?t[n].matrixWorld:ba;Ia.multiplyMatrices(r,e[n]),Ia.toArray(i,16*n)}null!==n&&(n.needsUpdate=!0)}clone(){return new Sa(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=Lt(t),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const i=new Ca(e,t,t,k,U);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,n=t.bones.length;i<n;i++){const n=t.bones[i];let r=e[n];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),r=new wa),this.bones.push(r),this.boneInverses.push((new Ue).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,i=this.boneInverses;for(let n=0,r=e.length;n<r;n++){const r=e[n];t.bones.push(r.uuid);const s=i[n];t.boneInverses.push(s.toArray())}return t}}class Ma extends Qi{constructor(t,e,i,n=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Ba=new Ue,Ta=new Ue,Ra=[],La=new he,Da=new Ue,Qa=new cn,Pa=new Se;class Ua extends cn{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Ma(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<i;t++)this.setMatrixAt(t,Da)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new he),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,Ba),La.copy(t.boundingBox).applyMatrix4(Ba),this.boundingBox.union(La)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new Se),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,Ba),Pa.copy(t.boundingSphere).applyMatrix4(Ba),this.boundingSphere.union(Pa)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const i=this.matrixWorld,n=this.count;if(Qa.geometry=this.geometry,Qa.material=this.material,void 0!==Qa.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Pa.copy(this.boundingSphere),Pa.applyMatrix4(i),!1!==t.ray.intersectsSphere(Pa)))for(let r=0;r<n;r++){this.getMatrixAt(r,Ba),Ta.multiplyMatrices(i,Ba),Qa.matrixWorld=Ta,Qa.raycast(t,Ra);for(let t=0,i=Ra.length;t<i;t++){const i=Ra[t];i.instanceId=r,i.object=this,e.push(i)}Ra.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Ma(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class Na extends _i{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new bi(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Fa=new ae,ka=new ae,Oa=new Ue,Ga=new Pe,Ha=new Se;class za extends oi{constructor(t=new Wi,e=new Na){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)Fa.fromBufferAttribute(e,t-1),ka.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Fa.distanceTo(ka);t.setAttribute("lineDistance",new Ni(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,s=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Ha.copy(i.boundingSphere),Ha.applyMatrix4(n),Ha.radius+=r,!1===t.ray.intersectsSphere(Ha))return;Oa.copy(n).invert(),Ga.copy(t.ray).applyMatrix4(Oa);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=new ae,h=new ae,c=new ae,u=new ae,d=this.isLineSegments?2:1,A=i.index,p=i.attributes.position;if(null!==A){for(let i=Math.max(0,s.start),n=Math.min(A.count,s.start+s.count)-1;i<n;i+=d){const n=A.getX(i),r=A.getX(i+1);l.fromBufferAttribute(p,n),h.fromBufferAttribute(p,r);if(Ga.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);const s=t.ray.origin.distanceTo(u);s<t.near||s>t.far||e.push({distance:s,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,s.start),n=Math.min(p.count,s.start+s.count)-1;i<n;i+=d){l.fromBufferAttribute(p,i),h.fromBufferAttribute(p,i+1);if(Ga.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(u);n<t.near||n>t.far||e.push({distance:n,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}const Va=new ae,Wa=new ae;class qa extends za{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)Va.fromBufferAttribute(e,t),Wa.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Va.distanceTo(Wa);t.setAttribute("lineDistance",new Ni(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ja extends za{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Ya extends _i{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new bi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Ja=new Ue,Xa=new Pe,Ka=new Se,$a=new ae;class Za extends oi{constructor(t=new Wi,e=new Ya){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold,s=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Ka.copy(i.boundingSphere),Ka.applyMatrix4(n),Ka.radius+=r,!1===t.ray.intersectsSphere(Ka))return;Ja.copy(n).invert(),Xa.copy(t.ray).applyMatrix4(Ja);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=i.index,h=i.attributes.position;if(null!==l){for(let i=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);i<r;i++){const r=l.getX(i);$a.fromBufferAttribute(h,r),to($a,r,o,n,t,e,this)}}else{for(let i=Math.max(0,s.start),r=Math.min(h.count,s.start+s.count);i<r;i++)$a.fromBufferAttribute(h,i),to($a,i,o,n,t,e,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function to(t,e,i,n,r,s,a){const o=Xa.distanceSqToPoint(t);if(o<i){const i=new ae;Xa.closestPointToPoint(t,i),i.applyMatrix4(n);const l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,object:a})}}class eo extends te{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:R,this.magFilter=void 0!==r?r:R,this.generateMipmaps=!1;const h=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){h.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class io extends te{constructor(t,e,i,n,r,s,a,o,l,h,c,u){super(null,s,a,o,l,h,n,r,c,u),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class no extends io{constructor(t,e,i,n,r,s){super(t,e,i,r,s),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=b}}class ro extends te{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class so extends _i{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new bi(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new bi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pt,this.normalScale=new Nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ao extends so{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Nt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Mt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new bi(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new bi(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new bi(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}function oo(t,e,i){return ho(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)}function lo(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function ho(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function co(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i}function uo(t,e,i){const n=t.length,r=new t.constructor(n);for(let s=0,a=0;a!==n;++s){const n=i[s]*e;for(let i=0;i!==e;++i)r[a++]=t[n+i]}return r}function Ao(t,e,i,n){let r=1,s=t[0];for(;void 0!==s&&void 0===s[n];)s=t[r++];if(void 0===s)return;let a=s[n];if(void 0!==a)if(Array.isArray(a))do{a=s[n],void 0!==a&&(e.push(s.time),i.push.apply(i,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[n],void 0!==a&&(e.push(s.time),a.toArray(i,i.length)),s=t[r++]}while(void 0!==s);else do{a=s[n],void 0!==a&&(e.push(s.time),i.push(a)),s=t[r++]}while(void 0!==s)}class po{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let s;i:{n:if(!(t<n)){for(let s=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===s)break;if(r=n,n=e[++i],t<n)break e}s=e.length;break i}if(t>=r)break t;{const a=e[1];t<a&&(i=2,r=a);for(let s=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===s)break;if(n=r,r=e[--i-1],t>=r)break e}s=i,i=0}}for(;i<s;){const n=i+s>>>1;t<e[n]?s=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class mo extends po{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:at,endingEnd:at}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,s=t+1,a=n[r],o=n[s];if(void 0===a)switch(this.getSettings_().endingStart){case ot:r=t,a=2*e-i;break;case lt:r=n.length-2,a=e+n[r]-n[r+1];break;default:r=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case ot:s=t,o=2*i-e;break;case lt:s=1,o=i+n[1]-n[0];break;default:s=t-1,o=e}const l=.5*(i-e),h=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-i),this._offsetPrev=r*h,this._offsetNext=s*h}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,A=(i-e)/(n-e),p=A*A,m=p*A,g=-u*m+2*u*p-u*A,f=(1+u)*m+(-1.5-2*u)*p+(-.5+u)*A+1,v=(-1-d)*m+(1.5+d)*p+.5*A,y=d*m-d*p;for(let t=0;t!==a;++t)r[t]=g*s[h+t]+f*s[l+t]+v*s[o+t]+y*s[c+t];return r}}class go extends po{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,h=(i-e)/(n-e),c=1-h;for(let t=0;t!==a;++t)r[t]=s[l+t]*c+s[o+t]*h;return r}}class fo extends po{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class vo{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=lo(e,this.TimeBufferType),this.values=lo(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:lo(t.times,Array),values:lo(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new fo(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new go(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new mo(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case nt:e=this.InterpolantFactoryMethodDiscrete;break;case rt:e=this.InterpolantFactoryMethodLinear;break;case st:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return nt;case this.InterpolantFactoryMethodLinear:return rt;case this.InterpolantFactoryMethodSmooth:return st}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,s=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==s&&i[s]>e;)--s;if(++s,0!==r||s!==n){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=oo(i,r,s),this.values=oo(this.values,r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==s&&s>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,s),t=!1;break}s=n}if(void 0!==n&&ho(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=oo(this.times),e=oo(this.values),i=this.getValueSize(),n=this.getInterpolation()===st,r=t.length-1;let s=1;for(let a=1;a<r;++a){let r=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)r=!0;else{const t=a*i,n=t-i,s=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[n+a]||i!==e[s+a]){r=!0;break}}}if(r){if(a!==s){t[s]=t[a];const n=a*i,r=s*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*i,n=s*i,a=0;a!==i;++a)e[n+a]=e[t+a];++s}return s!==t.length?(this.times=oo(t,0,s),this.values=oo(e,0,s*i)):(this.times=t,this.values=e),this}clone(){const t=oo(this.times,0),e=oo(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}vo.prototype.TimeBufferType=Float32Array,vo.prototype.ValueBufferType=Float32Array,vo.prototype.DefaultInterpolation=rt;class yo extends vo{}yo.prototype.ValueTypeName="bool",yo.prototype.ValueBufferType=Array,yo.prototype.DefaultInterpolation=nt,yo.prototype.InterpolantFactoryMethodLinear=void 0,yo.prototype.InterpolantFactoryMethodSmooth=void 0;class xo extends vo{}xo.prototype.ValueTypeName="color";class _o extends vo{}_o.prototype.ValueTypeName="number";class Eo extends po{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(i-e)/(n-e);let l=t*a;for(let t=l+a;l!==t;l+=4)se.slerpFlat(r,0,s,l-a,s,l,o);return r}}class wo extends vo{InterpolantFactoryMethodLinear(t){return new Eo(this.times,this.values,this.getValueSize(),t)}}wo.prototype.ValueTypeName="quaternion",wo.prototype.DefaultInterpolation=rt,wo.prototype.InterpolantFactoryMethodSmooth=void 0;class Co extends vo{}Co.prototype.ValueTypeName="string",Co.prototype.ValueBufferType=Array,Co.prototype.DefaultInterpolation=nt,Co.prototype.InterpolantFactoryMethodLinear=void 0,Co.prototype.InterpolantFactoryMethodSmooth=void 0;class Io extends vo{}Io.prototype.ValueTypeName="vector";class bo{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=St(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(So(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(vo.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,s=[];for(let t=0;t<r;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const l=co(a);a=uo(a,1,l),o=uo(o,1,l),n||0!==a[0]||(a.push(r),o.push(o[0])),s.push(new _o(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/i))}return new this(t,-1,s)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.name.match(r);if(s&&s.length>1){const t=s[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const s=[];for(const t in n)s.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const s=[],a=[];Ao(i,s,a,n),0!==s.length&&r.push(new t(e,s,a))}},n=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],s=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),s.push(n.morphTarget===i?1:0)}n.push(new _o(".morphTargetInfluence["+i+"]",t,s))}o=t.length*s}else{const s=".bones["+e[t].name+"]";i(Io,s+".position",r,"pos",n),i(wo,s+".quaternion",r,"rot",n),i(Io,s+".scale",r,"scl",n)}}if(0===n.length)return null;return new this(r,o,n,a)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function So(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _o;case"vector":case"vector2":case"vector3":case"vector4":return Io;case"color":return xo;case"quaternion":return wo;case"bool":case"boolean":return yo;case"string":return Co}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Ao(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Mo={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Bo{constructor(t,e,i){const n=this;let r,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===s&&void 0!==n.onStart&&n.onStart(t,a,o),s=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(s=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const To=new Bo;class Ro{constructor(t){this.manager=void 0!==t?t:To,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const Lo={};class Do extends Error{constructor(t,e){super(t),this.response=e}}class Qo extends Ro{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Mo.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Lo[t])return void Lo[t].push({onLoad:e,onProgress:i,onError:n});Lo[t]=[],Lo[t].push({onLoad:e,onProgress:i,onError:n});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Lo[t],n=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:r})=>{if(n)t.close();else{o+=r.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(r),e()}}))}()}});return new Response(l)}throw new Do(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{Mo.add(t,e);const i=Lo[t];delete Lo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=Lo[t];if(void 0===i)throw this.manager.itemError(t),e;delete Lo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Po extends Ro{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Mo.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=Gt("img");function o(){h(),Mo.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){h(),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}function h(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class Uo extends Ro{constructor(t){super(t)}load(t,e,i,n){const r=this,s=new Ca,a=new Qo(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,(function(t){const i=r.parse(t);i&&(void 0!==i.image?s.image=i.image:void 0!==i.data&&(s.image.width=i.width,s.image.height=i.height,s.image.data=i.data),s.wrapS=void 0!==i.wrapS?i.wrapS:b,s.wrapT=void 0!==i.wrapT?i.wrapT:b,s.magFilter=void 0!==i.magFilter?i.magFilter:R,s.minFilter=void 0!==i.minFilter?i.minFilter:R,s.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.encoding&&(s.encoding=i.encoding),void 0!==i.flipY&&(s.flipY=i.flipY),void 0!==i.format&&(s.format=i.format),void 0!==i.type&&(s.type=i.type),void 0!==i.mipmaps&&(s.mipmaps=i.mipmaps,s.minFilter=D),1===i.mipmapCount&&(s.minFilter=R),void 0!==i.generateMipmaps&&(s.generateMipmaps=i.generateMipmaps),s.needsUpdate=!0,e&&e(s,i))}),i,n),s}}class No extends Ro{constructor(t){super(t)}load(t,e,i,n){const r=new te,s=new Po(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}class Fo extends oi{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new bi(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}const ko=new Ue,Oo=new ae,Go=new ae;class Ho{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Nt(512,512),this.map=null,this.mapPass=null,this.matrix=new Ue,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Tn,this._frameExtents=new Nt(1,1),this._viewportCount=1,this._viewports=[new ee(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Oo.setFromMatrixPosition(t.matrixWorld),e.position.copy(Oo),Go.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Go),e.updateMatrixWorld(),ko.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ko),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ko)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class zo extends Ho{constructor(){super(new yn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,i=2*bt*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Vo extends Fo{constructor(t,e,i=0,n=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(oi.DEFAULT_UP),this.updateMatrix(),this.target=new oi,this.distance=i,this.angle=n,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new zo}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Wo=new Ue,qo=new ae,jo=new ae;class Yo extends Ho{constructor(){super(new yn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Nt(4,2),this._viewportCount=6,this._viewports=[new ee(2,1,1,1),new ee(0,1,1,1),new ee(3,1,1,1),new ee(1,1,1,1),new ee(3,0,1,1),new ee(1,0,1,1)],this._cubeDirections=[new ae(1,0,0),new ae(-1,0,0),new ae(0,0,1),new ae(0,0,-1),new ae(0,1,0),new ae(0,-1,0)],this._cubeUps=[new ae(0,1,0),new ae(0,1,0),new ae(0,1,0),new ae(0,1,0),new ae(0,0,1),new ae(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,n=this.matrix,r=t.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),qo.setFromMatrixPosition(t.matrixWorld),i.position.copy(qo),jo.copy(i.position),jo.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(jo),i.updateMatrixWorld(),n.makeTranslation(-qo.x,-qo.y,-qo.z),Wo.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Wo)}}class Jo extends Fo{constructor(t,e,i=0,n=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new Yo}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Xo extends Ho{constructor(){super(new Vn(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ko extends Fo{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(oi.DEFAULT_UP),this.updateMatrix(),this.target=new oi,this.shadow=new Xo}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class $o{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new ae)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*n),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*i),e.addScaledVector(s[4],i*n*1.092548),e.addScaledVector(s[5],n*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],i*r*1.092548),e.addScaledVector(s[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*n),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*i),e.addScaledVector(s[4],.858086*i*n),e.addScaledVector(s[5],.858086*n*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*i*r),e.addScaledVector(s[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}class Zo extends Fo{constructor(t=new $o,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class tl{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class el extends Ro{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Mo.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(i){Mo.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}class il{constructor(t,e,i){let n,r,s;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,r=t*n+n;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==n;++t)i[r+t]=i[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}s>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){se.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const s=this._workIndex*r;se.multiplyQuaternionsFlat(t,s,t,e,t,i),se.slerpFlat(t,e,t,e,t,s,n)}_lerp(t,e,i,n,r){const s=1-n;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[i+a]*n}}_lerpAdditive(t,e,i,n,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[i+s]*n}}}const nl="\\[\\]\\.:\\/",rl=new RegExp("["+nl+"]","g"),sl="[^"+nl+"]",al="[^"+nl.replace("\\.","")+"]",ol=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",sl)+/(WCOD+)?/.source.replace("WCOD",al)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sl)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sl)+"$"),ll=["material","materials","bones","map"];class hl{constructor(t,e,i){this.path=e,this.parsedPath=i||hl.parseTrackName(e),this.node=hl.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new hl.Composite(t,e,i):new hl(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(rl,"")}static parseTrackName(t){const e=ol.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==ll.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const s=i(r.children);if(s)return s}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=hl.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const s=t[n];if(void 0===s){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(o=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}hl.Composite=class{constructor(t,e,i){const n=i||hl.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},hl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},hl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},hl.prototype.GetterByBindingType=[hl.prototype._getValue_direct,hl.prototype._getValue_array,hl.prototype._getValue_arrayElement,hl.prototype._getValue_toArray],hl.prototype.SetterByBindingTypeAndVersioning=[[hl.prototype._setValue_direct,hl.prototype._setValue_direct_setNeedsUpdate,hl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[hl.prototype._setValue_array,hl.prototype._setValue_array_setNeedsUpdate,hl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[hl.prototype._setValue_arrayElement,hl.prototype._setValue_arrayElement_setNeedsUpdate,hl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[hl.prototype._setValue_fromArray,hl.prototype._setValue_fromArray_setNeedsUpdate,hl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class cl{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:at,endingEnd:at};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=et,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,r=n/i,s=i/n;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+i,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;n<0||0===i?e=0:(this._startTime=null,e=i*n)}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(s),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(s),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const s=i===it;if(0===t)return-1===r?n:s&&1==(1&r)?e-n:n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(s&&1==(1&r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=ot,n.endingEnd=ot):(n.endingStart=t?this.zeroSlopeAtStart?ot:at:lt,n.endingEnd=e?this.zeroSlopeAtEnd?ot:at:lt)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let s=this._weightInterpolant;null===s&&(s=n._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}const ul=new Float32Array(1);class dl extends Et{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,s=t._propertyBindings,a=t._interpolants,o=i.uuid,l=this._bindingsByRootAndName;let h=l[o];void 0===h&&(h={},l[o]=h);for(let t=0;t!==r;++t){const r=n[t],l=r.name;let c=h[l];if(void 0!==c)++c.referenceCount,s[t]=c;else{if(c=s[t],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;c=new il(hl.create(i,l,n),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),s[t]=c}a[t].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),s.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,l=o[o.length-1],h=t._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),t._byClipCacheIndex=null;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,r=this._bindings;let s=n[e];void 0===s&&(s={},n[e]=s),s[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,s=this._bindingsByRootAndName,a=s[n],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete a[r],0===Object.keys(a).length&&delete s[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new go(new Float32Array(2),new Float32Array(2),1,ul),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const n=e||this._root,r=n.uuid;let s="string"==typeof t?bo.findByName(n,t):t;const a=null!==s?s.uuid:t,o=this._actionsByClip[a];let l=null;if(void 0===i&&(i=null!==s?s.blendMode:ht),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=o.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const h=new cl(this,s,e,i);return this._bindAction(h,l),this._addInactiveAction(h,a,r),h}existingAction(t,e){const i=e||this._root,n=i.uuid,r="string"==typeof t?bo.findByName(i,t):t,s=r?r.uuid:t,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(n,t,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){const t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const r=n._cacheIndex,s=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}function Al(t,e){return t.distance-e.distance}function pl(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n){const n=t.children;for(let t=0,r=n.length;t<r;t++)pl(n[t],e,i,!0)}}class ml{constructor(t=1,e=0,i=0){return this.radius=t,this.phi=e,this.theta=i,this}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(Mt(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:n}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=n)
/**
 * @license
 * Copyright 2019 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */;const gl=window,fl=gl.ShadowRoot&&(void 0===gl.ShadyCSS||gl.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vl=Symbol(),yl=new WeakMap;class xl{constructor(t,e,i){if(this._$cssResult$=!0,i!==vl)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(fl&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=yl.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&yl.set(e,t))}return t}toString(){return this.cssText}}const _l=fl?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new xl("string"==typeof t?t:t+"",void 0,vl))(e)})(t):t
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */;var El;const wl=window,Cl=wl.trustedTypes,Il=Cl?Cl.emptyScript:"",bl=wl.reactiveElementPolyfillSupport,Sl={toAttribute(t,e){switch(e){case Boolean:t=t?Il:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},Ml=(t,e)=>e!==t&&(e==e||t==t),Bl={attribute:!0,type:String,converter:Sl,reflect:!1,hasChanged:Ml};class Tl extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=Bl){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||Bl}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(_l(t))}else void 0!==t&&e.push(_l(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{fl?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=gl.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=Bl){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:Sl).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:Sl;this._$El=r,this[r]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||Ml)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
var Rl;Tl.finalized=!0,Tl.elementProperties=new Map,Tl.elementStyles=[],Tl.shadowRootOptions={mode:"open"},null==bl||bl({ReactiveElement:Tl}),(null!==(El=wl.reactiveElementVersions)&&void 0!==El?El:wl.reactiveElementVersions=[]).push("1.6.1");const Ll=window,Dl=Ll.trustedTypes,Ql=Dl?Dl.createPolicy("lit-html",{createHTML:t=>t}):void 0,Pl="$lit$",Ul=`lit$${(Math.random()+"").slice(9)}$`,Nl="?"+Ul,Fl=`<${Nl}>`,kl=document,Ol=()=>kl.createComment(""),Gl=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Hl=Array.isArray,zl="[ \t\n\f\r]",Vl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Wl=/-->/g,ql=/>/g,jl=RegExp(`>|${zl}(?:([^\\s"'>=/]+)(${zl}*=${zl}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Yl=/'/g,Jl=/"/g,Xl=/^(?:script|style|textarea|title)$/i,Kl=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),$l=Symbol.for("lit-noChange"),Zl=Symbol.for("lit-nothing"),th=new WeakMap,eh=kl.createTreeWalker(kl,129,null,!1),ih=(t,e)=>{const i=t.length-1,n=[];let r,s=2===e?"<svg>":"",a=Vl;for(let e=0;e<i;e++){const i=t[e];let o,l,h=-1,c=0;for(;c<i.length&&(a.lastIndex=c,l=a.exec(i),null!==l);)c=a.lastIndex,a===Vl?"!--"===l[1]?a=Wl:void 0!==l[1]?a=ql:void 0!==l[2]?(Xl.test(l[2])&&(r=RegExp("</"+l[2],"g")),a=jl):void 0!==l[3]&&(a=jl):a===jl?">"===l[0]?(a=null!=r?r:Vl,h=-1):void 0===l[1]?h=-2:(h=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?jl:'"'===l[3]?Jl:Yl):a===Jl||a===Yl?a=jl:a===Wl||a===ql?a=Vl:(a=jl,r=void 0);const u=a===jl&&t[e+1].startsWith("/>")?" ":"";s+=a===Vl?i+Fl:h>=0?(n.push(o),i.slice(0,h)+Pl+i.slice(h)+Ul+u):i+Ul+(-2===h?(n.push(void 0),e):u)}const o=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==Ql?Ql.createHTML(o):o,n]};class nh{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,s=0;const a=t.length-1,o=this.parts,[l,h]=ih(t,e);if(this.el=nh.createElement(l,i),eh.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=eh.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(Pl)||e.startsWith(Ul)){const i=h[s++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+Pl).split(Ul),e=/([.?@])?(.*)/.exec(i);o.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?lh:"?"===e[1]?ch:"@"===e[1]?uh:oh})}else o.push({type:6,index:r})}for(const e of t)n.removeAttribute(e)}if(Xl.test(n.tagName)){const t=n.textContent.split(Ul),e=t.length-1;if(e>0){n.textContent=Dl?Dl.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],Ol()),eh.nextNode(),o.push({type:2,index:++r});n.append(t[e],Ol())}}}else if(8===n.nodeType)if(n.data===Nl)o.push({type:2,index:r});else{let t=-1;for(;-1!==(t=n.data.indexOf(Ul,t+1));)o.push({type:7,index:r}),t+=Ul.length-1}r++}}static createElement(t,e){const i=kl.createElement("template");return i.innerHTML=t,i}}function rh(t,e,i=t,n){var r,s,a,o;if(e===$l)return e;let l=void 0!==n?null===(r=i._$Co)||void 0===r?void 0:r[n]:i._$Cl;const h=Gl(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,n)),void 0!==n?(null!==(a=(o=i)._$Co)&&void 0!==a?a:o._$Co=[])[n]=l:i._$Cl=l),void 0!==l&&(e=rh(t,l._$AS(t,e.values),l,n)),e}class sh{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:n}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:kl).importNode(i,!0);eh.currentNode=r;let s=eh.nextNode(),a=0,o=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new ah(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new dh(s,this,t)),this._$AV.push(e),l=n[++o]}a!==(null==l?void 0:l.index)&&(s=eh.nextNode(),a++)}return r}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class ah{constructor(t,e,i,n){var r;this.type=2,this._$AH=Zl,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cp=null===(r=null==n?void 0:n.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=rh(this,t,e),Gl(t)?t===Zl||null==t||""===t?(this._$AH!==Zl&&this._$AR(),this._$AH=Zl):t!==this._$AH&&t!==$l&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>Hl(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==Zl&&Gl(this._$AH)?this._$AA.nextSibling.data=t:this.$(kl.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=nh.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(i);else{const t=new sh(r,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=th.get(t.strings);return void 0===e&&th.set(t.strings,e=new nh(t)),e}T(t){Hl(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const r of t)n===e.length?e.push(i=new ah(this.k(Ol()),this.k(Ol()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class oh{constructor(t,e,i,n,r){this.type=1,this._$AH=Zl,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Zl}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let s=!1;if(void 0===r)t=rh(this,t,e,0),s=!Gl(t)||t!==this._$AH&&t!==$l,s&&(this._$AH=t);else{const n=t;let a,o;for(t=r[0],a=0;a<r.length-1;a++)o=rh(this,n[i+a],e,a),o===$l&&(o=this._$AH[a]),s||(s=!Gl(o)||o!==this._$AH[a]),o===Zl?t=Zl:t!==Zl&&(t+=(null!=o?o:"")+r[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===Zl?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class lh extends oh{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Zl?void 0:t}}const hh=Dl?Dl.emptyScript:"";class ch extends oh{constructor(){super(...arguments),this.type=4}j(t){t&&t!==Zl?this.element.setAttribute(this.name,hh):this.element.removeAttribute(this.name)}}class uh extends oh{constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=rh(this,t,e,0))&&void 0!==i?i:Zl)===$l)return;const n=this._$AH,r=t===Zl&&n!==Zl||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==Zl&&(n===Zl||r);r&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class dh{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){rh(this,t)}}const Ah=Ll.litHtmlPolyfillSupport;null==Ah||Ah(nh,ah),(null!==(Rl=Ll.litHtmlVersions)&&void 0!==Rl?Rl:Ll.litHtmlVersions=[]).push("2.7.2");const ph=(t,e,i)=>{var n,r;const s=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let a=s._$litPart$;if(void 0===a){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=a=new ah(e.insertBefore(Ol(),t),t,void 0,null!=i?i:{})}return a._$AI(t),a
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */};var mh,gh;class fh extends Tl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ph(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return $l}}fh.finalized=!0,fh._$litElement$=!0,null===(mh=globalThis.litElementHydrateSupport)||void 0===mh||mh.call(globalThis,{LitElement:fh});const vh=globalThis.litElementPolyfillSupport;null==vh||vh({LitElement:fh}),(null!==(gh=globalThis.litElementVersions)&&void 0!==gh?gh:globalThis.litElementVersions=[]).push("3.3.1");
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const yh=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,xh=yh&&null!=self.XRSession.prototype.requestHitTestSource,_h=null!=self.ResizeObserver,Eh=null!=self.IntersectionObserver,wh=xh;(()=>{const t=navigator.userAgent||navigator.vendor||self.opera;let e=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)})(),/\bCrOS\b/.test(navigator.userAgent);const Ch=/android/i.test(navigator.userAgent),Ih=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;/Safari\//.test(navigator.userAgent);const bh=/firefox/i.test(navigator.userAgent),Sh=/OculusBrowser/.test(navigator.userAgent);Ih&&/CriOS\//.test(navigator.userAgent);const Mh=Ch&&!bh&&!Sh,Bh=Boolean(window.webkit&&window.webkit.messageHandlers),Th=(()=>{if(Ih){if(Bh)return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));{const t=document.createElement("a");return Boolean(t.relList&&t.relList.supports&&t.relList.supports("ar"))}}return!1})(),Rh=t=>t&&"null"!==t?Dh(t):null,Lh=()=>{if(wh)return;const t=[];throw yh||t.push("WebXR Device API"),xh||t.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${t.join(", ")}`)},Dh=t=>new URL(t,window.location.toString()).toString(),Qh=(t,e)=>{let i=null;return(...n)=>{null!=i&&self.clearTimeout(i),i=self.setTimeout((()=>{i=null,t(...n)}),e)}},Ph=(t,e,i)=>Math.max(e,Math.min(i,t)),Uh=(()=>{const t=(()=>{var t;if(null===(t=document.documentElement.getAttribute("itemtype"))||void 0===t?void 0:t.includes("schema.org/SearchResultsPage"))return!0;const e=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const t of e)if("viewport"===t.name)return!0;return!1})();return t||console.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>t?window.devicePixelRatio:1})(),Nh=(()=>{const t=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(t)})();
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var Fh=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const kh=Symbol("currentEnvironmentMap"),Oh=Symbol("currentBackground"),Gh=Symbol("updateEnvironment"),Hh=Symbol("cancelEnvironmentUpdate");
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const zh=Kl`
<style>
:host {
  display: block;
  position: relative;
  contain: strict;
  width: 300px;
  height: 150px;
}

.container {
  position: relative;
  overflow: hidden;
}

.userInput {
  width: 100%;
  height: 100%;
  display: none;
  position: relative;
  outline-offset: -1px;
  outline-width: 1px;
}

canvas {
  position: absolute;
  display: none;
  pointer-events: none;
  /* NOTE(cdata): Chrome 76 and below apparently have a bug
   * that causes our canvas not to display pixels unless it is
   * on its own render layer
   * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
   */
  transform: translateZ(0);
}

.show {
  display: block;
}

/* Adapted from HTML5 Boilerplate
 *
 * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
.screen-reader-only {
  border: 0;
  left: 0;
  top: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  pointer-events: none;
}

.slot {
  position: absolute;
  pointer-events: none;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.slot > * {
  pointer-events: initial;
}

.annotation-wrapper ::slotted(*) {
  opacity: var(--max-hotspot-opacity, 1);
  transition: opacity 0.3s;
}

.pointer-tumbling .annotation-wrapper ::slotted(*) {
  pointer-events: none;
}

.annotation-wrapper ::slotted(*) {
  pointer-events: initial;
}

.annotation-wrapper.hide ::slotted(*) {
  opacity: var(--min-hotspot-opacity, 0.25);
}

.slot.poster {
  display: none;
  background-color: inherit;
}

.slot.poster.show {
  display: inherit;
}

.slot.poster > * {
  pointer-events: initial;
}

.slot.poster:not(.show) > * {
  pointer-events: none;
}

#default-poster {
  width: 100%;
  height: 100%;
  /* The default poster is a <button> so we need to set display
   * to prevent it from being affected by text-align: */
  display: block;
  position: absolute;
  border: none;
  padding: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #fff0;
}

#default-progress-bar {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

#default-progress-bar > .bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--progress-bar-height, 5px);
  background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
  transition: transform 0.09s;
  transform-origin: top left;
  transform: scaleX(0);
  overflow: hidden;
}

#default-progress-bar > .bar.hide {
  transition: opacity 0.3s 1s;
  opacity: 0;
}

.centered {
  align-items: center;
  justify-content: center;
}

.cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.slot.interaction-prompt {
  display: var(--interaction-prompt-display, flex);
  overflow: hidden;
  opacity: 0;
  will-change: opacity;
  transition: opacity 0.3s;
}

.slot.interaction-prompt.visible {
  opacity: 1;
}

.animated-container {
  will-change: transform, opacity;
  opacity: 0;
  transition: opacity 0.3s;
}

.slot.interaction-prompt > * {
  pointer-events: none;
}

.slot.ar-button {
  -moz-user-select: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;

  display: var(--ar-button-display, block);
}

.slot.ar-button:not(.enabled) {
  display: none;
}

.fab {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  cursor: pointer;
  background-color: #fff;
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
  border-radius: 100px;
}

.fab > * {
  opacity: 0.87;
}

#default-ar-button {
  position: absolute;
  bottom: 16px;
  right: 16px;
  transform: scale(var(--ar-button-scale, 1));
  transform-origin: bottom right;
}

.slot.pan-target {
  display: block;
  position: absolute;
  width: 0;
  height: 0;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  background-color: transparent;
  opacity: 0;
  transition: opacity 0.3s;
}

#default-pan-target {
  width: 6px;
  height: 6px;
  border-radius: 6px;
  border: 1px solid white;
  box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
}

.slot.default {
  pointer-events: none;
}

.slot.progress-bar {
  pointer-events: none;
}

.slot.exit-webxr-ar-button {
  pointer-events: none;
}

.slot.exit-webxr-ar-button:not(.enabled) {
  display: none;
}

#default-exit-webxr-ar-button {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: env(safe-area-inset-top, 16px);
  right: 16px;
  width: 40px;
  height: 40px;
  box-sizing: border-box;
}

#default-exit-webxr-ar-button > svg {
  fill: #fff;
}
</style>
<div class="container">
  <div class="userInput" tabindex="0" role="img"
      aria-label="3D model">
      <div class="slot canvas">
        <slot name="canvas">
          <canvas></canvas>
        </slot>
      </div>

  </div>

  <!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
        will have their <slot> elements removed by ShadyCSS -->
  <div class="slot poster">
    <slot name="poster">
      <button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
    </slot>
  </div>

  <div class="slot ar-button">
    <slot name="ar-button">
      <a id="default-ar-button" part="default-ar-button" class="fab"
          tabindex="2"
          aria-label="View in your space">
        ${Kl`
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
	 viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
<g id="Art_layer">
	<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
	<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
	<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
	<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
	<g>
		<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3
			l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62
			l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>
	</g>
</g>
</svg>`}
      </a>
    </slot>
  </div>

  <div class="slot pan-target">
    <slot name="pan-target">
      <div id="default-pan-target">
      </div>
    </slot>
  </div>

  <div class="slot interaction-prompt cover centered">
    <div id="prompt" class="animated-container">
      <slot name="interaction-prompt" aria-hidden="true">
        ${Kl`
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
    <defs>
        <path id="A" d="M.001.232h24.997V36H.001z" />
    </defs>
    <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
        <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
        <g transform="translate(11 3)">
            <path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />
            <path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />
            <path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />
            <g transform="translate(0 .769)">
                <mask id="B" fill="#fff">
                    <use xlink:href="#A" />
                </mask>
                <path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />
            </g>
        </g>
    </g>
</svg>`
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
      </slot>
    </div>
  </div>

  <div id="finger0" class="animated-container cover">
    <slot name="finger0" aria-hidden="true">
    </slot>
  </div>
  <div id="finger1" class="animated-container cover">
    <slot name="finger1" aria-hidden="true">
    </slot>
  </div>

  <div class="slot default">
    <slot></slot>

    <div class="slot progress-bar">
      <slot name="progress-bar">
        <div id="default-progress-bar" aria-hidden="true">
          <div class="bar" part="default-progress-bar"></div>
        </div>
      </slot>
    </div>

    <div class="slot exit-webxr-ar-button">
      <slot name="exit-webxr-ar-button">
        <a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
            tabindex="3"
            aria-label="Exit AR"
            aria-hidden="true">
          ${Kl`
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
    <!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
         support for dynamic re-coloring of UI components -->
    <defs>
      <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
        <feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
        <feOffset dx="0" dy="0" result="offsetblur"/>
        <feFlood flood-color="#000000"/>
        <feComposite in2="offsetblur" operator="in"/>
        <feMerge>
          <feMergeNode/>
          <feMergeNode in="SourceGraphic"/>
        </feMerge>
      </filter>
    </defs>
    <path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
    <path d="M0 0h24v24H0z" fill="none"/>
</svg>`
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
        </a>
      </slot>
    </div>
  </div>
</div>
<div class="screen-reader-only" role="region" aria-label="Live announcements">
  <span id="status" role="status"></span>
</div>`,Vh=new WeakMap;function Wh(){let t,e;function i(t,e,i,n,r,s){const a=s.num_components(),o=i.num_points()*a,l=o*r.BYTES_PER_ELEMENT,h=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),c=t._malloc(l);e.GetAttributeDataArrayForAllPoints(i,s,h,l,c);const u=new r(t.HEAPF32.buffer,c,o).slice();return t._free(c),{name:n,array:u,itemSize:a}}onmessage=function(n){const r=n.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":const n=r.buffer,s=r.taskConfig;e.then((t=>{const e=t.draco,a=new e.Decoder;try{const t=function(t,e,n,r){const s=r.attributeIDs,a=r.attributeTypes;let o,l;const h=e.GetEncodedGeometryType(n);if(h===t.TRIANGULAR_MESH)o=new t.Mesh,l=e.DecodeArrayToMesh(n,n.byteLength,o);else{if(h!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,l=e.DecodeArrayToPointCloud(n,n.byteLength,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const c={index:null,attributes:[]};for(const n in s){const l=self[a[n]];let h,u;if(r.useUniqueIDs)u=s[n],h=e.GetAttributeByUniqueId(o,u);else{if(u=e.GetAttributeId(o,t[s[n]]),-1===u)continue;h=e.GetAttribute(o,u)}const d=i(t,e,o,n,l,h);"color"===n&&(d.vertexColorSpace=r.vertexColorSpace),c.attributes.push(d)}h===t.TRIANGULAR_MESH&&(c.index=function(t,e,i){const n=i.num_faces(),r=3*n,s=4*r,a=t._malloc(s);e.GetTrianglesUInt32Array(i,s,a);const o=new Uint32Array(t.HEAPF32.buffer,a,r).slice();return t._free(a),{array:o,itemSize:1}}(t,e,o));return t.destroy(o),c}(e,a,new Int8Array(n),s),o=t.attributes.map((t=>t.array.buffer));t.index&&o.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},o)}catch(t){console.error(t),self.postMessage({type:"error",id:r.id,error:t.message})}finally{e.destroy(a)}}))}}}function qh(t,e){if(0===e)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===ut||e===ct){let i=t.getIndex();if(null===i){const e=[],n=t.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<n.count;t++)e.push(t);t.setIndex(e),i=t.getIndex()}const n=i.count-2,r=[];if(e===ut)for(let t=1;t<=n;t++)r.push(i.getX(0)),r.push(i.getX(t)),r.push(i.getX(t+1));else for(let t=0;t<n;t++)t%2==0?(r.push(i.getX(t)),r.push(i.getX(t+1)),r.push(i.getX(t+2))):(r.push(i.getX(t+2)),r.push(i.getX(t+1)),r.push(i.getX(t)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}class jh extends Ro{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new Zh(t)})),this.register((function(t){return new ac(t)})),this.register((function(t){return new oc(t)})),this.register((function(t){return new lc(t)})),this.register((function(t){return new ec(t)})),this.register((function(t){return new ic(t)})),this.register((function(t){return new nc(t)})),this.register((function(t){return new rc(t)})),this.register((function(t){return new $h(t)})),this.register((function(t){return new sc(t)})),this.register((function(t){return new tc(t)})),this.register((function(t){return new Xh(t)})),this.register((function(t){return new hc(t)})),this.register((function(t){return new cc(t)}))}load(t,e,i,n){const r=this;let s;s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:tl.extractUrlBase(t),this.manager.itemStart(t);const a=function(e){n?n(e):console.error(e),r.manager.itemError(t),r.manager.itemEnd(t)},o=new Qo(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(i){try{r.parse(i,s,(function(i){e(i),r.manager.itemEnd(t)}),a)}catch(t){a(t)}}),i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){let r;const s={},a={},o=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer){if(o.decode(new Uint8Array(t,0,4))===uc){try{s[Jh.KHR_BINARY_GLTF]=new pc(t)}catch(t){return void(n&&n(t))}r=JSON.parse(s[Jh.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(t))}else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new Oc(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](l);a[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],i=r.extensionsRequired||[];switch(e){case Jh.KHR_MATERIALS_UNLIT:s[e]=new Kh;break;case Jh.KHR_DRACO_MESH_COMPRESSION:s[e]=new mc(r,this.dracoLoader);break;case Jh.KHR_TEXTURE_TRANSFORM:s[e]=new gc;break;case Jh.KHR_MESH_QUANTIZATION:s[e]=new fc;break;default:i.indexOf(e)>=0&&void 0===a[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}l.setExtensions(s),l.setPlugins(a),l.parse(i,n)}parseAsync(t,e){const i=this;return new Promise((function(n,r){i.parse(t,e,n,r)}))}}function Yh(){let t={};return{get:function(e){return t[e]},add:function(e,i){t[e]=i},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const Jh={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_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",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",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Xh{constructor(t){this.parser=t,this.name=Jh.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i<n;i++){const n=e[i];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&t._addNodeRef(this.cache,n.extensions[this.name].light)}}_loadLight(t){const e=this.parser,i="light:"+t;let n=e.cache.get(i);if(n)return n;const r=e.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let a;const o=new bi(16777215);void 0!==s.color&&o.fromArray(s.color);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":a=new Ko(o),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new Jo(o),a.distance=l;break;case"spot":a=new Vo(o),a.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return a.position.set(0,0,0),a.decay=2,Qc(a,s),void 0!==s.intensity&&(a.intensity=s.intensity),a.name=e.createUniqueName(s.name||"light_"+t),n=Promise.resolve(a),e.cache.add(i,n),n}getDependency(t,e){if("light"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,i=this.parser,n=i.json.nodes[t],r=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(t){return i._getNodeRef(e.cache,r,t)}))}}class Kh{constructor(){this.name=Jh.KHR_MATERIALS_UNLIT}getMaterialType(){return Mi}extendParams(t,e,i){const n=[];t.color=new bi(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.fromArray(e),t.opacity=e[3]}void 0!==r.baseColorTexture&&n.push(i.assignTexture(t,"map",r.baseColorTexture,At))}return Promise.all(n)}}class $h{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const i=this.parser.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=i.extensions[this.name].emissiveStrength;return void 0!==n&&(e.emissiveIntensity=n),Promise.resolve()}}class Zh{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ao:null}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(i.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(i.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(i.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Nt(t,t)}return Promise.all(r)}}class tc{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ao:null}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return void 0!==s.iridescenceFactor&&(e.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(i.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(e.iridescenceIOR=s.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(i.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class ec{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_SHEEN}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ao:null}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new bi(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=n.extensions[this.name];return void 0!==s.sheenColorFactor&&e.sheenColor.fromArray(s.sheenColorFactor),void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(i.assignTexture(e,"sheenColorMap",s.sheenColorTexture,At)),void 0!==s.sheenRoughnessTexture&&r.push(i.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class ic{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ao:null}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(i.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class nc{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_VOLUME}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ao:null}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(i.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return e.attenuationColor=new bi(a[0],a[1],a[2]),Promise.all(r)}}class rc{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_IOR}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ao:null}extendMaterialParams(t,e){const i=this.parser.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=i.extensions[this.name];return e.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}}class sc{constructor(t){this.parser=t,this.name=Jh.KHR_MATERIALS_SPECULAR}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ao:null}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(i.assignTexture(e,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return e.specularColor=new bi(a[0],a[1],a[2]),void 0!==s.specularColorTexture&&r.push(i.assignTexture(e,"specularColorMap",s.specularColorTexture,At)),Promise.all(r)}}class ac{constructor(t){this.parser=t,this.name=Jh.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,i=e.json,n=i.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class oc{constructor(t){this.parser=t,this.name=Jh.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const t=i.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class lc{constructor(t){this.parser=t,this.name=Jh.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const t=i.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class hc{constructor(t){this.name=Jh.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const t=i.extensions[this.name],n=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then((function(e){const i=t.byteOffset||0,n=t.byteLength||0,s=t.count,a=t.byteStride,o=new Uint8Array(e,i,n);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,a,o,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(s*a);return r.decodeGltfBuffer(new Uint8Array(e),s,a,o,t.mode,t.filter),e}))}))}return null}}class cc{constructor(t){this.name=Jh.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;const n=e.meshes[i.mesh];for(const t of n.primitives)if(t.mode!==_c.TRIANGLES&&t.mode!==_c.TRIANGLE_STRIP&&t.mode!==_c.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=i.extensions[this.name].attributes,s=[],a={};for(const t in r)s.push(this.parser.getDependency("accessor",r[t]).then((e=>(a[t]=e,a[t]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then((t=>{const e=t.pop(),i=e.isGroup?e.children:[e],n=t[0].count,r=[];for(const t of i){const e=new Ue,i=new ae,s=new se,o=new ae(1,1,1),l=new Ua(t.geometry,t.material,n);for(let t=0;t<n;t++)a.TRANSLATION&&i.fromBufferAttribute(a.TRANSLATION,t),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,t),a.SCALE&&o.fromBufferAttribute(a.SCALE,t),l.setMatrixAt(t,e.compose(i,s,o));for(const e in a)"TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e&&t.geometry.setAttribute(e,a[e]);oi.prototype.copy.call(l,t),this.parser.assignFinalMaterial(l),r.push(l)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]})))}}const uc="glTF",dc=1313821514,Ac=5130562;class pc{constructor(t){this.name=Jh.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==uc)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-12,r=new DataView(t,12);let s=0;for(;s<n;){const e=r.getUint32(s,!0);s+=4;const n=r.getUint32(s,!0);if(s+=4,n===dc){const n=new Uint8Array(t,12+s,e);this.content=i.decode(n)}else if(n===Ac){const i=12+s;this.body=t.slice(i,i+e)}s+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class mc{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Jh.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const i=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},l={};for(const t in s){const e=bc[t]||t.toLowerCase();a[e]=s[t]}for(const e in t.attributes){const n=bc[e]||e.toLowerCase();if(void 0!==s[e]){const r=i.accessors[t.attributes[e]],s=Ec[r.componentType];l[n]=s.name,o[n]=!0===r.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e){n.decodeDracoFile(t,(function(t){for(const e in t.attributes){const i=t.attributes[e],n=o[e];void 0!==n&&(i.normalized=n)}e(t)}),a,l)}))}))}}class gc{constructor(){this.name=Jh.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class fc{constructor(){this.name=Jh.KHR_MESH_QUANTIZATION}}class vc extends po{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n;for(let t=0;t!==n;t++)e[t]=i[r+t];return e}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=2*a,l=3*a,h=n-e,c=(i-e)/h,u=c*c,d=u*c,A=t*l,p=A-l,m=-2*d+3*u,g=d-u,f=1-m,v=g-u+c;for(let t=0;t!==a;t++){const e=s[p+t+a],i=s[p+t+o]*h,n=s[A+t+a],l=s[A+t]*h;r[t]=f*e+v*i+m*n+g*l}return r}}const yc=new se;class xc extends vc{interpolate_(t,e,i,n){const r=super.interpolate_(t,e,i,n);return yc.fromArray(r).normalize().toArray(r),r}}const _c={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ec={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},wc={9728:M,9729:R,9984:B,9985:L,9986:T,9987:D},Cc={33071:b,33648:S,10497:I},Ic={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},bc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Sc={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Mc={CUBICSPLINE:void 0,LINEAR:rt,STEP:nt},Bc="OPAQUE",Tc="MASK",Rc="BLEND";function Lc(t){return void 0===t.DefaultMaterial&&(t.DefaultMaterial=new so({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:o})),t.DefaultMaterial}function Dc(t,e,i){for(const n in i.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=i.extensions[n])}function Qc(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Pc(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let i=0,n=e.weights.length;i<n;i++)t.morphTargetInfluences[i]=e.weights[i];if(e.extras&&Array.isArray(e.extras.targetNames)){const i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(let e=0,n=i.length;e<n;e++)t.morphTargetDictionary[i[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Uc(t){const e=t.extensions&&t.extensions[Jh.KHR_DRACO_MESH_COMPRESSION];let i;return i=e?"draco:"+e.bufferView+":"+e.indices+":"+Nc(e.attributes):t.indices+":"+Nc(t.attributes)+":"+t.mode,i}function Nc(t){let e="";const i=Object.keys(t).sort();for(let n=0,r=i.length;n<r;n++)e+=i[n]+":"+t[i[n]]+";";return e}function Fc(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const kc=new Ue;class Oc{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Yh,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=!1,r=-1;"undefined"!=typeof navigator&&(i=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),n=navigator.userAgent.indexOf("Firefox")>-1,r=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||i||n&&r<98?this.textureLoader=new No(this.options.manager):this.textureLoader=new el(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Qo(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])})).then((function(e){const s={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:i,userData:{}};Dc(r,s,n),Qc(s,n),Promise.all(i._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let i=0,n=e.length;i<n;i++){const n=e[i].joints;for(let e=0,i=n.length;e<i;e++)t[n[e]].isBone=!0}for(let e=0,n=t.length;e<n;e++){const n=t[e];void 0!==n.mesh&&(this._addNodeRef(this.meshCache,n.mesh),void 0!==n.skin&&(i[n.mesh].isSkinnedMesh=!0)),void 0!==n.camera&&this._addNodeRef(this.cameraCache,n.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,i){if(t.refs[e]<=1)return i;const n=i.clone(),r=(t,e)=>{const i=this.associations.get(t);null!=i&&this.associations.set(e,i);for(const[i,n]of t.children.entries())r(n,e.children[i])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const n=t(e[i]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let n=0;n<e.length;n++){const r=t(e[n]);r&&i.push(r)}return i}getDependency(t,e){const i=t+":"+e;let n=this.cache.get(i);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":n=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":n=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne((function(i){return i!=this&&i.getDependency&&i.getDependency(t,e)})),!n)throw new Error("Unknown type: "+t)}this.cache.add(i,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const i=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map((function(e,n){return i.getDependency(t,n)}))),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],i=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[Jh.KHR_BINARY_GLTF].body);const n=this.options;return new Promise((function(t,r){i.load(tl.resolveURL(e.uri,n.path),t,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const i=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+i)}))}loadAccessor(t){const e=this,i=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse){const t=Ic[n.type],e=Ec[n.componentType],i=!0===n.normalized,r=new e(n.count*t);return Promise.resolve(new Qi(r,t,i))}const r=[];return void 0!==n.bufferView?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),void 0!==n.sparse&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then((function(t){const r=t[0],s=Ic[n.type],a=Ec[n.componentType],o=a.BYTES_PER_ELEMENT,l=o*s,h=n.byteOffset||0,c=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,u=!0===n.normalized;let d,A;if(c&&c!==l){const t=Math.floor(h/c),i="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+t+":"+n.count;let l=e.cache.get(i);l||(d=new a(r,t*c,n.count*c/o),l=new Aa(d,c/o),e.cache.add(i,l)),A=new ma(l,s,h%c/o,u)}else d=null===r?new a(n.count*s):new a(r,h,n.count*s),A=new Qi(d,s,u);if(void 0!==n.sparse){const e=Ic.SCALAR,i=Ec[n.sparse.indices.componentType],o=n.sparse.indices.byteOffset||0,l=n.sparse.values.byteOffset||0,h=new i(t[1],o,n.sparse.count*e),c=new a(t[2],l,n.sparse.count*s);null!==r&&(A=new Qi(A.array.slice(),A.itemSize,A.normalized));for(let t=0,e=h.length;t<e;t++){const e=h[t];if(A.setX(e,c[t*s]),s>=2&&A.setY(e,c[t*s+1]),s>=3&&A.setZ(e,c[t*s+2]),s>=4&&A.setW(e,c[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return A}))}loadTexture(t){const e=this.json,i=this.options,n=e.textures[t].source,r=e.images[n];let s=this.textureLoader;if(r.uri){const t=i.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,n,s)}loadTextureImage(t,e,i){const n=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(e,i).then((function(e){e.flipY=!1,e.name=s.name||a.name||"",""===e.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(e.name=a.uri);const i=(r.samplers||{})[s.sampler]||{};return e.magFilter=wc[i.magFilter]||R,e.minFilter=wc[i.minFilter]||D,e.wrapS=Cc[i.wrapS]||I,e.wrapT=Cc[i.wrapT]||I,n.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[o]=l,l}loadImageSource(t,e){const i=this,n=this.json,r=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((t=>t.clone()));const s=n.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",l=!1;if(void 0!==s.bufferView)o=i.getDependency("bufferView",s.bufferView).then((function(t){l=!0;const e=new Blob([t],{type:s.mimeType});return o=a.createObjectURL(e),o}));else if(void 0===s.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const h=Promise.resolve(o).then((function(t){return new Promise((function(i,n){let s=i;!0===e.isImageBitmapLoader&&(s=function(t){const e=new te(t);e.needsUpdate=!0,i(e)}),e.load(tl.resolveURL(t,r.path),s,void 0,n)}))})).then((function(t){var e;return!0===l&&a.revokeObjectURL(o),t.userData.mimeType=s.mimeType||((e=s.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),t}));return this.sourceCache[t]=h,h}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then((function(s){if(!s)return null;if(void 0!==i.texCoord&&i.texCoord>0&&((s=s.clone()).channel=i.texCoord),r.extensions[Jh.KHR_TEXTURE_TRANSFORM]){const t=void 0!==i.extensions?i.extensions[Jh.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[Jh.KHR_TEXTURE_TRANSFORM].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==n&&(s.encoding=n),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+i.uuid;let e=this.cache.get(t);e||(e=new Ya,_i.prototype.copy.call(e,i),e.color.copy(i.color),e.map=i.map,e.sizeAttenuation=!1,this.cache.add(t,e)),i=e}else if(t.isLine){const t="LineBasicMaterial:"+i.uuid;let e=this.cache.get(t);e||(e=new Na,_i.prototype.copy.call(e,i),e.color.copy(i.color),e.map=i.map,this.cache.add(t,e)),i=e}if(n||r||s){let t="ClonedMaterial:"+i.uuid+":";n&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=i.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),n&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(i))),i=e}t.material=i}getMaterialType(){return so}loadMaterial(t){const e=this,i=this.json,n=this.extensions,r=i.materials[t];let s;const a={},o=[];if((r.extensions||{})[Jh.KHR_MATERIALS_UNLIT]){const t=n[Jh.KHR_MATERIALS_UNLIT];s=t.getMaterialType(),o.push(t.extendParams(a,r,e))}else{const i=r.pbrMetallicRoughness||{};if(a.color=new bi(1,1,1),a.opacity=1,Array.isArray(i.baseColorFactor)){const t=i.baseColorFactor;a.color.fromArray(t),a.opacity=t[3]}void 0!==i.baseColorTexture&&o.push(e.assignTexture(a,"map",i.baseColorTexture,At)),a.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,a.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(o.push(e.assignTexture(a,"metalnessMap",i.metallicRoughnessTexture)),o.push(e.assignTexture(a,"roughnessMap",i.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),o.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===r.doubleSided&&(a.side=h);const l=r.alphaMode||Bc;if(l===Rc?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===Tc&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==Mi&&(o.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Nt(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;a.normalScale.set(t,t)}return void 0!==r.occlusionTexture&&s!==Mi&&(o.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==Mi&&(a.emissive=(new bi).fromArray(r.emissiveFactor)),void 0!==r.emissiveTexture&&s!==Mi&&o.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,At)),Promise.all(o).then((function(){const i=new s(a);return r.name&&(i.name=r.name),Qc(i,r),e.associations.set(i,{materials:t}),r.extensions&&Dc(n,i,r),i}))}createUniqueName(t){const e=hl.sanitizeNodeName(t||"");let i=e;for(let t=1;this.nodeNamesUsed[i];++t)i=e+"_"+t;return this.nodeNamesUsed[i]=!0,i}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function r(t){return i[Jh.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(i){return Gc(i,t,e)}))}const s=[];for(let i=0,a=t.length;i<a;i++){const a=t[i],o=Uc(a),l=n[o];if(l)s.push(l.promise);else{let t;t=a.extensions&&a.extensions[Jh.KHR_DRACO_MESH_COMPRESSION]?r(a):Gc(new Wi,a,e),n[o]={primitive:a,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,i=this.json,n=this.extensions,r=i.meshes[t],s=r.primitives,a=[];for(let t=0,e=s.length;t<e;t++){const e=void 0===s[t].material?Lc(this.cache):this.getDependency("material",s[t].material);a.push(e)}return a.push(e.loadGeometries(s)),Promise.all(a).then((function(i){const a=i.slice(0,i.length-1),o=i[i.length-1],l=[];for(let i=0,h=o.length;i<h;i++){const h=o[i],c=s[i];let u;const d=a[i];if(c.mode===_c.TRIANGLES||c.mode===_c.TRIANGLE_STRIP||c.mode===_c.TRIANGLE_FAN||void 0===c.mode)u=!0===r.isSkinnedMesh?new Ea(h,d):new cn(h,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),c.mode===_c.TRIANGLE_STRIP?u.geometry=qh(u.geometry,ct):c.mode===_c.TRIANGLE_FAN&&(u.geometry=qh(u.geometry,ut));else if(c.mode===_c.LINES)u=new qa(h,d);else if(c.mode===_c.LINE_STRIP)u=new za(h,d);else if(c.mode===_c.LINE_LOOP)u=new ja(h,d);else{if(c.mode!==_c.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+c.mode);u=new Za(h,d)}Object.keys(u.geometry.morphAttributes).length>0&&Pc(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),Qc(u,r),c.extensions&&Dc(n,u,c),e.assignFinalMaterial(u),l.push(u)}for(let i=0,n=l.length;i<n;i++)e.associations.set(l[i],{meshes:t,primitives:i});if(1===l.length)return l[0];const h=new na;e.associations.set(h,{meshes:t});for(let t=0,e=l.length;t<e;t++)h.add(l[t]);return h}))}loadCamera(t){let e;const i=this.json.cameras[t],n=i[i.type];if(n)return"perspective"===i.type?e=new yn(Ut.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(e=new Vn(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),Qc(e,i),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],i=[];for(let t=0,n=e.joints.length;t<n;t++)i.push(this._loadNodeShallow(e.joints[t]));return void 0!==e.inverseBindMatrices?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then((function(t){const i=t.pop(),n=t,r=[],s=[];for(let t=0,a=n.length;t<a;t++){const a=n[t];if(a){r.push(a);const e=new Ue;null!==i&&e.fromArray(i.array,16*t),s.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[t])}return new Sa(r,s)}))}loadAnimation(t){const e=this.json.animations[t],i=e.name?e.name:"animation_"+t,n=[],r=[],s=[],a=[],o=[];for(let t=0,i=e.channels.length;t<i;t++){const i=e.channels[t],l=e.samplers[i.sampler],h=i.target,c=h.node,u=void 0!==e.parameters?e.parameters[l.input]:l.input,d=void 0!==e.parameters?e.parameters[l.output]:l.output;void 0!==h.node&&(n.push(this.getDependency("node",c)),r.push(this.getDependency("accessor",u)),s.push(this.getDependency("accessor",d)),a.push(l),o.push(h))}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(s),Promise.all(a),Promise.all(o)]).then((function(t){const e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=[];for(let t=0,i=e.length;t<i;t++){const i=e[t],l=n[t],h=r[t],c=s[t],u=a[t];if(void 0===i)continue;let d;switch(i.updateMatrix(),Sc[u.path]){case Sc.weights:d=_o;break;case Sc.rotation:d=wo;break;default:d=Io}const A=i.name?i.name:i.uuid,p=void 0!==c.interpolation?Mc[c.interpolation]:rt,m=[];Sc[u.path]===Sc.weights?i.traverse((function(t){t.morphTargetInfluences&&m.push(t.name?t.name:t.uuid)})):m.push(A);let g=h.array;if(h.normalized){const t=Fc(g.constructor),e=new Float32Array(g.length);for(let i=0,n=g.length;i<n;i++)e[i]=g[i]*t;g=e}for(let t=0,e=m.length;t<e;t++){const e=new d(m[t]+"."+Sc[u.path],l.array,g,p);"CUBICSPLINE"===c.interpolation&&(e.createInterpolant=function(t){return new(this instanceof wo?xc:vc)(this.times,this.values,this.getValueSize()/3,t)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),o.push(e)}}return new bo(i,void 0,o)}))}createNodeMesh(t){const e=this.json,i=this,n=e.nodes[t];return void 0===n.mesh?null:i.getDependency("mesh",n.mesh).then((function(t){const e=i._getNodeRef(i.meshCache,n.mesh,t);return void 0!==n.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,i=n.weights.length;e<i;e++)t.morphTargetInfluences[e]=n.weights[e]})),e}))}loadNode(t){const e=this,i=this.json.nodes[t],n=e._loadNodeShallow(t),r=[],s=i.children||[];for(let t=0,i=s.length;t<i;t++)r.push(e.getDependency("node",s[t]));const a=void 0===i.skin?Promise.resolve(null):e.getDependency("skin",i.skin);return Promise.all([n,Promise.all(r),a]).then((function(t){const e=t[0],i=t[1],n=t[2];null!==n&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(n,kc)}));for(let t=0,n=i.length;t<n;t++)e.add(i[t]);return e}))}_loadNodeShallow(t){const e=this.json,i=this.extensions,n=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],s=r.name?n.createUniqueName(r.name):"",a=[],o=n._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return o&&a.push(o),void 0!==r.camera&&a.push(n.getDependency("camera",r.camera).then((function(t){return n._getNodeRef(n.cameraCache,r.camera,t)}))),n._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){a.push(t)})),this.nodeCache[t]=Promise.all(a).then((function(e){let a;if(a=!0===r.isBone?new wa:e.length>1?new na:1===e.length?e[0]:new oi,a!==e[0])for(let t=0,i=e.length;t<i;t++)a.add(e[t]);if(r.name&&(a.userData.name=r.name,a.name=s),Qc(a,r),r.extensions&&Dc(i,a,r),void 0!==r.matrix){const t=new Ue;t.fromArray(r.matrix),a.applyMatrix4(t)}else void 0!==r.translation&&a.position.fromArray(r.translation),void 0!==r.rotation&&a.quaternion.fromArray(r.rotation),void 0!==r.scale&&a.scale.fromArray(r.scale);return n.associations.has(a)||n.associations.set(a,{}),n.associations.get(a).nodes=t,a})),this.nodeCache[t]}loadScene(t){const e=this.extensions,i=this.json.scenes[t],n=this,r=new na;i.name&&(r.name=n.createUniqueName(i.name)),Qc(r,i),i.extensions&&Dc(e,r,i);const s=i.nodes||[],a=[];for(let t=0,e=s.length;t<e;t++)a.push(n.getDependency("node",s[t]));return Promise.all(a).then((function(t){for(let e=0,i=t.length;e<i;e++)r.add(t[e]);return n.associations=(t=>{const e=new Map;for(const[t,i]of n.associations)(t instanceof _i||t instanceof te)&&e.set(t,i);return t.traverse((t=>{const i=n.associations.get(t);null!=i&&e.set(t,i)})),e})(r),r}))}}function Gc(t,e,i){const n=e.attributes,r=[];function s(e,n){return i.getDependency("accessor",e).then((function(e){t.setAttribute(n,e)}))}for(const e in n){const i=bc[e]||e.toLowerCase();i in t.attributes||r.push(s(n[e],i))}if(void 0!==e.indices&&!t.index){const n=i.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));r.push(n)}return Qc(t,e),function(t,e,i){const n=e.attributes,r=new he;if(void 0===n.POSITION)return;{const t=i.json.accessors[n.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new ae(e[0],e[1],e[2]),new ae(s[0],s[1],s[2])),t.normalized){const e=Fc(Ec[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new ae,e=new ae;for(let n=0,r=s.length;n<r;n++){const r=s[n];if(void 0!==r.POSITION){const n=i.json.accessors[r.POSITION],s=n.min,a=n.max;if(void 0!==s&&void 0!==a){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),n.normalized){const t=Fc(Ec[n.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(t)}t.boundingBox=r;const a=new Se;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=a}(t,e,i),Promise.all(r).then((function(){return void 0!==e.targets?function(t,e,i){let n=!1,r=!1,s=!1;for(let t=0,i=e.length;t<i;t++){const i=e[t];if(void 0!==i.POSITION&&(n=!0),void 0!==i.NORMAL&&(r=!0),void 0!==i.COLOR_0&&(s=!0),n&&r&&s)break}if(!n&&!r&&!s)return Promise.resolve(t);const a=[],o=[],l=[];for(let h=0,c=e.length;h<c;h++){const c=e[h];if(n){const e=void 0!==c.POSITION?i.getDependency("accessor",c.POSITION):t.attributes.position;a.push(e)}if(r){const e=void 0!==c.NORMAL?i.getDependency("accessor",c.NORMAL):t.attributes.normal;o.push(e)}if(s){const e=void 0!==c.COLOR_0?i.getDependency("accessor",c.COLOR_0):t.attributes.color;l.push(e)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then((function(e){const i=e[0],a=e[1],o=e[2];return n&&(t.morphAttributes.position=i),r&&(t.morphAttributes.normal=a),s&&(t.morphAttributes.color=o),t.morphTargetsRelative=!0,t}))}(t,e.targets,i):t}))}class Hc{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const i=this.workersResolve[t];if(i&&i(e),this.queue.length){const{resolve:e,msg:i,transfer:n}=this.queue.shift();this.workersResolve[t]=e,this.workers[t].postMessage(i,n)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise((i=>{const n=this._getIdleWorker();-1!==n?(this._initWorker(n),this.workerStatus|=1<<n,this.workersResolve[n]=i,this.workers[n].postMessage(t,e)):this.queue.push({resolve:i,msg:t,transfer:e})}))}dispose(){this.workers.forEach((t=>t.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}class zc{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Vc{constructor(t,e,i,n){this._dataView=new DataView(t.buffer,t.byteOffset+e,i),this._littleEndian=n,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_skip(t){return this._offset+=t,this}_scan(t,e=0){const i=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,n)}}const Wc=[171,75,84,88,32,50,48,187,13,10,26,10];function qc(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}let jc,Yc,Jc;const Xc={env:{emscripten_notify_memory_growth:function(t){Jc=new Uint8Array(Yc.exports.memory.buffer)}}};class Kc{init(){return jc||(jc="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+$c).then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,Xc))).then(this._init):WebAssembly.instantiate(Buffer.from($c,"base64"),Xc).then(this._init),jc)}_init(t){Yc=t.instance,Xc.env.emscripten_notify_memory_growth(0)}decode(t,e=0){if(!Yc)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=t.byteLength,n=Yc.exports.malloc(i);Jc.set(t,n),e=e||Number(Yc.exports.ZSTD_findDecompressedSize(n,i));const r=Yc.exports.malloc(e),s=Yc.exports.ZSTD_decompress(r,e,n,i),a=Jc.slice(r,r+s);return Yc.exports.free(n),Yc.exports.free(r),a}}const $c="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",Zc=new WeakMap;let tu,eu=0;class iu extends Ro{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Hc,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerPool.setWorkerLimit(t),this}detectSupport(t){return this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},t.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const t=new Qo(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=t.loadAsync("basis_transcoder.js"),i=new Qo(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const n=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,n]).then((([t,e])=>{const i=iu.BasisWorker.toString(),n=["/* constants */","let _EngineFormat = "+JSON.stringify(iu.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(iu.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(iu.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n])),this.transcoderBinary=e,this.workerPool.setWorkerCreator((()=>{const t=new Worker(this.workerSourceURL),e=this.transcoderBinary.slice(0);return t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:e},[e]),t}))})),eu>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),eu++}return this.transcoderPending}load(t,e,i,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new Qo(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{if(Zc.has(t)){return Zc.get(t).promise.then(e).catch(n)}this._createTexture(t).then((t=>e?e(t):null)).catch(n)}),i,n)}_createTextureFrom(t,e){const{mipmaps:i,width:n,height:r,format:s,type:a,error:o,dfdTransferFn:l,dfdFlags:h}=t;if("error"===a)return Promise.reject(o);const c=e.layerCount>1?new no(i,n,r,e.layerCount,s,Q):new io(i,n,r,s,Q);return c.minFilter=1===i.length?R:D,c.magFilter=R,c.generateMipmaps=!1,c.needsUpdate=!0,c.encoding=2===l?At:dt,c.premultiplyAlpha=!!(1&h),c}async _createTexture(t,e={}){const i=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,Wc.length);if(e[0]!==Wc[0]||e[1]!==Wc[1]||e[2]!==Wc[2]||e[3]!==Wc[3]||e[4]!==Wc[4]||e[5]!==Wc[5]||e[6]!==Wc[6]||e[7]!==Wc[7]||e[8]!==Wc[8]||e[9]!==Wc[9]||e[10]!==Wc[10]||e[11]!==Wc[11])throw new Error("Missing KTX 2.0 identifier.");const i=new zc,n=17*Uint32Array.BYTES_PER_ELEMENT,r=new Vc(t,Wc.length,n,!0);i.vkFormat=r._nextUint32(),i.typeSize=r._nextUint32(),i.pixelWidth=r._nextUint32(),i.pixelHeight=r._nextUint32(),i.pixelDepth=r._nextUint32(),i.layerCount=r._nextUint32(),i.faceCount=r._nextUint32();const s=r._nextUint32();i.supercompressionScheme=r._nextUint32();const a=r._nextUint32(),o=r._nextUint32(),l=r._nextUint32(),h=r._nextUint32(),c=r._nextUint64(),u=r._nextUint64(),d=new Vc(t,Wc.length+n,3*s*8,!0);for(let e=0;e<s;e++)i.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const A=new Vc(t,a,o,!0),p={vendorId:A._skip(4)._nextUint16(),descriptorType:A._nextUint16(),versionNumber:A._nextUint16(),descriptorBlockSize:A._nextUint16(),colorModel:A._nextUint8(),colorPrimaries:A._nextUint8(),transferFunction:A._nextUint8(),flags:A._nextUint8(),texelBlockDimension:[A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8()],bytesPlane:[A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8()],samples:[]},m=(p.descriptorBlockSize/4-6)/4;for(let t=0;t<m;t++){const e={bitOffset:A._nextUint16(),bitLength:A._nextUint8(),channelType:A._nextUint8(),samplePosition:[A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&e.channelType?(e.sampleLower=A._nextInt32(),e.sampleUpper=A._nextInt32()):(e.sampleLower=A._nextUint32(),e.sampleUpper=A._nextUint32()),p.samples[t]=e}i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(p);const g=new Vc(t,l,h,!0);for(;g._offset<h;){const t=g._nextUint32(),e=g._scan(t),n=qc(e),r=g._scan(t-e.byteLength);i.keyValue[n]=n.match(/^ktx/i)?qc(r):r,g._offset%4&&g._skip(4-g._offset%4)}if(u<=0)return i;const f=new Vc(t,c,u,!0),v=f._nextUint16(),y=f._nextUint16(),x=f._nextUint32(),_=f._nextUint32(),E=f._nextUint32(),w=f._nextUint32(),C=[];for(let t=0;t<s;t++)C.push({imageFlags:f._nextUint32(),rgbSliceByteOffset:f._nextUint32(),rgbSliceByteLength:f._nextUint32(),alphaSliceByteOffset:f._nextUint32(),alphaSliceByteLength:f._nextUint32()});const I=c+f._offset,b=I+x,S=b+_,M=S+E,B=new Uint8Array(t.buffer,t.byteOffset+I,x),T=new Uint8Array(t.buffer,t.byteOffset+b,_),R=new Uint8Array(t.buffer,t.byteOffset+S,E),L=new Uint8Array(t.buffer,t.byteOffset+M,w);return i.globalData={endpointCount:v,selectorCount:y,imageDescs:C,endpointsData:B,selectorsData:T,tablesData:R,extendedData:L},i}(new Uint8Array(t));if(0!==i.vkFormat)return async function(t){const{vkFormat:e,pixelWidth:i,pixelHeight:n,pixelDepth:r}=t;if(void 0===nu[e])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");const s=t.levels[0];let a,o;if(0===t.supercompressionScheme)a=s.levelData;else{if(2!==t.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");tu||(tu=new Promise((async t=>{const e=new Kc;await e.init(),t(e)}))),a=(await tu).decode(s.levelData,s.uncompressedByteLength)}o=ru[e]===U?new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):ru[e]===N?new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):a;const l=0===r?new Ca(o,i,n):new re(o,i,n,r);return l.type=ru[e],l.format=nu[e],l.encoding=su[e]||dt,l.needsUpdate=!0,Promise.resolve(l)}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(i);const n=e,r=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:n},[t]))).then((t=>this._createTextureFrom(t.data,i)));return Zc.set(t,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),eu--,this}}iu.BasisFormat={ETC1S:0,UASTC_4x4:1},iu.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},iu.EngineFormat={RGBAFormat:k,RGBA_ASTC_4x4_Format:Z,RGBA_BPTC_Format:tt,RGBA_ETC2_EAC_Format:$,RGBA_PVRTC_4BPPV1_Format:J,RGBA_S3TC_DXT5_Format:j,RGB_ETC1_Format:X,RGB_ETC2_Format:K,RGB_PVRTC_4BPPV1_Format:Y,RGB_S3TC_DXT1_Format:V},iu.BasisWorker=function(){let t,e,i;const n=_EngineFormat,r=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",(function(a){const u=a.data;switch(u.type){case"init":t=u.config,d=u.transcoderBinary,e=new Promise((t=>{i={wasmBinary:d,onRuntimeInitialized:t},BASIS(i)})).then((()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((()=>{try{const{width:e,height:a,hasAlpha:d,mipmaps:A,format:p,dfdTransferFn:m,dfdFlags:g}=function(e){const a=new i.KTX2File(new Uint8Array(e));function u(){a.close(),a.delete()}if(!a.isValid())throw u(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const d=a.isUASTC()?s.UASTC_4x4:s.ETC1S,A=a.getWidth(),p=a.getHeight(),m=a.getLayers()||1,g=a.getLevels(),f=a.getHasAlpha(),v=a.getDFDTransferFunc(),y=a.getDFDFlags(),{transcoderFormat:x,engineFormat:_}=function(e,i,a,c){let u,d;const A=e===s.ETC1S?o:l;for(let n=0;n<A.length;n++){const r=A[n];if(t[r.if]&&(r.basisFormat.includes(e)&&!(c&&r.transcoderFormat.length<2)&&(!r.needsPowerOfTwo||h(i)&&h(a))))return u=r.transcoderFormat[c?1:0],d=r.engineFormat[c?1:0],{transcoderFormat:u,engineFormat:d}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),u=r.RGBA32,d=n.RGBAFormat,{transcoderFormat:u,engineFormat:d}}(d,A,p,f);if(!A||!p||!g)throw u(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!a.startTranscoding())throw u(),new Error("THREE.KTX2Loader: .startTranscoding failed");const E=[];for(let t=0;t<g;t++){const e=[];let i,n;for(let r=0;r<m;r++){const s=a.getImageLevelInfo(t,r,0);i=s.origWidth<4?s.origWidth:s.width,n=s.origHeight<4?s.origHeight:s.height;const o=new Uint8Array(a.getImageTranscodedSizeInBytes(t,r,0,x));if(!a.transcodeImage(o,t,r,0,x,0,-1,-1))throw u(),new Error("THREE.KTX2Loader: .transcodeImage failed.");e.push(o)}E.push({data:c(e),width:i,height:n})}return u(),{width:A,height:p,hasAlpha:f,mipmaps:E,format:_,dfdTransferFn:v,dfdFlags:y}}(u.buffer),f=[];for(let t=0;t<A.length;++t)f.push(A[t].data.buffer);self.postMessage({type:"transcode",id:u.id,width:e,height:a,hasAlpha:d,mipmaps:A,format:p,dfdTransferFn:m,dfdFlags:g},f)}catch(t){console.error(t),self.postMessage({type:"error",id:u.id,error:t.message})}}))}var d}));const a=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[n.RGB_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[n.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],o=a.sort((function(t,e){return t.priorityETC1S-e.priorityETC1S})),l=a.sort((function(t,e){return t.priorityUASTC-e.priorityUASTC}));function h(t){return t<=2||0==(t&t-1)&&0!==t}function c(t){let e=0;for(const i of t)e+=i.byteLength;const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}};const nu={109:k,97:k,37:k,43:k,103:z,83:z,16:z,22:z,100:H,76:H,15:H,9:H},ru={109:U,97:N,37:Q,43:Q,103:U,83:N,16:Q,22:Q,100:U,76:N,15:Q,9:Q},su={43:At,22:At,15:At};var au,ou;const lu=Symbol("retainerCount"),hu=Symbol("recentlyUsed"),cu=Symbol("evict"),uu=Symbol("evictionThreshold"),du=Symbol("cache");class Au{constructor(t,e=5){this[au]=new Map,this[ou]=[],this[du]=t,this[uu]=e}set evictionThreshold(t){this[uu]=t,this[cu]()}get evictionThreshold(){return this[uu]}get cache(){return this[du]}retainerCount(t){return this[lu].get(t)||0}reset(){this[lu].clear(),this[hu]=[]}retain(t){this[lu].has(t)||this[lu].set(t,0),this[lu].set(t,this[lu].get(t)+1);const e=this[hu].indexOf(t);-1!==e&&this[hu].splice(e,1),this[hu].unshift(t),this[cu]()}release(t){this[lu].has(t)&&this[lu].set(t,Math.max(this[lu].get(t)-1,0)),this[cu]()}[(au=lu,ou=hu,cu)](){if(!(this[hu].length<this[uu]))for(let t=this[hu].length-1;t>=this[uu];--t){const e=this[hu][t];0===this[lu].get(e)&&(this[du].delete(e),this[hu].splice(t,1))}}}
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const pu=t=>{const e=new Map;for(const i of t.mappings)for(const t of i.variants)e.set(t,{material:null,gltfMaterialIndex:i.material});return e};class mu{constructor(t){this.parser=t,this.name="KHR_materials_variants"}afterRoot(t){const e=this.parser,i=e.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;const n=(t=>{const e=[],i=new Set;for(const n of t){let t=n,r=0;for(;i.has(t);)t=n+"."+ ++r;i.add(t),e.push(t)}return e})((i.extensions[this.name].variants||[]).map((t=>t.name)));for(const n of t.scenes)n.traverse((t=>{const n=t;if(!n.material)return;const r=e.associations.get(n);if(null==r||null==r.meshes||null==r.primitives)return;const s=i.meshes[r.meshes].primitives[r.primitives].extensions;s&&s[this.name]&&(n.userData.variantMaterials=pu(s[this.name]))}));return t.userData.variants=n,Promise.resolve()}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var gu,fu;te.DEFAULT_ANISOTROPY=4;const vu=new Map,yu=new Map;let xu;const _u=new class extends Ro{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,n){const r=new Qo(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,n)}),i,n)}parse(t,e,i){this.decodeDracoFile(t,e,null,null,mt).catch(i)}decodeDracoFile(t,e,i,n,r=gt){const s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:r};return this.decodeGeometry(t,s).then(e)}decodeGeometry(t,e){const i=JSON.stringify(e);if(Vh.has(t)){const e=Vh.get(t);if(e.key===i)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const r=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(r,s).then((i=>(n=i,new Promise(((i,s)=>{n._callbacks[r]={resolve:i,reject:s},n.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))))).then((t=>this._createGeometry(t.geometry)));return a.catch((()=>!0)).then((()=>{n&&r&&this._releaseTask(n,r)})),Vh.set(t,{key:i,promise:a}),a}_createGeometry(t){const e=new Wi;t.index&&e.setIndex(new Qi(t.index.array,1));for(let i=0;i<t.attributes.length;i++){const n=t.attributes[i],r=n.name,s=n.array,a=n.itemSize,o=new Qi(s,a);"color"===r&&this._assignVertexColorSpace(o,n.vertexColorSpace),e.setAttribute(r,o)}return e}_assignVertexColorSpace(t,e){if(e!==mt)return;const i=new bi;for(let e=0,n=t.count;e<n;e++)i.fromBufferAttribute(t,e).convertSRGBToLinear(),t.setXYZ(e,i.r,i.g,i.b)}_loadLibrary(t,e){const i=new Qo(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise(((e,n)=>{i.load(t,e,void 0,n)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then((e=>{const i=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const n=Wh.toString(),r=["/* draco decoder */",i,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(t,e){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){const i=e.data;switch(i.type){case"decode":t._callbacks[i.id].resolve(i);break;case"error":t._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i}))}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map((t=>t._taskLoad)))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};let Eu;const wu=new iu;let Cu,Iu;const bu=Symbol("loader"),Su=Symbol("evictionPolicy"),Mu=Symbol("GLTFInstance");class Bu extends Et{constructor(t){super(),this[fu]=(new jh).register((t=>new mu(t))),this[Mu]=t,this[bu].setDRACOLoader(_u),this[bu].setKTX2Loader(wu)}static setDRACODecoderLocation(t){xu=t,_u.setDecoderPath(t)}static getDRACODecoderLocation(){return xu}static setKTX2TranscoderLocation(t){Eu=t,wu.setTranscoderPath(t)}static getKTX2TranscoderLocation(){return Eu}static setMeshoptDecoderLocation(t){var e;Cu!==t&&(Cu=t,Iu=(e=t,new Promise(((t,i)=>{const n=document.createElement("script");document.body.appendChild(n),n.onload=t,n.onerror=i,n.async=!0,n.src=e}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return Cu}static initializeKTX2Loader(t){wu.detectSupport(t)}static get cache(){return vu}static clearCache(){vu.forEach(((t,e)=>{this.delete(e)})),this[Su].reset()}static has(t){return vu.has(t)}static async delete(t){if(!this.has(t))return;const e=vu.get(t);yu.delete(t),vu.delete(t);(await e).dispose()}static hasFinishedLoading(t){return!!yu.get(t)}get[(gu=Su,fu=bu,Su)](){return this.constructor[Su]}async preload(t,e,i=(()=>{})){if(this[bu].setWithCredentials(Bu.withCredentials),this.dispatchEvent({type:"preload",element:e,src:t}),!vu.has(t)){null!=Iu&&this[bu].setMeshoptDecoder(await Iu);const e=((t,e,i=(()=>{}))=>{const n=t=>{const e=t.loaded/t.total;i(Math.max(0,Math.min(1,isFinite(e)?e:1)))};return new Promise(((i,r)=>{e.load(t,i,n,r)}))})(t,this[bu],(t=>{i(.8*t)})),n=this[Mu],r=e.then((t=>n.prepare(t))).then((t=>(i(.9),new n(t)))).catch((t=>(console.error(t),new n)));vu.set(t,r)}await vu.get(t),yu.set(t,!0),i&&i(1)}async load(t,e,i=(()=>{})){await this.preload(t,e,i);const n=await vu.get(t),r=await n.clone();return this[Su].retain(t),r.dispose=()=>{this[Su].release(t)},r}}Bu[gu]=new Au(Bu);class Tu extends oi{constructor(t=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Nt(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(t){t.element instanceof Element&&null!==t.element.parentNode&&t.element.parentNode.removeChild(t.element)}))}))}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this.center=t.center,this}}const Ru=new ae,Lu=new Ue,Du=new Ue,Qu=new ae,Pu=new ae;class Uu{constructor(t={}){const e=this;let i,n,r,s;const a={objects:new WeakMap},o=void 0!==t.element?t.element:document.createElement("div");function l(t,i,n){if(t.isCSS2DObject){Ru.setFromMatrixPosition(t.matrixWorld),Ru.applyMatrix4(Du);const l=!0===t.visible&&Ru.z>=-1&&Ru.z<=1&&!0===t.layers.test(n.layers);if(t.element.style.display=!0===l?"":"none",!0===l){t.onBeforeRender(e,i,n);const a=t.element;a.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(Ru.x*r+r)+"px,"+(-Ru.y*s+s)+"px)",a.parentNode!==o&&o.appendChild(a),t.onAfterRender(e,i,n)}const c={distanceToCameraSquared:h(n,t)};a.objects.set(t,c)}for(let e=0,r=t.children.length;e<r;e++)l(t.children[e],i,n)}function h(t,e){return Qu.setFromMatrixPosition(t.matrixWorld),Pu.setFromMatrixPosition(e.matrixWorld),Qu.distanceToSquared(Pu)}o.style.overflow="hidden",this.domElement=o,this.getSize=function(){return{width:i,height:n}},this.render=function(t,e){!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),Lu.copy(e.matrixWorldInverse),Du.multiplyMatrices(e.projectionMatrix,Lu),l(t,t,e),function(t){const e=function(t){const e=[];return t.traverse((function(t){t.isCSS2DObject&&e.push(t)})),e}(t).sort((function(t,e){if(t.renderOrder!==e.renderOrder)return e.renderOrder-t.renderOrder;return a.objects.get(t).distanceToCameraSquared-a.objects.get(e).distanceToCameraSquared})),i=e.length;for(let t=0,n=e.length;t<n;t++)e[t].element.style.zIndex=i-t}(t)},this.setSize=function(t,e){i=t,n=e,r=i/2,s=n/2,o.style.width=t+"px",o.style.height=e+"px"}}}function Nu(t,e,i){let n=i;const r=new ae;return t.updateWorldMatrix(!0,!0),t.traverseVisible((t=>{const{geometry:i}=t;if(void 0!==i){const{position:s}=i.attributes;if(void 0!==s)for(let i=0,a=s.count;i<a;i++)t.isMesh?t.getVertexPosition(i,r):r.fromBufferAttribute(s,i),t.isSkinnedMesh||r.applyMatrix4(t.matrixWorld),n=e(n,r)}})),n}const Fu={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class ku{constructor(){this.pluginCallbacks=[],this.register((function(t){return new yd(t)})),this.register((function(t){return new xd(t)})),this.register((function(t){return new wd(t)})),this.register((function(t){return new Cd(t)})),this.register((function(t){return new Id(t)})),this.register((function(t){return new bd(t)})),this.register((function(t){return new _d(t)})),this.register((function(t){return new Ed(t)})),this.register((function(t){return new Sd(t)})),this.register((function(t){return new Md(t)}))}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){const r=new vd,s=[];for(let t=0,e=this.pluginCallbacks.length;t<e;t++)s.push(this.pluginCallbacks[t](r));r.setPlugins(s),r.write(t,e,n).catch(i)}parseAsync(t,e){const i=this;return new Promise((function(n,r){i.parse(t,n,r,e)}))}}const Ou=0,Gu=1,Hu=2,zu=3,Vu=4,Wu=5120,qu=5121,ju=5122,Yu=5123,Ju=5124,Xu=5125,Ku=5126,$u=34962,Zu=34963,td=9728,ed=9729,id=9984,nd=9985,rd=9986,sd=9987,ad=33071,od=33648,ld=10497,hd="KHR_mesh_quantization",cd={};cd[M]=td,cd[B]=id,cd[T]=rd,cd[R]=ed,cd[L]=nd,cd[D]=sd,cd[b]=ad,cd[I]=ld,cd[S]=od;const ud={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},dd=new bi;function Ad(t,e){return t.length===e.length&&t.every((function(t,i){return t===e[i]}))}function pd(t){return 4*Math.ceil(t/4)}function md(t,e=0){const i=pd(t.byteLength);if(i!==t.byteLength){const n=new Uint8Array(i);if(n.set(new Uint8Array(t)),0!==e)for(let r=t.byteLength;r<i;r++)n[r]=e;return n.buffer}return t}function gd(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function fd(t,e){if(void 0!==t.toBlob)return new Promise((i=>t.toBlob(i,e)));let i;return"image/jpeg"===e?i=.92:"image/webp"===e&&(i=.8),t.convertToBlob({type:e,quality:i})}class vd{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(t){this.plugins=t}async write(t,e,i={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},i),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(t),await Promise.all(this.pending);const n=this,r=n.buffers,s=n.json;i=n.options;const a=n.extensionsUsed,o=n.extensionsRequired,l=new Blob(r,{type:"application/octet-stream"}),h=Object.keys(a),c=Object.keys(o);if(h.length>0&&(s.extensionsUsed=h),c.length>0&&(s.extensionsRequired=c),s.buffers&&s.buffers.length>0&&(s.buffers[0].byteLength=l.size),!0===i.binary){const t=new FileReader;t.readAsArrayBuffer(l),t.onloadend=function(){const i=md(t.result),n=new DataView(new ArrayBuffer(8));n.setUint32(0,i.byteLength,!0),n.setUint32(4,5130562,!0);const r=md((a=JSON.stringify(s),(new TextEncoder).encode(a).buffer),32);var a;const o=new DataView(new ArrayBuffer(8));o.setUint32(0,r.byteLength,!0),o.setUint32(4,1313821514,!0);const l=new ArrayBuffer(12),h=new DataView(l);h.setUint32(0,1179937895,!0),h.setUint32(4,2,!0);const c=12+o.byteLength+r.byteLength+n.byteLength+i.byteLength;h.setUint32(8,c,!0);const u=new Blob([l,o,r,n,i],{type:"application/octet-stream"}),d=new FileReader;d.readAsArrayBuffer(u),d.onloadend=function(){e(d.result)}}}else if(s.buffers&&s.buffers.length>0){const t=new FileReader;t.readAsDataURL(l),t.onloadend=function(){const i=t.result;s.buffers[0].uri=i,e(s)}}else e(s)}serializeUserData(t,e){if(0===Object.keys(t.userData).length)return;const i=this.options,n=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(t.userData));if(i.includeCustomExtensions&&r.gltfExtensions){void 0===e.extensions&&(e.extensions={});for(const t in r.gltfExtensions)e.extensions[t]=r.gltfExtensions[t],n[t]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(e.extras=r)}catch(e){console.warn("THREE.GLTFExporter: userData of '"+t.name+"' won't be serialized because of JSON.stringify error - "+e.message)}}getUID(t,e=!1){if(!1===this.uids.has(t)){const e=new Map;e.set(!0,this.uid++),e.set(!1,this.uid++),this.uids.set(t,e)}return this.uids.get(t).get(e)}isNormalizedNormalAttribute(t){if(this.cache.attributesNormalized.has(t))return!1;const e=new ae;for(let i=0,n=t.count;i<n;i++)if(Math.abs(e.fromBufferAttribute(t,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(t){const e=this.cache;if(e.attributesNormalized.has(t))return e.attributesNormalized.get(t);const i=t.clone(),n=new ae;for(let t=0,e=i.count;t<e;t++)n.fromBufferAttribute(i,t),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),i.setXYZ(t,n.x,n.y,n.z);return e.attributesNormalized.set(t,i),i}applyTextureTransform(t,e){let i=!1;const n={};0===e.offset.x&&0===e.offset.y||(n.offset=e.offset.toArray(),i=!0),0!==e.rotation&&(n.rotation=e.rotation,i=!0),1===e.repeat.x&&1===e.repeat.y||(n.scale=e.repeat.toArray(),i=!0),i&&(t.extensions=t.extensions||{},t.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(t,e){if(t===e)return t;function i(t){return t.encoding===At?function(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}:function(t){return t}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");const n=t?t.image:null,r=e?e.image:null,s=Math.max(n?n.width:0,r?r.width:0),a=Math.max(n?n.height:0,r?r.height:0),o=gd();o.width=s,o.height=a;const l=o.getContext("2d");l.fillStyle="#00ffff",l.fillRect(0,0,s,a);const h=l.getImageData(0,0,s,a);if(n){l.drawImage(n,0,0,s,a);const e=i(t),r=l.getImageData(0,0,s,a).data;for(let t=2;t<r.length;t+=4)h.data[t]=256*e(r[t]/256)}if(r){l.drawImage(r,0,0,s,a);const t=i(e),n=l.getImageData(0,0,s,a).data;for(let e=1;e<n.length;e+=4)h.data[e]=256*t(n[e]/256)}l.putImageData(h,0,0);const c=(t||e).clone();return c.source=new Kt(o),c.encoding=dt,c}processBuffer(t){const e=this.json,i=this.buffers;return e.buffers||(e.buffers=[{byteLength:0}]),i.push(t),0}processBufferView(t,e,i,n,r){const s=this.json;let a;switch(s.bufferViews||(s.bufferViews=[]),e){case Wu:case qu:a=1;break;case ju:case Yu:a=2;break;default:a=4}const o=pd(n*t.itemSize*a),l=new DataView(new ArrayBuffer(o));let h=0;for(let r=i;r<i+n;r++)for(let i=0;i<t.itemSize;i++){let n;t.itemSize>4?n=t.array[r*t.itemSize+i]:(0===i?n=t.getX(r):1===i?n=t.getY(r):2===i?n=t.getZ(r):3===i&&(n=t.getW(r)),!0===t.normalized&&(n=Ut.normalize(n,t.array))),e===Ku?l.setFloat32(h,n,!0):e===Ju?l.setInt32(h,n,!0):e===Xu?l.setUint32(h,n,!0):e===ju?l.setInt16(h,n,!0):e===Yu?l.setUint16(h,n,!0):e===Wu?l.setInt8(h,n):e===qu&&l.setUint8(h,n),h+=a}const c={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:o};void 0!==r&&(c.target=r),r===$u&&(c.byteStride=t.itemSize*a),this.byteOffset+=o,s.bufferViews.push(c);return{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(t){const e=this,i=e.json;return i.bufferViews||(i.bufferViews=[]),new Promise((function(n){const r=new FileReader;r.readAsArrayBuffer(t),r.onloadend=function(){const t=md(r.result),s={buffer:e.processBuffer(t),byteOffset:e.byteOffset,byteLength:t.byteLength};e.byteOffset+=t.byteLength,n(i.bufferViews.push(s)-1)}}))}processAccessor(t,e,i,n){const r=this.json;let s;if(t.array.constructor===Float32Array)s=Ku;else if(t.array.constructor===Int32Array)s=Ju;else if(t.array.constructor===Uint32Array)s=Xu;else if(t.array.constructor===Int16Array)s=ju;else if(t.array.constructor===Uint16Array)s=Yu;else if(t.array.constructor===Int8Array)s=Wu;else{if(t.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");s=qu}if(void 0===i&&(i=0),void 0===n&&(n=t.count),0===n)return null;const a=function(t,e,i){const n={min:new Array(t.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(t.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let r=e;r<e+i;r++)for(let e=0;e<t.itemSize;e++){let i;t.itemSize>4?i=t.array[r*t.itemSize+e]:(0===e?i=t.getX(r):1===e?i=t.getY(r):2===e?i=t.getZ(r):3===e&&(i=t.getW(r)),!0===t.normalized&&(i=Ut.normalize(i,t.array))),n.min[e]=Math.min(n.min[e],i),n.max[e]=Math.max(n.max[e],i)}return n}(t,i,n);let o;void 0!==e&&(o=t===e.index?Zu:$u);const l=this.processBufferView(t,s,i,n,o),h={bufferView:l.id,byteOffset:l.byteOffset,componentType:s,count:n,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[t.itemSize]};return!0===t.normalized&&(h.normalized=!0),r.accessors||(r.accessors=[]),r.accessors.push(h)-1}processImage(t,e,i,n="image/png"){if(null!==t){const r=this,s=r.cache,a=r.json,o=r.options,l=r.pending;s.images.has(t)||s.images.set(t,{});const h=s.images.get(t),c=n+":flipY/"+i.toString();if(void 0!==h[c])return h[c];a.images||(a.images=[]);const u={mimeType:n},d=gd();d.width=Math.min(t.width,o.maxTextureSize),d.height=Math.min(t.height,o.maxTextureSize);const A=d.getContext("2d");if(!0===i&&(A.translate(0,d.height),A.scale(1,-1)),void 0!==t.data){e!==k&&console.error("GLTFExporter: Only RGBAFormat is supported."),(t.width>o.maxTextureSize||t.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",t);const i=new Uint8ClampedArray(t.height*t.width*4);for(let e=0;e<i.length;e+=4)i[e+0]=t.data[e+0],i[e+1]=t.data[e+1],i[e+2]=t.data[e+2],i[e+3]=t.data[e+3];A.putImageData(new ImageData(i,t.width,t.height),0,0)}else A.drawImage(t,0,0,d.width,d.height);!0===o.binary?l.push(fd(d,n).then((t=>r.processBufferViewImage(t))).then((t=>{u.bufferView=t}))):void 0!==d.toDataURL?u.uri=d.toDataURL(n):l.push(fd(d,n).then((t=>(new FileReader).readAsDataURL(t))).then((t=>{u.uri=t})));const p=a.images.push(u)-1;return h[c]=p,p}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(t){const e=this.json;e.samplers||(e.samplers=[]);const i={magFilter:cd[t.magFilter],minFilter:cd[t.minFilter],wrapS:cd[t.wrapS],wrapT:cd[t.wrapT]};return e.samplers.push(i)-1}processTexture(t){const e=this.cache,i=this.json;if(e.textures.has(t))return e.textures.get(t);i.textures||(i.textures=[]);let n=t.userData.mimeType;"image/webp"===n&&(n="image/png");const r={sampler:this.processSampler(t),source:this.processImage(t.image,t.format,t.flipY,n)};t.name&&(r.name=t.name),this._invokeAll((function(e){e.writeTexture&&e.writeTexture(t,r)}));const s=i.textures.push(r)-1;return e.textures.set(t,s),s}processMaterial(t){const e=this.cache,i=this.json;if(e.materials.has(t))return e.materials.get(t);if(t.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;i.materials||(i.materials=[]);const n={pbrMetallicRoughness:{}};!0!==t.isMeshStandardMaterial&&!0!==t.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=t.color.toArray().concat([t.opacity]);if(Ad(r,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=r),t.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=t.metalness,n.pbrMetallicRoughness.roughnessFactor=t.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),t.metalnessMap||t.roughnessMap){const e=this.buildMetalRoughTexture(t.metalnessMap,t.roughnessMap),i={index:this.processTexture(e)};this.applyTextureTransform(i,e),n.pbrMetallicRoughness.metallicRoughnessTexture=i}if(t.map){const e={index:this.processTexture(t.map)};this.applyTextureTransform(e,t.map),n.pbrMetallicRoughness.baseColorTexture=e}if(t.emissive){const e=t.emissive;if(Math.max(e.r,e.g,e.b)>0&&(n.emissiveFactor=t.emissive.toArray()),t.emissiveMap){const e={index:this.processTexture(t.emissiveMap)};this.applyTextureTransform(e,t.emissiveMap),n.emissiveTexture=e}}if(t.normalMap){const e={index:this.processTexture(t.normalMap)};t.normalScale&&1!==t.normalScale.x&&(e.scale=t.normalScale.x),this.applyTextureTransform(e,t.normalMap),n.normalTexture=e}if(t.aoMap){const e={index:this.processTexture(t.aoMap),texCoord:1};1!==t.aoMapIntensity&&(e.strength=t.aoMapIntensity),this.applyTextureTransform(e,t.aoMap),n.occlusionTexture=e}t.transparent?n.alphaMode="BLEND":t.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=t.alphaTest),t.side===h&&(n.doubleSided=!0),""!==t.name&&(n.name=t.name),this.serializeUserData(t,n),this._invokeAll((function(e){e.writeMaterial&&e.writeMaterial(t,n)}));const s=i.materials.push(n)-1;return e.materials.set(t,s),s}processMesh(t){const e=this.cache,i=this.json,n=[t.geometry.uuid];if(Array.isArray(t.material))for(let e=0,i=t.material.length;e<i;e++)n.push(t.material[e].uuid);else n.push(t.material.uuid);const r=n.join(":");if(e.meshes.has(r))return e.meshes.get(r);const s=t.geometry;let a;a=t.isLineSegments?Gu:t.isLineLoop?Hu:t.isLine?zu:t.isPoints?Ou:t.material.wireframe?Gu:Vu;const o={},l={},h=[],c=[],u={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=s.getAttribute("normal");void 0===d||this.isNormalizedNormalAttribute(d)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let A=null;for(let t in s.attributes){if("morph"===t.slice(0,5))continue;const i=s.attributes[t];t=u[t]||t.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(t)||(t="_"+t),e.attributes.has(this.getUID(i))){l[t]=e.attributes.get(this.getUID(i));continue}A=null;const n=i.array;"JOINTS_0"!==t||n instanceof Uint16Array||n instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),A=new Qi(new Uint16Array(n),i.itemSize,i.normalized));const r=this.processAccessor(A||i,s);null!==r&&(t.startsWith("_")||this.detectMeshQuantization(t,i),l[t]=r,e.attributes.set(this.getUID(i),r))}if(void 0!==d&&s.setAttribute("normal",d),0===Object.keys(l).length)return null;if(void 0!==t.morphTargetInfluences&&t.morphTargetInfluences.length>0){const i=[],n=[],r={};if(void 0!==t.morphTargetDictionary)for(const e in t.morphTargetDictionary)r[t.morphTargetDictionary[e]]=e;for(let a=0;a<t.morphTargetInfluences.length;++a){const o={};let l=!1;for(const t in s.morphAttributes){if("position"!==t&&"normal"!==t){l||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),l=!0);continue}const i=s.morphAttributes[t][a],n=t.toUpperCase(),r=s.attributes[t];if(e.attributes.has(this.getUID(i,!0))){o[n]=e.attributes.get(this.getUID(i,!0));continue}const h=i.clone();if(!s.morphTargetsRelative)for(let t=0,e=i.count;t<e;t++)for(let e=0;e<i.itemSize;e++)0===e&&h.setX(t,i.getX(t)-r.getX(t)),1===e&&h.setY(t,i.getY(t)-r.getY(t)),2===e&&h.setZ(t,i.getZ(t)-r.getZ(t)),3===e&&h.setW(t,i.getW(t)-r.getW(t));o[n]=this.processAccessor(h,s),e.attributes.set(this.getUID(r,!0),o[n])}c.push(o),i.push(t.morphTargetInfluences[a]),void 0!==t.morphTargetDictionary&&n.push(r[a])}o.weights=i,n.length>0&&(o.extras={},o.extras.targetNames=n)}const p=Array.isArray(t.material);if(p&&0===s.groups.length)return null;const m=p?t.material:[t.material],g=p?s.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let t=0,i=g.length;t<i;t++){const i={mode:a,attributes:l};if(this.serializeUserData(s,i),c.length>0&&(i.targets=c),null!==s.index){let n=this.getUID(s.index);void 0===g[t].start&&void 0===g[t].count||(n+=":"+g[t].start+":"+g[t].count),e.attributes.has(n)?i.indices=e.attributes.get(n):(i.indices=this.processAccessor(s.index,s,g[t].start,g[t].count),e.attributes.set(n,i.indices)),null===i.indices&&delete i.indices}const n=this.processMaterial(m[g[t].materialIndex]);null!==n&&(i.material=n),h.push(i)}o.primitives=h,i.meshes||(i.meshes=[]),this._invokeAll((function(e){e.writeMesh&&e.writeMesh(t,o)}));const f=i.meshes.push(o)-1;return e.meshes.set(r,f),f}detectMeshQuantization(t,e){if(this.extensionsUsed[hd])return;let i;switch(e.array.constructor){case Int8Array:i="byte";break;case Uint8Array:i="unsigned byte";break;case Int16Array:i="short";break;case Uint16Array:i="unsigned short";break;default:return}e.normalized&&(i+=" normalized");const n=t.split("_",1)[0];Fu[n]&&Fu[n].includes(i)&&(this.extensionsUsed[hd]=!0,this.extensionsRequired[hd]=!0)}processCamera(t){const e=this.json;e.cameras||(e.cameras=[]);const i=t.isOrthographicCamera,n={type:i?"orthographic":"perspective"};return i?n.orthographic={xmag:2*t.right,ymag:2*t.top,zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near}:n.perspective={aspectRatio:t.aspect,yfov:Ut.degToRad(t.fov),zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near},""!==t.name&&(n.name=t.type),e.cameras.push(n)-1}processAnimation(t,e){const i=this.json,n=this.nodeMap;i.animations||(i.animations=[]);const r=(t=ku.Utils.mergeMorphTargetTracks(t.clone(),e)).tracks,s=[],a=[];for(let t=0;t<r.length;++t){const i=r[t],o=hl.parseTrackName(i.name);let l=hl.findNode(e,o.nodeName);const h=ud[o.propertyName];if("bones"===o.objectName&&(l=!0===l.isSkinnedMesh?l.skeleton.getBoneByName(o.objectIndex):void 0),!l||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',i.name),null;const c=1;let u,d=i.values.length/i.times.length;h===ud.morphTargetInfluences&&(d/=l.morphTargetInfluences.length),!0===i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(u="CUBICSPLINE",d/=3):u=i.getInterpolation()===nt?"STEP":"LINEAR",a.push({input:this.processAccessor(new Qi(i.times,c)),output:this.processAccessor(new Qi(i.values,d)),interpolation:u}),s.push({sampler:a.length-1,target:{node:n.get(l),path:h}})}return i.animations.push({name:t.name||"clip_"+i.animations.length,samplers:a,channels:s}),i.animations.length-1}processSkin(t){const e=this.json,i=this.nodeMap,n=e.nodes[i.get(t)],r=t.skeleton;if(void 0===r)return null;const s=t.skeleton.bones[0];if(void 0===s)return null;const a=[],o=new Float32Array(16*r.bones.length),l=new Ue;for(let e=0;e<r.bones.length;++e)a.push(i.get(r.bones[e])),l.copy(r.boneInverses[e]),l.multiply(t.bindMatrix).toArray(o,16*e);void 0===e.skins&&(e.skins=[]),e.skins.push({inverseBindMatrices:this.processAccessor(new Qi(o,16)),joints:a,skeleton:i.get(s)});return n.skin=e.skins.length-1}processNode(t){const e=this.json,i=this.options,n=this.nodeMap;e.nodes||(e.nodes=[]);const r={};if(i.trs){const e=t.quaternion.toArray(),i=t.position.toArray(),n=t.scale.toArray();Ad(e,[0,0,0,1])||(r.rotation=e),Ad(i,[0,0,0])||(r.translation=i),Ad(n,[1,1,1])||(r.scale=n)}else t.matrixAutoUpdate&&t.updateMatrix(),!1===Ad(t.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(r.matrix=t.matrix.elements);if(""!==t.name&&(r.name=String(t.name)),this.serializeUserData(t,r),t.isMesh||t.isLine||t.isPoints){const e=this.processMesh(t);null!==e&&(r.mesh=e)}else t.isCamera&&(r.camera=this.processCamera(t));if(t.isSkinnedMesh&&this.skins.push(t),t.children.length>0){const e=[];for(let n=0,r=t.children.length;n<r;n++){const r=t.children[n];if(r.visible||!1===i.onlyVisible){const t=this.processNode(r);null!==t&&e.push(t)}}e.length>0&&(r.children=e)}this._invokeAll((function(e){e.writeNode&&e.writeNode(t,r)}));const s=e.nodes.push(r)-1;return n.set(t,s),s}processScene(t){const e=this.json,i=this.options;e.scenes||(e.scenes=[],e.scene=0);const n={};""!==t.name&&(n.name=t.name),e.scenes.push(n);const r=[];for(let e=0,n=t.children.length;e<n;e++){const n=t.children[e];if(n.visible||!1===i.onlyVisible){const t=this.processNode(n);null!==t&&r.push(t)}}r.length>0&&(n.nodes=r),this.serializeUserData(t,n)}processObjects(t){const e=new da;e.name="AuxScene";for(let i=0;i<t.length;i++)e.children.push(t[i]);this.processScene(e)}processInput(t){const e=this.options;t=t instanceof Array?t:[t],this._invokeAll((function(e){e.beforeParse&&e.beforeParse(t)}));const i=[];for(let e=0;e<t.length;e++)t[e]instanceof da?this.processScene(t[e]):i.push(t[e]);i.length>0&&this.processObjects(i);for(let t=0;t<this.skins.length;++t)this.processSkin(this.skins[t]);for(let i=0;i<e.animations.length;++i)this.processAnimation(e.animations[i],t[0]);this._invokeAll((function(e){e.afterParse&&e.afterParse(t)}))}_invokeAll(t){for(let e=0,i=this.plugins.length;e<i;e++)t(this.plugins[e])}}class yd{constructor(t){this.writer=t,this.name="KHR_lights_punctual"}writeNode(t,e){if(!t.isLight)return;if(!t.isDirectionalLight&&!t.isPointLight&&!t.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",t);const i=this.writer,n=i.json,r=i.extensionsUsed,s={};t.name&&(s.name=t.name),s.color=t.color.toArray(),s.intensity=t.intensity,t.isDirectionalLight?s.type="directional":t.isPointLight?(s.type="point",t.distance>0&&(s.range=t.distance)):t.isSpotLight&&(s.type="spot",t.distance>0&&(s.range=t.distance),s.spot={},s.spot.innerConeAngle=(t.penumbra-1)*t.angle*-1,s.spot.outerConeAngle=t.angle),void 0!==t.decay&&2!==t.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!t.target||t.target.parent===t&&0===t.target.position.x&&0===t.target.position.y&&-1===t.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."),r[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},r[this.name]=!0);const a=n.extensions[this.name].lights;a.push(s),e.extensions=e.extensions||{},e.extensions[this.name]={light:a.length-1}}}class xd{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}writeMaterial(t,e){if(!t.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},i[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}}class _d{constructor(t){this.writer=t,this.name="KHR_materials_clearcoat"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||0===t.clearcoat)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.clearcoatFactor=t.clearcoat,t.clearcoatMap){const e={index:i.processTexture(t.clearcoatMap)};i.applyTextureTransform(e,t.clearcoatMap),r.clearcoatTexture=e}if(r.clearcoatRoughnessFactor=t.clearcoatRoughness,t.clearcoatRoughnessMap){const e={index:i.processTexture(t.clearcoatRoughnessMap)};i.applyTextureTransform(e,t.clearcoatRoughnessMap),r.clearcoatRoughnessTexture=e}if(t.clearcoatNormalMap){const e={index:i.processTexture(t.clearcoatNormalMap)};i.applyTextureTransform(e,t.clearcoatNormalMap),r.clearcoatNormalTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Ed{constructor(t){this.writer=t,this.name="KHR_materials_iridescence"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||0===t.iridescence)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.iridescenceFactor=t.iridescence,t.iridescenceMap){const e={index:i.processTexture(t.iridescenceMap)};i.applyTextureTransform(e,t.iridescenceMap),r.iridescenceTexture=e}if(r.iridescenceIor=t.iridescenceIOR,r.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],r.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1],t.iridescenceThicknessMap){const e={index:i.processTexture(t.iridescenceThicknessMap)};i.applyTextureTransform(e,t.iridescenceThicknessMap),r.iridescenceThicknessTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class wd{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||0===t.transmission)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.transmissionFactor=t.transmission,t.transmissionMap){const e={index:i.processTexture(t.transmissionMap)};i.applyTextureTransform(e,t.transmissionMap),r.transmissionTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Cd{constructor(t){this.writer=t,this.name="KHR_materials_volume"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||0===t.transmission)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.thicknessFactor=t.thickness,t.thicknessMap){const e={index:i.processTexture(t.thicknessMap)};i.applyTextureTransform(e,t.thicknessMap),r.thicknessTexture=e}r.attenuationDistance=t.attenuationDistance,r.attenuationColor=t.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Id{constructor(t){this.writer=t,this.name="KHR_materials_ior"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||1.5===t.ior)return;const i=this.writer.extensionsUsed,n={};n.ior=t.ior,e.extensions=e.extensions||{},e.extensions[this.name]=n,i[this.name]=!0}}class bd{constructor(t){this.writer=t,this.name="KHR_materials_specular"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||1===t.specularIntensity&&t.specularColor.equals(dd)&&!t.specularIntensityMap&&!t.specularColorTexture)return;const i=this.writer,n=i.extensionsUsed,r={};if(t.specularIntensityMap){const e={index:i.processTexture(t.specularIntensityMap)};i.applyTextureTransform(e,t.specularIntensityMap),r.specularTexture=e}if(t.specularColorMap){const e={index:i.processTexture(t.specularColorMap)};i.applyTextureTransform(e,t.specularColorMap),r.specularColorTexture=e}r.specularFactor=t.specularIntensity,r.specularColorFactor=t.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Sd{constructor(t){this.writer=t,this.name="KHR_materials_sheen"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||0==t.sheen)return;const i=this.writer,n=i.extensionsUsed,r={};if(t.sheenRoughnessMap){const e={index:i.processTexture(t.sheenRoughnessMap)};i.applyTextureTransform(e,t.sheenRoughnessMap),r.sheenRoughnessTexture=e}if(t.sheenColorMap){const e={index:i.processTexture(t.sheenColorMap)};i.applyTextureTransform(e,t.sheenColorMap),r.sheenColorTexture=e}r.sheenRoughnessFactor=t.sheenRoughness,r.sheenColorFactor=t.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Md{constructor(t){this.writer=t,this.name="KHR_materials_emissive_strength"}writeMaterial(t,e){if(!t.isMeshStandardMaterial||1===t.emissiveIntensity)return;const i=this.writer.extensionsUsed,n={};n.emissiveStrength=t.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=n,i[this.name]=!0}}ku.Utils={insertKeyframe:function(t,e){const i=.001,n=t.getValueSize(),r=new t.TimeBufferType(t.times.length+1),s=new t.ValueBufferType(t.values.length+n),a=t.createInterpolant(new t.ValueBufferType(n));let o;if(0===t.times.length){r[0]=e;for(let t=0;t<n;t++)s[t]=0;o=0}else if(e<t.times[0]){if(Math.abs(t.times[0]-e)<i)return 0;r[0]=e,r.set(t.times,1),s.set(a.evaluate(e),0),s.set(t.values,n),o=0}else if(e>t.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<i)return t.times.length-1;r[r.length-1]=e,r.set(t.times,0),s.set(t.values,0),s.set(a.evaluate(e),t.values.length),o=r.length-1}else for(let l=0;l<t.times.length;l++){if(Math.abs(t.times[l]-e)<i)return l;if(t.times[l]<e&&t.times[l+1]>e){r.set(t.times.slice(0,l+1),0),r[l+1]=e,r.set(t.times.slice(l+1),l+2),s.set(t.values.slice(0,(l+1)*n),0),s.set(a.evaluate(e),(l+1)*n),s.set(t.values.slice((l+1)*n),(l+2)*n),o=l+1;break}}return t.times=r,t.values=s,o},mergeMorphTargetTracks:function(t,e){const i=[],n={},r=t.tracks;for(let t=0;t<r.length;++t){let s=r[t];const a=hl.parseTrackName(s.name),o=hl.findNode(e,a.nodeName);if("morphTargetInfluences"!==a.propertyName||void 0===a.propertyIndex){i.push(s);continue}if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),s=s.clone(),s.setInterpolation(rt)}const l=o.morphTargetInfluences.length,h=o.morphTargetDictionary[a.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let c;if(void 0===n[o.uuid]){c=s.clone();const t=new c.ValueBufferType(l*c.times.length);for(let e=0;e<c.times.length;e++)t[e*l+h]=c.values[e];c.name=(a.nodeName||"")+".morphTargetInfluences",c.values=t,n[o.uuid]=c,i.push(c);continue}const u=s.createInterpolant(new s.ValueBufferType(1));c=n[o.uuid];for(let t=0;t<c.times.length;t++)c.values[t*l+h]=u.evaluate(c.times[t]);for(let t=0;t<s.times.length;t++){const e=this.insertKeyframe(c,s.times[t]);c.values[e*l+h]=s.values[t]}}return t.tracks=i,t}};
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const Bd=t=>void 0!==t.material&&t.userData&&t.userData.variantMaterials&&!!Array.from(t.userData.variantMaterials.values()).filter((t=>Td(t.material))),Td=t=>t&&t.isMaterial&&!Array.isArray(t);class Rd{constructor(t){this.writer=t,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(t){const e=new Set;for(const i of t)i.traverse((t=>{if(!Bd(t))return;const i=t.userData.variantMaterials,n=t.userData.variantData;for(const[t,r]of n){const n=i.get(r.index);n&&Td(n.material)&&e.add(t)}}));e.forEach((t=>this.variantNames.push(t)))}writeMesh(t,e){if(!Bd(t))return;const i=t.userData,n=i.variantMaterials,r=i.variantData,s=new Map,a=new Map,o=Array.from(r.values()).sort(((t,e)=>t.index-e.index));for(const[t,e]of o.entries())a.set(e.index,t);for(const t of r.values()){const e=n.get(t.index);if(!e||!Td(e.material))continue;const i=this.writer.processMaterial(e.material);s.has(i)||s.set(i,{material:i,variants:[]}),s.get(i).variants.push(a.get(t.index))}const l=Array.from(s.values()).map((t=>t.variants.sort(((t,e)=>t-e))&&t)).sort(((t,e)=>t.material-e.material));if(0===l.length)return;const h=Td(i.originalMaterial)?this.writer.processMaterial(i.originalMaterial):-1;for(const t of e.primitives)h>=0&&(t.material=h),t.extensions=t.extensions||{},t.extensions[this.name]={mappings:l}}afterParse(){if(0===this.variantNames.length)return;const t=this.writer.json;t.extensions=t.extensions||{};const e=this.variantNames.map((t=>({name:t})));t.extensions[this.name]={variants:e},this.writer.extensionsUsed[this.name]=!0}}class Ld{constructor(t,e,i,n,r){this.xrLight=t,this.renderer=e,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=r,this.frameCallback=this.onXRFrame.bind(this);const s=e.xr.getSession();if(n&&"XRWebGLBinding"in window){const i=new wn(16);t.environment=i.texture;const n=e.getContext();switch(s.preferredReflectionFormat){case"srgba8":n.getExtension("EXT_sRGB");break;case"rgba16f":n.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(s,n),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}s.requestAnimationFrame(this.frameCallback)}updateReflection(){const t=this.renderer.properties.get(this.xrLight.environment);if(t){const e=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);e&&(t.__webglTexture=e,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(t,e){if(!this.xrLight)return;e.session.requestAnimationFrame(this.frameCallback);const i=e.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const t=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/t,i.primaryLightIntensity.y/t,i.primaryLightIntensity.z/t),this.xrLight.directionalLight.intensity=t,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class Dd extends na{constructor(t,e=!0){super(),this.lightProbe=new Zo,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new Ko,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,n=!1;t.xr.addEventListener("sessionstart",(()=>{const r=t.xr.getSession();"requestLightProbe"in r&&r.requestLightProbe({reflectionFormat:r.preferredReflectionFormat}).then((r=>{i=new Ld(this,t,r,e,(()=>{n=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),t.xr.addEventListener("sessionend",(()=>{i&&(i.dispose(),i=null),n&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Qd{constructor(t=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(t)}setDecayTime(t){this.naturalFrequency=1/Math.max(.001,t)}update(t,e,i,n){const r=2e-4*this.naturalFrequency;if(null==t||0===n)return e;if(t===e&&0===this.velocity)return e;if(i<0)return t;const s=t-e,a=this.velocity+this.naturalFrequency*s,o=s+i*a,l=Math.exp(-this.naturalFrequency*i),h=(a-this.naturalFrequency*o)*l,c=-this.naturalFrequency*(h+a*l);return Math.abs(h)<r*Math.abs(n)&&c*s>=0?(this.velocity=0,e):(this.velocity=h,e+o*l)}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Pd=.2,Ud=Math.PI/24,Nd=new Nt,Fd=(t,e,i)=>{let n=e>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let r=0;r<=12;++r)t.push(e+.17*Math.cos(n),i+.17*Math.sin(n),0,e+Pd*Math.cos(n),i+Pd*Math.sin(n),0),n+=Ud};class kd extends cn{constructor(t,e){const i=new Wi,n=[],r=[],{size:s,boundingBox:a}=t,o=s.x/2,l=("back"===e?s.y:s.z)/2;Fd(r,o,l),Fd(r,-o,l),Fd(r,-o,-l),Fd(r,o,-l);const c=r.length/3;for(let t=0;t<c-2;t+=2)n.push(t,t+1,t+3,t,t+3,t+2);const u=c-2;n.push(u,u+1,1,u,1,0),i.setAttribute("position",new Ni(r,3)),i.setIndex(n),super(i),this.side=e;const d=this.material;switch(d.side=h,d.transparent=!0,d.opacity=0,this.goalOpacity=0,this.opacityDamper=new Qd,this.hitPlane=new cn(new Dn(2*(o+Pd),2*(l+Pd))),this.hitPlane.visible=!1,this.hitPlane.material.side=h,this.add(this.hitPlane),a.getCenter(this.position),e){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=a.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=a.min.z,this.position.z=this.shadowHeight}t.target.add(this),this.offsetHeight=0}getHit(t,e,i){Nd.set(e,-i),this.hitPlane.visible=!0;const n=t.positionAndNormalFromPoint(Nd,this.hitPlane);return this.hitPlane.visible=!1,null==n?null:n.position}getExpandedHit(t,e,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const n=this.getHit(t,e,i);return this.hitPlane.scale.set(1,1,1),n}set offsetHeight(t){t-=.001,"back"===this.side?this.position.z=this.shadowHeight+t:this.position.y=this.shadowHeight+t}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(t){this.goalOpacity=t?.75:0}updateOpacity(t){const e=this.material;e.opacity=this.opacityDamper.update(e.opacity,this.goalOpacity,t,1),this.visible=e.opacity>0}dispose(){var t;const{geometry:e,material:i}=this.hitPlane;e.dispose(),i.dispose(),this.geometry.dispose(),this.material.dispose(),null===(t=this.parent)||void 0===t||t.remove(this)}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Od=(t,e)=>({type:"number",number:t,unit:e}),Gd=(()=>{const t={};return e=>{const i=e;if(i in t)return t[i];const n=[];let r=0;for(;e;){if(++r>1e3){e="";break}const t=Hd(e),i=t.nodes[0];if(null==i||0===i.terms.length)break;n.push(i),e=t.remainingInput}return t[i]=n}})(),Hd=(()=>{const t=/^(\-\-|[a-z\u0240-\uffff])/i,e=/^([\*\+\/]|[\-]\s)/i,i=/^[\),]/;return n=>{const r=[];for(;n.length&&(n=n.trim(),!i.test(n));)if("("===n[0]){const{nodes:t,remainingInput:e}=qd(n);n=e,r.push({type:"function",name:{type:"ident",value:"calc"},arguments:t})}else if(t.test(n)){const t=zd(n),e=t.nodes[0];if("("===(n=t.remainingInput)[0]){const{nodes:t,remainingInput:i}=qd(n);r.push({type:"function",name:e,arguments:t}),n=i}else r.push(e)}else if(e.test(n))r.push({type:"operator",value:n[0]}),n=n.slice(1);else{const{nodes:t,remainingInput:e}="#"===n[0]?Wd(n):Vd(n);if(0===t.length)break;r.push(t[0]),n=e}return{nodes:[{type:"expression",terms:r}],remainingInput:n}}})(),zd=(()=>{const t=/[^a-z0-9_\-\u0240-\uffff]/i;return e=>{const i=e.match(t);return{nodes:[{type:"ident",value:null==i?e:e.substr(0,i.index)}],remainingInput:null==i?"":e.substr(i.index)}}})(),Vd=(()=>{const t=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,e=/^[a-z%]+/i,i=/^(m|mm|cm|rad|deg|[%])$/;return n=>{const r=n.match(t),s=null==r?"0":r[0],a=(n=null==s?n:n.slice(s.length)).match(e);let o=null!=a&&""!==a[0]?a[0]:null;const l=null==a?n:n.slice(o.length);return null==o||i.test(o)||(o=null),{nodes:[{type:"number",number:parseFloat(s)||0,unit:o}],remainingInput:l}}})(),Wd=(()=>{const t=/^[a-f0-9]*/i;return e=>{const i=(e=e.slice(1).trim()).match(t);return{nodes:null==i?[]:[{type:"hex",value:i[0]}],remainingInput:null==i?e:e.slice(i[0].length)}}})(),qd=t=>{const e=[];for(t=t.slice(1).trim();t.length;){const i=Hd(t);if(e.push(i.nodes[0]),","===(t=i.remainingInput.trim())[0])t=t.slice(1).trim();else if(")"===t[0]){t=t.slice(1);break}}return{nodes:e,remainingInput:t}},jd=Symbol("visitedTypes");class Yd{constructor(t){this[jd]=t}walk(t,e){const i=t.slice();for(;i.length;){const t=i.shift();switch(this[jd].indexOf(t.type)>-1&&e(t),t.type){case"expression":i.unshift(...t.terms);break;case"function":i.unshift(t.name,...t.arguments)}}}}const Jd=Object.freeze({type:"number",number:0,unit:null}),Xd=(t,e=0)=>{let{number:i,unit:n}=t;if(isFinite(i)){if("rad"===t.unit||null==t.unit)return t}else i=e,n="rad";return{type:"number",number:("deg"===n&&null!=i?i:0)*Math.PI/180,unit:"rad"}},Kd=(t,e=0)=>{let i,{number:n,unit:r}=t;if(isFinite(n)){if("m"===t.unit)return t}else n=e,r="m";switch(r){default:i=1;break;case"cm":i=.01;break;case"mm":i=.001}return{type:"number",number:i*n,unit:"m"}},$d=(()=>{const t=t=>t,e={rad:t,deg:Xd,m:t,mm:Kd,cm:Kd};return(t,i=Jd)=>{isFinite(t.number)||(t.number=i.number,t.unit=i.unit);const{unit:n}=t;if(null==n)return t;const r=e[n];return null==r?i:r(t)}})();
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var Zd,tA,eA;const iA=Symbol("evaluate"),nA=Symbol("lastValue");class rA{constructor(){this[Zd]=null}static evaluatableFor(t,e=Jd){if(t instanceof rA)return t;if("number"===t.type)return"%"===t.unit?new oA(t,e):t;switch(t.name.value){case"calc":return new dA(t,e);case"env":return new hA(t)}return Jd}static evaluate(t){return t instanceof rA?t.evaluate():t}static isConstant(t){return!(t instanceof rA)||t.isConstant}static applyIntrinsics(t,e){const{basis:i,keywords:n}=e,{auto:r}=n;return i.map(((e,i)=>{const s=null==r[i]?e:r[i];let a=t[i]?t[i]:s;if("ident"===a.type){const t=a.value;t in n&&(a=n[t][i])}return null!=a&&"ident"!==a.type||(a=s),"%"===a.unit?Od(a.number/100*e.number,e.unit):(a=$d(a,e),a.unit!==e.unit?e:a)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[nA]||(this[nA]=this[iA]()),this[nA]}}Zd=nA;const sA=Symbol("percentage"),aA=Symbol("basis");class oA extends rA{constructor(t,e){super(),this[sA]=t,this[aA]=e}get isConstant(){return!0}[iA](){return Od(this[sA].number/100*this[aA].number,this[aA].unit)}}const lA=Symbol("identNode");class hA extends rA{constructor(t){super(),this[tA]=null;const e=t.arguments.length?t.arguments[0].terms[0]:null;null!=e&&"ident"===e.type&&(this[lA]=e)}get isConstant(){return!1}[(tA=lA,iA)](){if(null!=this[lA]&&"window-scroll-y"===this[lA].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Jd}}const cA=/[\*\/]/,uA=Symbol("evaluator");class dA extends rA{constructor(t,e=Jd){if(super(),this[eA]=null,1!==t.arguments.length)return;const i=t.arguments[0].terms.slice(),n=[];for(;i.length;){const t=i.shift();if(n.length>0){const i=n[n.length-1];if("operator"===i.type&&cA.test(i.value)){const i=n.pop(),r=n.pop();if(null==r)return;n.push(new gA(i,rA.evaluatableFor(r,e),rA.evaluatableFor(t,e)));continue}}n.push("operator"===t.type?t:rA.evaluatableFor(t,e))}for(;n.length>2;){const[t,i,r]=n.splice(0,3);if("operator"!==i.type)return;n.unshift(new gA(i,rA.evaluatableFor(t,e),rA.evaluatableFor(r,e)))}1===n.length&&(this[uA]=n[0])}get isConstant(){return null==this[uA]||rA.isConstant(this[uA])}[(eA=uA,iA)](){return null!=this[uA]?rA.evaluate(this[uA]):Jd}}const AA=Symbol("operator"),pA=Symbol("left"),mA=Symbol("right");class gA extends rA{constructor(t,e,i){super(),this[AA]=t,this[pA]=e,this[mA]=i}get isConstant(){return rA.isConstant(this[pA])&&rA.isConstant(this[mA])}[iA](){const t=$d(rA.evaluate(this[pA])),e=$d(rA.evaluate(this[mA])),{number:i,unit:n}=t,{number:r,unit:s}=e;if(null!=s&&null!=n&&s!=n)return Jd;const a=n||s;let o;switch(this[AA].value){case"+":o=i+r;break;case"-":o=i-r;break;case"/":o=i/r;break;case"*":o=i*r;break;default:return Jd}return{type:"number",number:o,unit:a}}}const fA=Symbol("evaluatables"),vA=Symbol("intrinsics");class yA extends rA{constructor(t,e){super(),this[vA]=e;const i=t[0],n=null!=i?i.terms:[];this[fA]=e.basis.map(((t,e)=>{const i=n[e];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:rA.evaluatableFor(i,t)}))}get isConstant(){for(const t of this[fA])if(!rA.isConstant(t))return!1;return!0}[iA](){const t=this[fA].map((t=>rA.evaluate(t)));return rA.applyIntrinsics(t,this[vA]).map((t=>t.number))}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var xA,_A,EA,wA;const CA=Symbol("instances"),IA=Symbol("activateListener"),bA=Symbol("deactivateListener"),SA=Symbol("notifyInstances"),MA=Symbol("notify"),BA=Symbol("callback");class TA{constructor(t){this[BA]=t}static[SA](){for(const t of TA[CA])t[MA]()}static[(xA=CA,IA)](){window.addEventListener("scroll",this[SA],{passive:!0})}static[bA](){window.removeEventListener("scroll",this[SA])}observe(){0===TA[CA].size&&TA[IA](),TA[CA].add(this)}disconnect(){TA[CA].delete(this),0===TA[CA].size&&TA[bA]()}[MA](){this[BA]()}}TA[xA]=new Set;const RA=Symbol("computeStyleCallback"),LA=Symbol("astWalker"),DA=Symbol("dependencies"),QA=Symbol("onScroll");class PA{constructor(t){this[_A]={},this[EA]=new Yd(["function"]),this[wA]=()=>{this[RA]({relatedState:"window-scroll"})},this[RA]=t}observeEffectsFor(t){const e={},i=this[DA];this[LA].walk(t,(t=>{const{name:n}=t,r=t.arguments[0].terms[0];if("env"===n.value&&null!=r&&"ident"===r.type&&"window-scroll-y"===r.value)if(null==e["window-scroll"]){const t="window-scroll"in i?i["window-scroll"]:new TA(this[QA]);t.observe(),delete i["window-scroll"],e["window-scroll"]=t}}));for(const t in i){i[t].disconnect()}this[DA]=e}dispose(){for(const t in this[DA]){this[DA][t].disconnect()}}}_A=DA,EA=LA,wA=QA;
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const UA=t=>{const e=t.observeEffects||!1,i=t.intrinsics instanceof Function?t.intrinsics:()=>t.intrinsics;return(n,r)=>{const s=n.updated,a=n.connectedCallback,o=n.disconnectedCallback,l=Symbol(`${r}StyleEffector`),h=Symbol(`${r}StyleEvaluator`),c=Symbol(`${r}UpdateEvaluator`),u=Symbol(`${r}EvaluateAndSync`);Object.defineProperties(n,{[l]:{value:null,writable:!0},[h]:{value:null,writable:!0},[c]:{value:function(){const t=Gd(this[r]);this[h]=new yA(t,i(this)),null==this[l]&&e&&(this[l]=new PA((()=>this[u]()))),null!=this[l]&&this[l].observeEffectsFor(t)}},[u]:{value:function(){if(null==this[h])return;const e=this[h].evaluate();this[t.updateHandler](e)}},updated:{value:function(t){t.has(r)&&(this[c](),this[u]()),s.call(this,t)}},connectedCallback:{value:function(){a.call(this),this.requestUpdate(r,this[r])}},disconnectedCallback:{value:function(){o.call(this),null!=this[l]&&(this[l].dispose(),this[l]=null)}}})}},NA=t=>t<.5?2*t*t:(4-2*t)*t-1,FA=(t,e,i=NA)=>n=>t+(e-t)*i(n),kA=t=>{const e=[],i=[];let n=t.initialValue;for(let r=0;r<t.keyframes.length;++r){const s=t.keyframes[r],{value:a,frames:o}=s,l=s.ease||NA,h=FA(n,a,l);e.push(h),i.push(o),n=a}return((t,e)=>{const i=e.map((n=0,t=>n+=t));var n;return e=>{e=Ph(e,0,1),e*=i[i.length-1];const n=i.findIndex((t=>t>=e)),r=n<1?0:i[n-1],s=i[n];return t[n]((e-r)/(s-r))}})(e,i)};
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var OA=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const GA=kA({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),HA=kA({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),zA="0deg 75deg 105%",VA=["front","right","back","left"],WA=["upper-","","lower-"],qA="auto",jA="basic",YA="wiggle",JA="none",XA=()=>({basis:[Xd(Od(30,"deg"))],keywords:{auto:[null]}}),KA=()=>({basis:[Xd(Od(12,"deg"))],keywords:{auto:[null]}}),$A=(()=>{const t=Gd(zA)[0].terms,e=$d(t[0]),i=$d(t[1]);return t=>{const n=t[av].idealCameraDistance();return{basis:[e,i,Od(n,"m")],keywords:{auto:[null,null,Od(105,"%")]}}}})(),ZA=t=>{const e=2.2*t[av].boundingSphere.radius;return{basis:[Od(-1/0,"rad"),Od(Math.PI/8,"rad"),Od(e,"m")],keywords:{auto:[null,null,null]}}},tp=t=>{const e=$A(t),i=new yA([],e).evaluate()[2];return{basis:[Od(1/0,"rad"),Od(Math.PI-Math.PI/8,"rad"),Od(i,"m")],keywords:{auto:[null,null,null]}}},ep=t=>{const e=t[av].boundingBox.getCenter(new ae);return{basis:[Od(e.x,"m"),Od(e.y,"m"),Od(e.z,"m")],keywords:{auto:[null,null,null]}}},ip=Math.PI/2,np=Math.PI/3,rp=ip/2,sp=2*Math.PI,ap=Symbol("controls"),op=Symbol("panElement"),lp=Symbol("promptElement"),hp=Symbol("promptAnimatedContainer"),cp=Symbol("fingerAnimatedContainers"),up=Symbol("deferInteractionPrompt"),dp=Symbol("updateAria"),Ap=Symbol("updateCameraForRadius"),pp=Symbol("cancelPrompts"),mp=Symbol("onChange"),gp=Symbol("onPointerChange"),fp=Symbol("waitingToPromptUser"),vp=Symbol("userHasInteracted"),yp=Symbol("promptElementVisibleTime"),xp=Symbol("lastPromptOffset"),_p=Symbol("cancellationSource"),Ep=Symbol("lastSpherical"),wp=Symbol("jumpCamera"),Cp=Symbol("initialized"),Ip=Symbol("maintainThetaPhi"),bp=Symbol("syncCameraOrbit"),Sp=Symbol("syncFieldOfView"),Mp=Symbol("syncCameraTarget"),Bp=Symbol("syncMinCameraOrbit"),Tp=Symbol("syncMaxCameraOrbit"),Rp=Symbol("syncMinFieldOfView"),Lp=Symbol("syncMaxFieldOfView"),Dp=new Nt,Qp=new ae,Pp=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Up=Math.PI/8,Np=.04,Fp={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class kp extends Et{constructor(t,e,i){super(),this.camera=t,this.element=e,this.scene=i,this.orbitSensitivity=1,this.inputSensitivity=1,this.changeSource=Fp.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Ft,this.panPerPixel=0,this.spherical=new ml,this.goalSpherical=new ml,this.thetaDamper=new Qd,this.phiDamper=new Qd,this.radiusDamper=new Qd,this.logFov=Math.log(Pp.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Qd,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=t=>{if(this.enablePan)t.preventDefault();else for(const t of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:t.id})))},this.touchModeZoom=(t,e)=>{if(!this._disableZoom){const t=this.twoTouchDistance(this.pointers[0],this.pointers[1]),e=Np*(this.lastSeparation-t)*50/this.scene.height;this.lastSeparation=t,this.userAdjustOrbit(0,0,e)}this.panPerPixel>0&&this.movePan(t,e)},this.disableScroll=t=>{t.preventDefault()},this.touchModeRotate=(t,e)=>{const{touchAction:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;const n=Math.abs(t),r=Math.abs(e);if(this.changeSource===Fp.USER_INTERACTION&&("pan-y"===i&&r>n||"pan-x"===i&&n>r))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(t,e)},this.onPointerDown=t=>{if(this.pointers.length>2)return;const{element:e}=this;0===this.pointers.length&&(e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=t.clientX,this.startPointerPosition.clientY=t.clientY,this.startTime=performance.now());try{e.setPointerCapture(t.pointerId)}catch(t){}this.pointers.push({clientX:t.clientX,clientY:t.clientY,id:t.pointerId}),this.isUserPointing=!1,"touch"===t.pointerType?(this.changeSource=t.altKey?Fp.AUTOMATIC:Fp.USER_INTERACTION,this.onTouchChange(t)):(this.changeSource=Fp.USER_INTERACTION,this.onMouseDown(t)),this.changeSource===Fp.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=t=>{const e=this.pointers.find((e=>e.id===t.pointerId));if(null==e)return;if("mouse"===t.pointerType&&0===t.buttons)return void this.onPointerUp(t);const i=this.pointers.length,n=(t.clientX-e.clientX)/i,r=(t.clientY-e.clientY)/i;0===n&&0===r||(e.clientX=t.clientX,e.clientY=t.clientY,"touch"===t.pointerType?(this.changeSource=t.altKey?Fp.AUTOMATIC:Fp.USER_INTERACTION,null!==this.touchMode&&this.touchMode(n,r)):(this.changeSource=Fp.USER_INTERACTION,this.panPerPixel>0?this.movePan(n,r):this.handleSinglePointerMove(n,r)))},this.onPointerUp=t=>{const{element:e}=this,i=this.pointers.findIndex((e=>e.id===t.pointerId));-1!==i&&this.pointers.splice(i,1),this.panPerPixel>0&&!t.altKey&&this.resetRadius(),0===this.pointers.length?(e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(t)):null!==this.touchMode&&this.onTouchChange(t),this.scene.element[op].style.opacity=0,e.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=t=>{this.changeSource=Fp.USER_INTERACTION;const e=t.deltaY*(1==t.deltaMode?18:1)*Np/30;this.userAdjustOrbit(0,0,e),t.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=t=>{const{changeSource:e}=this;this.changeSource=Fp.USER_INTERACTION;(t.shiftKey&&this.enablePan?this.panKeyCodeHandler(t):this.orbitZoomKeyCodeHandler(t))?(t.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=e},this._options=Object.assign({},Pp),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:t}=this;t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||t.addEventListener("wheel",this.onWheel),t.addEventListener("keydown",this.onKeyDown),t.addEventListener("touchmove",(()=>{}),{passive:!1}),t.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:t}=this;t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("pointercancel",this.onPointerUp),t.removeEventListener("wheel",this.onWheel),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("contextmenu",this.onContext),t.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(t){this._disableZoom!=t&&(this._disableZoom=t,!0===t?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(t=new ml){return t.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(t){Object.assign(this._options,t),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(t,e){this.camera.far=0===e?2:e,this.camera.near=Math.max(t,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(t){this.camera.aspect=t,this.camera.updateProjectionMatrix()}setOrbit(t=this.goalSpherical.theta,e=this.goalSpherical.phi,i=this.goalSpherical.radius){const{minimumAzimuthalAngle:n,maximumAzimuthalAngle:r,minimumPolarAngle:s,maximumPolarAngle:a,minimumRadius:o,maximumRadius:l}=this._options,{theta:h,phi:c,radius:u}=this.goalSpherical,d=Ph(t,n,r);isFinite(n)||isFinite(r)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-d)+d);const A=Ph(e,s,a),p=Ph(i,o,l);return(d!==h||A!==c||p!==u)&&(!!(isFinite(d)&&isFinite(A)&&isFinite(p))&&(this.goalSpherical.theta=d,this.goalSpherical.phi=A,this.goalSpherical.radius=p,this.goalSpherical.makeSafe(),!0))}setRadius(t){this.goalSpherical.radius=t,this.setOrbit()}setFieldOfView(t){const{minimumFieldOfView:e,maximumFieldOfView:i}=this._options;t=Ph(t,e,i),this.goalLogFov=Math.log(t)}setDamperDecayTime(t){this.thetaDamper.setDecayTime(t),this.phiDamper.setDecayTime(t),this.radiusDamper.setDecayTime(t),this.fovDamper.setDecayTime(t)}adjustOrbit(t,e,i){const{theta:n,phi:r,radius:s}=this.goalSpherical,{minimumRadius:a,maximumRadius:o,minimumFieldOfView:l,maximumFieldOfView:h}=this._options,c=this.spherical.theta-n,u=Math.PI-.001,d=n-Ph(t,-u-c,u-c),A=r-e,p=0===i?0:((i>0?o:a)-s)/(Math.log(i>0?h:l)-this.goalLogFov),m=s+i*(isFinite(p)?p:2*(o-a));if(this.setOrbit(d,A,m),0!==i){const t=this.goalLogFov+i;this.setFieldOfView(Math.exp(t))}}jumpToGoal(){this.update(0,1e4)}update(t,e){if(this.isStationary())return!1;const{maximumPolarAngle:i,maximumRadius:n}=this._options,r=this.spherical.theta-this.goalSpherical.theta;return Math.abs(r)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(r)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,e,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,e,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,e,n),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,e,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:t}=this.element;if(this._interactionEnabled){const{touchAction:e}=this._options;this._disableZoom&&"none"!==e?t.touchAction="manipulation":t.touchAction=e}else t.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new qe(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(t,e,i){this.adjustOrbit(t*this.orbitSensitivity*this.inputSensitivity,e*this.orbitSensitivity*this.inputSensitivity,i*this.inputSensitivity)}wrapAngle(t){const e=(t+Math.PI)/(2*Math.PI);return 2*(e-Math.floor(e))*Math.PI-Math.PI}pixelLengthToSphericalAngle(t){return 2*Math.PI*t/this.scene.height}twoTouchDistance(t,e){const{clientX:i,clientY:n}=t,{clientX:r,clientY:s}=e,a=r-i,o=s-n;return Math.sqrt(a*a+o*o)}handleSinglePointerMove(t,e){const i=this.pixelLengthToSphericalAngle(t),n=this.pixelLengthToSphericalAngle(e);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(i,n,0)}initializePan(){const{theta:t,phi:e}=this.spherical,i=t-this.scene.yaw;this.panPerPixel=.018/this.scene.height,this.panProjection.set(-Math.cos(i),-Math.cos(e)*Math.sin(i),0,0,Math.sin(e),0,Math.sin(i),-Math.cos(e)*Math.cos(i),0)}movePan(t,e){const{scene:i}=this,n=Qp.set(t,e,0).multiplyScalar(this.inputSensitivity),r=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;n.multiplyScalar(r);const s=i.getTarget();s.add(n.applyMatrix3(this.panProjection)),i.boundingSphere.clampPoint(s,s),i.setTarget(s.x,s.y,s.z)}recenter(t){if(performance.now()>this.startTime+300||Math.abs(t.clientX-this.startPointerPosition.clientX)>2||Math.abs(t.clientY-this.startPointerPosition.clientY)>2)return;const{scene:e}=this,i=e.positionAndNormalFromPoint(e.getNDC(t.clientX,t.clientY));if(null==i){const{cameraTarget:t}=e.element;e.element.cameraTarget="",e.element.cameraTarget=t,this.userAdjustOrbit(0,0,1)}else e.target.worldToLocal(i.position),e.setTarget(i.position.x,i.position.y,i.position.z)}resetRadius(){const{scene:t}=this,e=t.positionAndNormalFromPoint(Dp.set(0,0));if(null==e)return;t.target.worldToLocal(e.position);const i=t.getTarget(),{theta:n,phi:r}=this.spherical,s=n-t.yaw,a=Qp.set(Math.sin(r)*Math.sin(s),Math.cos(r),Math.sin(r)*Math.cos(s)),o=a.dot(e.position.sub(i));i.add(a.multiplyScalar(o)),t.setTarget(i.x,i.y,i.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-o)}onTouchChange(t){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),t.altKey||(this.scene.element[op].style.opacity=1))}}onMouseDown(t){this.panPerPixel=0,this.enablePan&&(2===t.button||t.ctrlKey||t.metaKey||t.shiftKey)&&(this.initializePan(),this.scene.element[op].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(t){let e=!0;switch(t.key){case"PageUp":this.userAdjustOrbit(0,0,Np);break;case"PageDown":this.userAdjustOrbit(0,0,-.04);break;case"ArrowUp":this.userAdjustOrbit(0,-Up,0);break;case"ArrowDown":this.userAdjustOrbit(0,Up,0);break;case"ArrowLeft":this.userAdjustOrbit(-Up,0,0);break;case"ArrowRight":this.userAdjustOrbit(Up,0,0);break;default:e=!1}return e}panKeyCodeHandler(t){this.initializePan();let e=!0;switch(t.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:e=!1}return e}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Op="not-presenting",Gp="session-started",Hp="object-placed",zp="failed",Vp="tracking",Wp="not-tracking",qp=new ae,jp=new Ue,Yp=new ae,Jp=new yn(45,1,.1,100);class Xp extends Et{constructor(t){super(),this.renderer=t,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new ae,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new ae,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new ae,this.goalYaw=0,this.goalScale=1,this.xDamper=new Qd,this.yDamper=new Qd,this.zDamper=new Qd,this.yawDamper=new Qd,this.scaleDamper=new Qd,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new kd(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=t=>{const e=this.transientHitTestSource;if(null==e)return;const i=this.frame.getHitTestResultsForTransientInput(e),n=this.presentedScene,r=this.placementBox;if(1===i.length){this.inputSource=t.inputSource;const{axes:e}=this.inputSource.gamepad,i=r.getHit(this.presentedScene,e[0],e[1]);r.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*e[0])}else if(2===i.length){r.show=!0,this.isTwoFingering=!0;const{separation:t}=this.fingerPolar(i);this.firstRatio=t/n.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=t.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){Lh();const t=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(t),this.threeRenderer.xr.cameraAutoUpdate=!1,t}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return Lh(),await navigator.xr.isSessionSupported("immersive-ar")}catch(t){return console.warn("Request to present in WebXR denied:"),console.warn(t),console.warn("Falling back to next ar-mode"),!1}}async present(t,e=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise(((t,e)=>{requestAnimationFrame((()=>t()))}));t.setHotspotsVisibility(!1),t.queueRender(),await i,this._presentedScene=t,this.overlay=t.element.shadowRoot.querySelector("div.default"),!0===e&&(this.xrLight=new Dd(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const t=this.presentedScene;t.add(this.xrLight),t.environment=this.xrLight.environment})));const n=await this.resolveARSession();n.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const r=t.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");r.classList.add("enabled"),r.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=r;const s=await n.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=t.yaw,this.goalYaw=t.yaw,this.goalScale=1,t.background=null,this.oldShadowIntensity=t.shadowIntensity,t.setShadowIntensity(.01),this.oldTarget.copy(t.getTarget()),t.element.addEventListener("load",this.onUpdateScene);const a=20*Math.PI/180,o=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(a),z:-Math.cos(a)});n.requestHitTestSource({space:s,offsetRay:o}).then((t=>{this.initialHitSource=t})),this.currentSession=n,this.placementBox=new kd(t,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Gp})}async stopPresenting(){if(!this.isPresenting)return;const t=new Promise((t=>{this.resolveCleanup=t}));try{await this.currentSession.end(),await t}catch(t){console.warn("Error while trying to end WebXR AR session"),console.warn(t),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const t=this.presentedScene;if(null!=t){const e=t.getTarget();this.oldTarget.copy(e),this.placeOnWall?e.z=t.boundingBox.min.z:e.y=t.boundingBox.min.y,t.setTarget(e.x,e.y,e.z)}}postSessionCleanup(){const t=this.currentSession;null!=t&&(t.removeEventListener("selectstart",this.onSelectStart),t.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const e=this.presentedScene;if(this._presentedScene=null,null!=e){const{element:t}=e;null!=this.xrLight&&(e.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),e.position.set(0,0,0),e.scale.set(1,1,1),e.setShadowOffset(0);const i=this.turntableRotation;null!=i&&(e.yaw=i);const n=this.oldShadowIntensity;null!=n&&e.setShadowIntensity(n),e.setEnvironmentAndSkybox(t[kh],t[Oh]);const r=this.oldTarget;e.setTarget(r.x,r.y,r.z),e.xrCamera=null,e.element.removeEventListener("load",this.onUpdateScene),e.orientHotspots(0),t.requestUpdate("cameraTarget"),t.requestUpdate("maxCameraOrbit"),t[cv](t.getBoundingClientRect()),requestAnimationFrame((()=>{e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Fp.NONE}}))}))}this.renderer.height=0;const i=this.exitWebXRButtonContainer;null!=i&&(i.classList.remove("enabled"),i.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const n=this.transientHitTestSource;null!=n&&(n.cancel(),this.transientHitTestSource=null);const r=this.initialHitSource;null!=r&&(r.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:Op})}updateView(t){const e=this.presentedScene,i=this.threeRenderer.xr;i.updateCamera(Jp),e.xrCamera=i.getCamera();const{elements:n}=e.getCamera().matrixWorld;if(e.orientHotspots(Math.atan2(n[1],n[5])),this.initialized||(this.placeInitially(),this.initialized=!0),t.requestViewportScale&&t.recommendedViewportScale){const e=t.recommendedViewportScale;t.requestViewportScale(Math.max(e,.25))}const r=i.getBaseLayer();if(null!=r){const e=r instanceof XRWebGLLayer?r.getViewport(t):i.getBinding().getViewSubImage(r,t).viewport;this.threeRenderer.setViewport(e.x,e.y,e.width,e.height)}}placeInitially(){const t=this.presentedScene,{position:e,element:i}=t,n=t.getCamera(),{width:r,height:s}=this.overlay.getBoundingClientRect();t.setSize(r,s),n.projectionMatrixInverse.copy(n.projectionMatrix).invert();const{theta:a,radius:o}=i.getCameraOrbit(),l=n.getWorldDirection(qp);t.yaw=Math.atan2(-l.x,-l.z)-a,this.goalYaw=t.yaw,e.copy(n.position).add(l.multiplyScalar(o)),this.updateTarget();const h=t.getTarget();e.add(h).sub(this.oldTarget),this.goalPosition.copy(e),t.setHotspotsVisibility(!0);const{session:c}=this.frame;c.addEventListener("selectstart",this.onSelectStart),c.addEventListener("selectend",this.onSelectEnd),c.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((t=>{this.transientHitTestSource=t}))}getTouchLocation(){const{axes:t}=this.inputSource.gamepad;let e=this.placementBox.getExpandedHit(this.presentedScene,t[0],t[1]);return null!=e&&(qp.copy(e).sub(this.presentedScene.getCamera().position),qp.length()>10)?null:e}getHitPoint(t){const e=this.threeRenderer.xr.getReferenceSpace(),i=t.getPose(e);if(null==i)return null;const n=jp.fromArray(i.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(n.elements[4],n.elements[6])),n.elements[5]>.75!==this.placeOnWall?Yp.setFromMatrixPosition(n):null}moveToFloor(t){const e=this.initialHitSource;if(null==e)return;const i=t.getHitTestResults(e);if(0==i.length)return;const n=i[0],r=this.getHitPoint(n);null!=r&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(r):this.goalPosition.y=r.y),e.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Hp}))}fingerPolar(t){const e=t[0].inputSource.gamepad.axes,i=t[1].inputSource.gamepad.axes,n=i[0]-e[0],r=i[1]-e[1],s=Math.atan2(r,n);let a=this.lastAngle-s;return a>Math.PI?a-=2*Math.PI:a<-Math.PI&&(a+=2*Math.PI),this.lastAngle=s,{separation:Math.sqrt(n*n+r*r),deltaYaw:a}}processInput(t){const e=this.transientHitTestSource;if(null==e)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const i=t.getHitTestResultsForTransientInput(e),n=this.presentedScene,r=n.scale.x;if(this.isTwoFingering)if(i.length<2)this.isTwoFingering=!1;else{const{separation:t,deltaYaw:e}=this.fingerPolar(i);if(!1===this.placeOnWall&&(this.goalYaw+=e),n.canScale){const e=t/this.firstRatio;this.goalScale=e<1.3&&e>.7692307692307692?1:e}}else if(2!==i.length)if(this.isRotating){const t=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=t-this.lastAngle,this.lastAngle=t}else this.isTranslating&&i.forEach((t=>{if(t.inputSource!==this.inputSource)return;let e=null;if(t.results.length>0&&(e=this.getHitPoint(t.results[0])),null==e&&(e=this.getTouchLocation()),null!=e){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const t=e.y-this.lastDragPosition.y;if(t<0){this.placementBox.offsetHeight=t/r,this.presentedScene.setShadowOffset(t);const i=qp.copy(n.getCamera().position),s=-t/(i.y-e.y);i.multiplyScalar(s),e.multiplyScalar(1-s).add(i)}}this.goalPosition.add(e),this.lastDragPosition.copy(e)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:t}=this.fingerPolar(i);this.firstRatio=t/r}}moveScene(t){const e=this.presentedScene,{position:i,yaw:n}=e,r=e.boundingSphere.radius,s=this.goalPosition,a=e.scale.x,o=this.placementBox;let l=Fp.NONE;if(!s.equals(i)||this.goalScale!==a){l=Fp.USER_INTERACTION;let{x:n,y:h,z:c}=i;n=this.xDamper.update(n,s.x,t,r),h=this.yDamper.update(h,s.y,t,r),c=this.zDamper.update(c,s.z,t,r),i.set(n,h,c);const u=this.scaleDamper.update(a,this.goalScale,t,1);if(e.scale.set(u,u,u),!this.isTranslating){const t=s.y-h;this.placementComplete&&!1===this.placeOnWall?(o.offsetHeight=t/u,e.setShadowOffset(t)):0===t&&(this.placementComplete=!0,o.show=!1,e.setShadowIntensity(.8))}}o.updateOpacity(t),e.updateTarget(t),e.yaw=this.yawDamper.update(n,this.goalYaw,t,Math.PI),e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:l}}))}onWebXRFrame(t,e){this.frame=e,++this.frames;const i=this.threeRenderer.xr.getReferenceSpace(),n=e.getViewerPose(i);null==n&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Wp}));const r=this.presentedScene;if(null==n||null==r||!r.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Vp}));let s=!0;for(const i of n.views){if(this.updateView(i),s){this.moveToFloor(e),this.processInput(e);const i=t-this.lastTick;this.moveScene(i),this.renderer.preRender(r,t,i),this.lastTick=t,r.renderShadow(this.threeRenderer)}this.threeRenderer.render(r,r.getCamera()),s=!1}}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Kp{constructor(t){t.threeRenderer.debug={checkShaderErrors:!0},Promise.resolve().then((()=>{self.dispatchEvent(new CustomEvent("model-viewer-renderer-debug",{detail:{renderer:t,THREE:{ShaderMaterial:fn,Texture:te,Mesh:cn,Scene:da,PlaneGeometry:Dn,OrthographicCamera:Vn,WebGLRenderTarget:ie}}}))}))}addScene(t){self.dispatchEvent(new CustomEvent("model-viewer-scene-added-debug",{detail:{scene:t}}))}removeScene(t){self.dispatchEvent(new CustomEvent("model-viewer-scene-removed-debug",{detail:{scene:t}}))}}function $p(t){const e=new Map,i=new Map,n=t.clone();return Zp(t,n,(function(t,n){e.set(n,t),i.set(t,n)})),n.traverse((function(t){if(!t.isSkinnedMesh)return;const n=t,r=e.get(t),s=r.skeleton.bones;n.skeleton=r.skeleton.clone(),n.bindMatrix.copy(r.bindMatrix),n.skeleton.bones=s.map((function(t){return i.get(t)})),n.bind(n.skeleton,n.bindMatrix)})),n}function Zp(t,e,i){i(t,e);for(let n=0;n<t.children.length;n++)Zp(t.children[n],e.children[n],i)}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const tm=Symbol("prepared"),em=Symbol("prepare"),im=Symbol("preparedGLTF"),nm=Symbol("clone");class rm{constructor(t){this[im]=t}static prepare(t){if(null==t.scene)throw new Error("Model does not have a scene");if(t[tm])return t;const e=this[em](t);return e[tm]=!0,e}static[em](t){const{scene:e}=t,i=[e];return Object.assign(Object.assign({},t),{scene:e,scenes:i})}get parser(){return this[im].parser}get animations(){return this[im].animations}get scene(){return this[im].scene}get scenes(){return this[im].scenes}get cameras(){return this[im].cameras}get asset(){return this[im].asset}get userData(){return this[im].userData}clone(){return new(0,this.constructor)(this[nm]())}dispose(){this.scenes.forEach((t=>{t.traverse((t=>{const e=t;if(!e.material)return;(Array.isArray(e.material)?e.material:[e.material]).forEach((t=>{for(const e in t){const i=t[e];if(i instanceof te){const t=i.source.data;null!=t.close&&t.close(),i.dispose()}}t.dispose()})),e.geometry.dispose()}))}))}[nm](){const t=this[im],e=$p(this.scene);sm(e,this.scene);const i=[e],n=t.userData?Object.assign({},t.userData):{};return Object.assign(Object.assign({},t),{scene:e,scenes:i,userData:n})}}const sm=(t,e)=>{am(t,e,((t,e)=>{void 0!==e.userData.variantMaterials&&(t.userData.variantMaterials=new Map(e.userData.variantMaterials)),void 0!==e.userData.variantData&&(t.userData.variantData=e.userData.variantData),void 0!==e.userData.originalMaterial&&(t.userData.originalMaterial=e.userData.originalMaterial)}))},am=(t,e,i)=>{i(t,e);for(let n=0;n<t.children.length;n++)am(t.children[n],e.children[n],i)},om=Symbol("threeGLTF"),lm=Symbol("gltf"),hm=Symbol("gltfElementMap"),cm=Symbol("threeObjectMap"),um=Symbol("parallelTraverseThreeScene"),dm=Symbol("correlateOriginalThreeGLTF"),Am=Symbol("correlateCloneThreeGLTF");class pm{constructor(t,e,i,n){this[om]=t,this[lm]=e,this[hm]=n,this[cm]=i}static from(t,e){return null!=e?this[Am](t,e):this[dm](t)}static[dm](t){const e=t.parser.json,i=t.parser.associations,n=new Map,r={name:"Default"},s={type:"materials",index:-1};for(const t of i.keys())t instanceof _i&&null==i.get(t)&&(s.index<0&&(null==e.materials&&(e.materials=[]),s.index=e.materials.length,e.materials.push(r)),t.name=r.name,i.set(t,{materials:s.index}));for(const[t,r]of i){if(r){const e=t;e.userData=e.userData||{},e.userData.associations=r}for(const i in r)if(null!=i&&"primitives"!==i){const s=i,a=(e[s]||[])[r[s]];if(null==a)continue;let o=n.get(a);null==o&&(o=new Set,n.set(a,o)),o.add(t)}}return new pm(t,e,i,n)}static[Am](t,e){const i=e.threeGLTF,n=e.gltf,r=JSON.parse(JSON.stringify(n)),s=new Map,a=new Map;for(let n=0;n<i.scenes.length;n++)this[um](i.scenes[n],t.scenes[n],((t,i)=>{const n=e.threeObjectMap.get(t);if(null!=n)for(const t in n)if(null!=t&&"primitives"!==t){const e=t,o=n[e],l=r[e][o],h=s.get(i)||{};h[e]=o,s.set(i,h);const c=a.get(l)||new Set;c.add(i),a.set(l,c)}}));return new pm(t,r,s,a)}static[um](t,e,i){const n=(t,e)=>{if(i(t,e),t.isObject3D){const r=t,s=e;if(r.material)if(Array.isArray(r.material))for(let t=0;t<r.material.length;++t)i(r.material[t],s.material[t]);else i(r.material,s.material);for(let i=0;i<t.children.length;++i)n(t.children[i],e.children[i])}};n(t,e)}get threeGLTF(){return this[om]}get gltf(){return this[lm]}get gltfElementMap(){return this[hm]}get threeObjectMap(){return this[cm]}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const mm=Symbol("correlatedSceneGraph");class gm extends rm{static[em](t){const e=super[em](t);null==e[mm]&&(e[mm]=pm.from(e));const{scene:i}=e,n=new Se(void 0,1/0);return i.traverse((t=>{t.renderOrder=1e3,t.frustumCulled=!1,t.name||(t.name=t.uuid);const i=t;if(i.material){const{geometry:t}=i;i.castShadow=!0,i.isSkinnedMesh&&(t.boundingSphere=n,t.boundingBox=null);const r=i.material;if(!0===r.isMeshBasicMaterial&&(r.toneMapped=!1),r.shadowSide=o,r.aoMap){const{gltf:i,threeObjectMap:n}=e[mm],s=n.get(r);if(null!=i.materials&&null!=s&&null!=s.materials){const e=i.materials[s.materials];e.occlusionTexture&&0===e.occlusionTexture.texCoord&&null!=t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv)}}}})),e}get correlatedSceneGraph(){return this[im][mm]}[nm](){const t=super[nm](),e=new Map;return t.scene.traverse((t=>{const i=t;if(i.material){const t=i.material;if(null!=t){if(e.has(t.uuid))return void(i.material=e.get(t.uuid));i.material=t.clone(),e.set(t.uuid,i.material)}}})),t[mm]=pm.from(t,this.correlatedSceneGraph),t}}class fm extends Uo{constructor(t){super(t),this.type=N}parse(t){const e=function(t,e){switch(t){case 1:console.error("THREE.RGBELoader Read Error: "+(e||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(e||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(e||""));break;default:console.error("THREE.RGBELoader: Error: "+(e||""))}return-1},i=function(t,e,i){e=e||1024;let n=t.pos,r=-1,s=0,a="",o=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));for(;0>(r=o.indexOf("\n"))&&s<e&&n<t.byteLength;)a+=o,s+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));return-1<r&&(!1!==i&&(t.pos+=s+r+1),a+o.slice(0,r))},n=function(t,e,i,n){const r=t[e+3],s=Math.pow(2,r-128)/255;i[n+0]=t[e+0]*s,i[n+1]=t[e+1]*s,i[n+2]=t[e+2]*s,i[n+3]=1},r=function(t,e,i,n){const r=t[e+3],s=Math.pow(2,r-128)/255;i[n+0]=Ri.toHalfFloat(Math.min(t[e+0]*s,65504)),i[n+1]=Ri.toHalfFloat(Math.min(t[e+1]*s,65504)),i[n+2]=Ri.toHalfFloat(Math.min(t[e+2]*s,65504)),i[n+3]=Ri.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;const a=function(t){const n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,a=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,h;if(t.pos>=t.byteLength||!(l=i(t)))return e(1,"no header found");if(!(h=l.match(/^#\?(\S+)/)))return e(3,"bad initial token");for(o.valid|=1,o.programtype=h[1],o.string+=l+"\n";l=i(t),!1!==l;)if(o.string+=l+"\n","#"!==l.charAt(0)){if((h=l.match(n))&&(o.gamma=parseFloat(h[1])),(h=l.match(r))&&(o.exposure=parseFloat(h[1])),(h=l.match(s))&&(o.valid|=2,o.format=h[1]),(h=l.match(a))&&(o.valid|=4,o.height=parseInt(h[1],10),o.width=parseInt(h[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=l+"\n";return 2&o.valid?4&o.valid?o:e(3,"missing image size specifier"):e(3,"missing format specifier")}(s);if(-1!==a){const t=a.width,i=a.height,o=function(t,i,n){const r=i;if(r<8||r>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);if(r!==(t[2]<<8|t[3]))return e(3,"wrong scanline width");const s=new Uint8Array(4*i*n);if(!s.length)return e(4,"unable to allocate buffer space");let a=0,o=0;const l=4*r,h=new Uint8Array(4),c=new Uint8Array(l);let u=n;for(;u>0&&o<t.byteLength;){if(o+4>t.byteLength)return e(1);if(h[0]=t[o++],h[1]=t[o++],h[2]=t[o++],h[3]=t[o++],2!=h[0]||2!=h[1]||(h[2]<<8|h[3])!=r)return e(3,"bad rgbe scanline format");let i,n=0;for(;n<l&&o<t.byteLength;){i=t[o++];const r=i>128;if(r&&(i-=128),0===i||n+i>l)return e(3,"bad scanline data");if(r){const e=t[o++];for(let t=0;t<i;t++)c[n++]=e}else c.set(t.subarray(o,o+i),n),n+=i,o+=i}const d=r;for(let t=0;t<d;t++){let e=0;s[a]=c[t+e],e+=r,s[a+1]=c[t+e],e+=r,s[a+2]=c[t+e],e+=r,s[a+3]=c[t+e],a+=4}u--}return s}(s.subarray(s.pos),t,i);if(-1!==o){let e,s,l;switch(this.type){case U:l=o.length/4;const t=new Float32Array(4*l);for(let e=0;e<l;e++)n(o,4*e,t,4*e);e=t,s=U;break;case N:l=o.length/4;const i=new Uint16Array(4*l);for(let t=0;t<l;t++)r(o,4*t,i,4*t);e=i,s=N;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:t,height:i,data:e,header:a.string,gamma:a.gamma,exposure:a.exposure,type:s}}}return null}setDataType(t){return this.type=t,this}load(t,e,i,n){return super.load(t,(function(t,i){switch(t.type){case U:case N:t.encoding=dt,t.minFilter=R,t.magFilter=R,t.generateMipmaps=!1,t.flipY=!0}e&&e(t,i)}),i,n)}}
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class vm extends da{constructor(){super(),this.position.y=-3.5;const t=new dn;t.deleteAttribute("uv");const e=new so({metalness:0,side:l}),i=new so({metalness:0}),n=new Jo(16777215,500,28,2);n.position.set(.418,16.199,.3),this.add(n);const r=new cn(t,e);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const s=new cn(t,i);s.position.set(-10.906,2.009,1.846),s.rotation.set(0,-.195,0),s.scale.set(2.328,7.905,4.651),this.add(s);const a=new cn(t,i);a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),this.add(a);const o=new cn(t,i);o.position.set(6.167,.857,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),this.add(o);const h=new cn(t,i);h.position.set(-2.017,.018,6.124),h.rotation.set(0,.333,0),h.scale.set(2.002,4.566,2.064),this.add(h);const c=new cn(t,i);c.position.set(2.291,-.756,-2.621),c.rotation.set(0,-.286,0),c.scale.set(1.546,1.552,1.496),this.add(c);const u=new cn(t,i);u.position.set(-2.193,-.369,-5.547),u.rotation.set(0,.516,0),u.scale.set(3.875,3.487,2.986),this.add(u);const d=new cn(t,this.createAreaLightMaterial(50));d.position.set(-16.116,14.37,8.208),d.scale.set(.1,2.428,2.739),this.add(d);const A=new cn(t,this.createAreaLightMaterial(50));A.position.set(-16.109,18.021,-8.207),A.scale.set(.1,2.425,2.751),this.add(A);const p=new cn(t,this.createAreaLightMaterial(17));p.position.set(14.904,12.198,-1.832),p.scale.set(.15,4.265,6.331),this.add(p);const m=new cn(t,this.createAreaLightMaterial(43));m.position.set(-.462,8.89,14.52),m.scale.set(4.38,5.441,.088),this.add(m);const g=new cn(t,this.createAreaLightMaterial(20));g.position.set(3.235,11.486,-12.541),g.scale.set(2.5,2,.1),this.add(g);const f=new cn(t,this.createAreaLightMaterial(100));f.position.set(0,20,0),f.scale.set(1,.1,1),this.add(f)}createAreaLightMaterial(t){const e=new Mi;return e.color.setScalar(t),e}}
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ym extends da{constructor(){super(),this.position.y=-3.5;const t=new dn;t.deleteAttribute("uv");const e=new so({metalness:0,side:l}),i=new so({metalness:0}),n=new Jo(16777215,400,28,2);n.position.set(.5,14,.5),this.add(n);const r=new cn(t,e);r.position.set(0,13.2,0),r.scale.set(31.5,28.5,31.5),this.add(r);const s=new cn(t,i);s.position.set(-10.906,-1,1.846),s.rotation.set(0,-.195,0),s.scale.set(2.328,7.905,4.651),this.add(s);const a=new cn(t,i);a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),this.add(a);const o=new cn(t,i);o.position.set(6.167,-.16,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),this.add(o);const h=new cn(t,i);h.position.set(-2.017,.018,6.124),h.rotation.set(0,.333,0),h.scale.set(2.002,4.566,2.064),this.add(h);const c=new cn(t,i);c.position.set(2.291,-.756,-2.621),c.rotation.set(0,-.286,0),c.scale.set(1.546,1.552,1.496),this.add(c);const u=new cn(t,i);u.position.set(-2.193,-.369,-5.547),u.rotation.set(0,.516,0),u.scale.set(3.875,3.487,2.986),this.add(u);const d=new cn(t,this.createAreaLightMaterial(80));d.position.set(-14,10,8),d.scale.set(.1,2.5,2.5),this.add(d);const A=new cn(t,this.createAreaLightMaterial(80));A.position.set(-14,14,-4),A.scale.set(.1,2.5,2.5),this.add(A);const p=new cn(t,this.createAreaLightMaterial(23));p.position.set(14,12,0),p.scale.set(.1,5,5),this.add(p);const m=new cn(t,this.createAreaLightMaterial(16));m.position.set(0,9,14),m.scale.set(5,5,.1),this.add(m);const g=new cn(t,this.createAreaLightMaterial(80));g.position.set(7,8,-14),g.scale.set(2.5,2.5,.1),this.add(g);const f=new cn(t,this.createAreaLightMaterial(80));f.position.set(-7,16,-14),f.scale.set(2.5,2.5,.1),this.add(f);const v=new cn(t,this.createAreaLightMaterial(1));v.position.set(0,20,0),v.scale.set(.1,.1,.1),this.add(v)}createAreaLightMaterial(t){const e=new Mi;return e.color.setScalar(t),e}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const xm=20,_m=/\.hdr(\.js)?$/;class Em extends Et{constructor(t){super(),this.threeRenderer=t,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new No),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new fm,this._hdrLoader.setDataType(N)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:t}=await import(this.lottieLoaderUrl);this._lottieLoader=new t}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(t){const e=await new Promise(((e,i)=>this.ldrLoader.load(t,e,(()=>{}),i)));return e.name=t,e.flipY=!1,e}async loadLottie(t,e){const i=await this.getLottieLoader();i.setQuality(e);const n=await new Promise(((e,n)=>i.load(t,e,(()=>{}),n)));return n.name=t,n}async loadEquirect(t,e=(()=>{})){try{const i=_m.test(t),n=i?this.hdrLoader:this.ldrLoader,r=await new Promise(((i,r)=>n.load(t,i,(t=>{e(t.loaded/t.total*.9)}),r)));return e(1),r.name=t,r.mapping=w,i||(r.encoding=At),r}finally{e&&e(1)}}async generateEnvironmentMapAndSkybox(t=null,e=null,i=(()=>{})){const n="legacy"!==e;"legacy"!==e&&"neutral"!==e||(e=null),e=Rh(e);let r,s=Promise.resolve(null);t&&(s=this.loadEquirectFromUrl(t,i)),r=e?this.loadEquirectFromUrl(e,i):t?this.loadEquirectFromUrl(t,i):n?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[a,o]=await Promise.all([r,s]);if(null==a)throw new Error("Failed to load environment map.");return{environmentMap:a,skybox:o}}async loadEquirectFromUrl(t,e){if(!this.skyboxCache.has(t)){const i=this.loadEquirect(t,e);this.skyboxCache.set(t,i)}return this.skyboxCache.get(t)}async GenerateEnvironmentMap(t,e){await((t=0)=>new Promise((e=>setTimeout(e,t))))();const i=this.threeRenderer,n=new wn(256,{generateMipmaps:!1,type:N,format:k,encoding:dt,depthBuffer:!0}),r=new _n(.1,100,n),s=r.renderTarget.texture;s.name=e;const a=i.outputEncoding,o=i.toneMapping;return i.toneMapping=m,i.outputEncoding=dt,r.update(i,t),this.blurCubemap(n,.04),i.toneMapping=o,i.outputEncoding=a,s}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new vm,"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new ym,"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(t,e){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(xm);const t=new dn,e=new cn(t,this.blurMaterial);this.blurScene=new da,this.blurScene.add(e)}const i=t.clone();this.halfblur(t,i,e,"latitudinal"),this.halfblur(i,t,e,"longitudinal")}halfblur(t,e,i,n){const r=t.width,s=isFinite(i)?Math.PI/(2*r):2*Math.PI/39,a=i/s,o=isFinite(i)?1+Math.floor(3*a):xm;o>xm&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${o} samples when the maximum is set to 20`);const l=[];let h=0;for(let t=0;t<xm;++t){const e=t/a,i=Math.exp(-e*e/2);l.push(i),0==t?h+=i:t<o&&(h+=2*i)}for(let t=0;t<l.length;t++)l[t]=l[t]/h;const c=this.blurMaterial.uniforms;c.envMap.value=t.texture,c.samples.value=o,c.weights.value=l,c.latitudinal.value="latitudinal"===n,c.dTheta.value=s;new _n(.1,100,e).update(this.threeRenderer,this.blurScene)}getBlurShader(t){const e=new Float32Array(t),i=new ae(0,1,0);return new fn({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:i}},vertexShader:"\n      \n      varying vec3 vOutputDirection;\n  \n      void main() {\n  \n        vOutputDirection = vec3( position );\n        gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n  \n      }\n    ",fragmentShader:"\n        varying vec3 vOutputDirection;\n  \n        uniform samplerCube envMap;\n        uniform int samples;\n        uniform float weights[ n ];\n        uniform bool latitudinal;\n        uniform float dTheta;\n        uniform vec3 poleAxis;\n  \n        vec3 getSample( float theta, vec3 axis ) {\n  \n          float cosTheta = cos( theta );\n          // Rodrigues' axis-angle rotation\n          vec3 sampleDirection = vOutputDirection * cosTheta\n            + cross( axis, vOutputDirection ) * sin( theta )\n            + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n  \n          return vec3( textureCube( envMap, sampleDirection ) );\n  \n        }\n  \n        void main() {\n  \n          vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n  \n          if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n  \n            axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n  \n          }\n  \n          axis = normalize( axis );\n  \n          gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n          gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n  \n          for ( int i = 1; i < n; i++ ) {\n  \n            if ( i >= samples ) {\n  \n              break;\n  \n            }\n  \n            float theta = dTheta * float( i );\n            gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n            gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n  \n          }\n        }\n      ",blending:c,depthTest:!1,depthWrite:!1,side:l})}async dispose(){for(const[,t]of this.skyboxCache){(await t).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const wm=[1,.79,.62,.5,.4,.31,.25],Cm="high-performance";class Im extends Et{constructor(t){super(),this.loader=new Bu(gm),this.width=0,this.height=0,this.dpr=1,this.debugger=null,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=t=>{this.dispatchEvent({type:"contextlost",sourceEvent:t})},this.onWebGLContextRestored=()=>{var t;null===(t=this.textureUtils)||void 0===t||t.dispose(),this.textureUtils=new Em(this.threeRenderer);for(const t of this.scenes)t.element[Gh]()},this.dpr=Uh(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new ua({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:t.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.outputEncoding=At,this.threeRenderer.useLegacyLights=!1,this.threeRenderer.setPixelRatio(1),this.debugger=t.debug?new Kp(this):null,this.threeRenderer.debug={checkShaderErrors:!!this.debugger},this.threeRenderer.toneMapping=y}catch(t){console.warn(t)}this.arRenderer=new Xp(this),this.textureUtils=this.canRender?new Em(this.threeRenderer):null,Bu.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton}static resetSingleton(){const t=this._singleton.dispose();for(const e of t)e.disconnectedCallback();this._singleton=new Im({powerPreference:(self.ModelViewerElement||{}).powerPreference||Cm,debug:Nh()});for(const e of t)e.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return wm[this.scaleStep]}set minScale(t){let e=1;for(;e<wm.length&&!(wm[e]<t);)++e;this.lastStep=e-1}registerScene(t){this.scenes.add(t),t.forceRescale();const e=new Nt;this.threeRenderer.getSize(e),t.canvas.width=e.x,t.canvas.height=e.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((t,e)=>this.render(t,e))),null!=this.debugger&&this.debugger.addScene(t)}unregisterScene(t){this.scenes.delete(t),this.canvas3D.parentElement===t.canvas.parentElement&&t.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null),null!=this.debugger&&this.debugger.removeScene(t)}displayCanvas(t){return this.multipleScenesVisible?t.element[sv]:this.canvas3D}countVisibleScenes(){const{canvas3D:t}=this;let e=0,i=null;for(const n of this.scenes){const{element:r}=n;r.modelIsVisible&&null==n.externalRenderer&&++e,t.parentElement===n.canvas.parentElement&&(i=n)}const n=e>1;if(null!=i){const e=n&&!this.multipleScenesVisible,r=!i.element.modelIsVisible;if(e||r){const{width:e,height:n}=this.sceneSize(i);this.copyPixels(i,e,n),t.parentElement.removeChild(t)}}this.multipleScenesVisible=n}updateRendererSize(){const t=Uh();if(t!==this.dpr)for(const t of this.scenes){const{element:e}=t;e[qf](e.getBoundingClientRect())}let e=0,i=0;for(const t of this.scenes)e=Math.max(e,t.width),i=Math.max(i,t.height);if(e!==this.width||i!==this.height||t!==this.dpr){this.width=e,this.height=i,this.dpr=t,e=Math.ceil(e*t),i=Math.ceil(i*t),this.canRender&&this.threeRenderer.setSize(e,i,!1);for(const t of this.scenes){const{canvas:n}=t;n.width=e,n.height=i,t.forceRescale()}}}updateRendererScale(t){const e=this.scaleStep;this.avgFrameDuration+=Ph(.2*(t-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),e!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(t){if(t.shouldRender())t.scaleStep!=this.scaleStep&&(t.scaleStep=this.scaleStep,this.rescaleCanvas(t));else{if(0==t.scaleStep)return!1;t.scaleStep=0,this.rescaleCanvas(t)}return!0}rescaleCanvas(t){const e=wm[t.scaleStep],i=Math.ceil(this.width/e),n=Math.ceil(this.height/e),{style:r}=t.canvas;r.width=`${i}px`,r.height=`${n}px`,this.canvas3D.style.width=`${i}px`,this.canvas3D.style.height=`${n}px`;const s=this.dpr*e,a=e<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";t.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:s,minimumDpr:this.dpr*wm[this.lastStep],pixelWidth:Math.ceil(t.width*s),pixelHeight:Math.ceil(t.height*s),reason:a}}))}sceneSize(t){const{dpr:e}=this,i=wm[t.scaleStep];return{width:Math.min(Math.ceil(t.width*i*e),this.canvas3D.width),height:Math.min(Math.ceil(t.height*i*e),this.canvas3D.height)}}copyPixels(t,e,i){const n=t.context;null!=n?(n.clearRect(0,0,e,i),n.drawImage(this.canvas3D,0,0,e,i,0,0,e,i),t.canvas.classList.add("show")):console.log("could not acquire 2d context")}orderedScenes(){const t=[];for(const e of[!1,!0])for(const i of this.scenes)i.element.modelIsVisible===e&&t.push(i);return t}get isPresenting(){return this.arRenderer.isPresenting}preRender(t,e,i){const{element:n,exposure:r}=t;n[lv](e,i);const s="number"==typeof r&&!Number.isNaN(r);this.threeRenderer.toneMappingExposure=s?r:1}render(t,e){if(null!=e)return void this.arRenderer.onWebXRFrame(t,e);const i=t-this.lastTick;if(this.lastTick=t,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(i),this.renderedLastFrame=!1);const{canvas3D:n}=this;for(const e of this.orderedScenes()){const{element:r}=e;if(!r.loaded||!r.modelIsVisible&&e.renderCount>0)continue;if(this.preRender(e,t,i),!this.shouldRender(e))continue;if(null!=e.externalRenderer){const t=e.getCamera();t.updateMatrix();const{matrix:i,projectionMatrix:n}=t,r=i.elements.slice(),s=e.getTarget();r[12]+=s.x,r[13]+=s.y,r[14]+=s.z,e.externalRenderer.render({viewMatrix:r,projectionMatrix:n.elements});continue}if(!r.modelIsVisible&&!this.multipleScenesVisible)for(const t of this.scenes)t.element.modelIsVisible&&t.queueRender();const{width:s,height:a}=this.sceneSize(e);e.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-a,s,a),this.threeRenderer.render(e,e.camera),this.multipleScenesVisible||!e.element.modelIsVisible&&0===e.renderCount?this.copyPixels(e,s,a):n.parentElement!==e.canvas.parentElement&&(e.canvas.parentElement.appendChild(n),e.canvas.classList.remove("show")),e.hasRendered(),++e.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const t=[];for(const e of this.scenes)t.push(e.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),t}}Im._singleton=new Im({powerPreference:(self.ModelViewerElement||{}).powerPreference||Cm,debug:Nh()});
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const bm=Symbol("correlatedObjects"),Sm=Symbol("sourceObject"),Mm=Symbol("onUpdate");class Bm{constructor(t,e,i=null){this[Mm]=t,this[Sm]=e,this[bm]=i}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Tm=new Mi,Rm=new Dn(2,2);let Lm=0;const Dm=Symbol("threeTexture");class Qm extends Bm{get[Dm](){var t;return console.assert(null!=this[bm]&&this[bm].size>0,"Image correlated object is undefined"),null===(t=this[bm])||void 0===t?void 0:t.values().next().value}constructor(t,e,i){super(t,i=null!=i?i:{name:e&&e.image&&e.image.src?e.image.src.split("/").pop():"adhoc_image",uri:e&&e.image&&e.image.src?e.image.src:"adhoc_image"+Lm++},new Set(e?[e]:[]))}get name(){return this[Sm].name||""}get uri(){return this[Sm].uri}get bufferView(){return this[Sm].bufferView}get element(){const t=this[Dm];if(t&&(t.isCanvasTexture||t.isVideoTexture))return t.image}get animation(){const t=this[Dm];if(t&&t.isCanvasTexture&&t.animation)return t.animation}get type(){return null!=this.uri?"external":"embedded"}set name(t){this[Sm].name=t}update(){const t=this[Dm];t&&t.isCanvasTexture&&!t.animation&&(this[Dm].needsUpdate=!0,this[Mm]())}async createThumbnail(t,e){const i=new da;Tm.map=this[Dm];const n=new cn(Rm,Tm);i.add(n);const r=new Vn(-1,1,1,-1,0,1),{threeRenderer:s}=Im.singleton,a=new ie(t,e);s.setRenderTarget(a),s.render(i,r),s.setRenderTarget(null);const o=new Uint8Array(t*e*4);s.readRenderTargetPixels(a,0,0,t,e,o),Uf.width=t,Uf.height=e;const l=Uf.getContext("2d"),h=l.createImageData(t,e);return h.data.set(o),l.putImageData(h,0,0),new Promise((async(t,e)=>{Uf.toBlob((i=>{if(!i)return e("Failed to capture thumbnail.");t(URL.createObjectURL(i))}),"image/png")}))}}var Pm,Um;!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.NearestMipmapNearest=9984]="NearestMipmapNearest",t[t.LinearMipmapNearest=9985]="LinearMipmapNearest",t[t.NearestMipmapLinear=9986]="NearestMipmapLinear",t[t.LinearMipmapLinear=9987]="LinearMipmapLinear"}(Pm||(Pm={})),function(t){t[t.ClampToEdge=33071]="ClampToEdge",t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.Repeat=10497]="Repeat"}(Um||(Um={}));
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const Nm=(()=>{const t=[Pm.Nearest,Pm.Linear,Pm.NearestMipmapNearest,Pm.LinearMipmapLinear,Pm.NearestMipmapLinear,Pm.LinearMipmapLinear];return e=>t.indexOf(e)>-1})(),Fm=(()=>{const t=[Pm.Nearest,Pm.Linear];return e=>t.indexOf(e)>-1})(),km=(()=>{const t=[Um.ClampToEdge,Um.MirroredRepeat,Um.Repeat];return e=>t.indexOf(e)>-1})(),Om=Symbol("threeTextures"),Gm=Symbol("setProperty"),Hm=Symbol("sourceSampler");class zm extends Bm{get[Om](){return console.assert(null!=this[bm]&&this[bm].size>0,"Sampler correlated object is undefined"),this[bm]}get[Hm](){return console.assert(null!=this[Sm],"Sampler source is undefined"),this[Sm]}constructor(t,e,i){null==(i=null!=i?i:{}).minFilter&&(i.minFilter=e?e.minFilter:Pm.LinearMipmapLinear),null==i.magFilter&&(i.magFilter=e?e.magFilter:Pm.Linear),null==i.wrapS&&(i.wrapS=e?e.wrapS:Um.Repeat),null==i.wrapT&&(i.wrapT=e?e.wrapT:Um.Repeat),super(t,i,new Set(e?[e]:[]))}get name(){return this[Sm].name||""}get minFilter(){return this[Hm].minFilter}get magFilter(){return this[Hm].magFilter}get wrapS(){return this[Hm].wrapS}get wrapT(){return this[Hm].wrapT}setMinFilter(t){this[Gm]("minFilter",t)}setMagFilter(t){this[Gm]("magFilter",t)}setWrapS(t){this[Gm]("wrapS",t)}setWrapT(t){this[Gm]("wrapT",t)}[Gm](t,e){const i=this[Hm];if(null!=i){if(((t,e)=>{switch(t){case"minFilter":return Nm(e);case"magFilter":return Fm(e);case"wrapS":case"wrapT":return km(e);default:throw new Error(`Cannot configure property "${t}" on Sampler`)}})(t,e)){i[t]=e;for(const i of this[Om])i[t]=e,i.needsUpdate=!0}this[Mm]()}}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Vm=Symbol("image"),Wm=Symbol("sampler");class qm extends Bm{constructor(t,e,i=null,n=null,r=null){super(t,i||{},new Set(e?[e]:[])),this[Wm]=new zm(t,e,n),this[Vm]=new Qm(t,e,r)}get name(){return this[Sm].name||""}set name(t){this[Sm].name=t}get sampler(){return this[Wm]}get source(){return this[Vm]}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var jm,Ym,Jm;const Xm=Symbol("texture"),Km=Symbol("transform"),$m=Symbol("materials"),Zm=Symbol("usage"),tg=Symbol("onUpdate"),eg=Symbol("activeVideo");var ig;!function(t){t[t.Base=0]="Base",t[t.MetallicRoughness=1]="MetallicRoughness",t[t.Normal=2]="Normal",t[t.Occlusion=3]="Occlusion",t[t.Emissive=4]="Emissive"}(ig||(ig={}));class ng{constructor(t,e,i,n,r,s){if(this[jm]=null,this[Ym]={rotation:0,scale:new Nt(1,1),offset:new Nt(0,0)},this[Jm]=!1,s&&i){const e=r.textures?r.textures[s.index]:null,n=e&&r.samplers?r.samplers[e.sampler]:null,a=e&&r.images?r.images[e.source]:null;this[Km].rotation=i.rotation,this[Km].scale.copy(i.repeat),this[Km].offset.copy(i.offset),this[Xm]=new qm(t,i,e,n,a)}this[tg]=t,this[$m]=n,this[Zm]=e}get texture(){return this[Xm]}setTexture(t){var e,i;const n=null!=t?t.source[Dm]:null,r=null===(e=this[Xm])||void 0===e?void 0:e.source[Dm];if(null!=r&&r.isVideoTexture?this[eg]=!1:(null===(i=this[Xm])||void 0===i?void 0:i.source.animation)&&this[Xm].source.animation.removeEventListener("enterFrame",this[tg]),this[Xm]=t,null!=n&&n.isVideoTexture){const t=n.image;if(this[eg]=!0,null!=t.requestVideoFrameCallback){const e=()=>{this[eg]&&(this[tg](),t.requestVideoFrameCallback(e))};t.requestVideoFrameCallback(e)}else{const t=()=>{this[eg]&&(this[tg](),requestAnimationFrame(t))};requestAnimationFrame(t)}}else null!=(null==t?void 0:t.source.animation)&&t.source.animation.addEventListener("enterFrame",this[tg]);let s=At;if(this[$m])for(const t of this[$m]){switch(this[Zm]){case ig.Base:t.map=n;break;case ig.MetallicRoughness:s=dt,t.metalnessMap=n,t.roughnessMap=n;break;case ig.Normal:s=dt,t.normalMap=n;break;case ig.Occlusion:s=dt,t.aoMap=n;break;case ig.Emissive:t.emissiveMap=n}t.needsUpdate=!0}n&&(n.encoding=s,n.rotation=this[Km].rotation,n.repeat=this[Km].scale,n.offset=this[Km].offset),this[tg]()}}jm=Xm,Ym=Km,Jm=eg;
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const rg=Symbol("threeMaterials"),sg=Symbol("baseColorTexture"),ag=Symbol("metallicRoughnessTexture");class og extends Bm{constructor(t,e,i,n){super(t,i,n),null==i.baseColorFactor&&(i.baseColorFactor=[1,1,1,1]),null==i.roughnessFactor&&(i.roughnessFactor=1),null==i.metallicFactor&&(i.metallicFactor=1);const{baseColorTexture:r,metallicRoughnessTexture:s}=i,{map:a,metalnessMap:o}=n.values().next().value;this[sg]=new ng(t,ig.Base,a,n,e,r||null),this[ag]=new ng(t,ig.MetallicRoughness,o,n,e,s||null)}get[rg](){return this[bm]}get baseColorFactor(){return this[Sm].baseColorFactor}get metallicFactor(){return this[Sm].metallicFactor}get roughnessFactor(){return this[Sm].roughnessFactor}get baseColorTexture(){return this[sg]}get metallicRoughnessTexture(){return this[ag]}setBaseColorFactor(t){const e=new bi;t instanceof Array?e.fromArray(t):e.set(t).convertSRGBToLinear();for(const i of this[rg])i.color.set(e),t instanceof Array?i.opacity=t[3]:(t=[0,0,0,i.opacity],e.toArray(t));this[Sm].baseColorFactor=t,this[Mm]()}setMetallicFactor(t){for(const e of this[rg])e.metalness=t;this[Sm].metallicFactor=t,this[Mm]()}setRoughnessFactor(t){for(const e of this[rg])e.roughness=t;this[Sm].roughnessFactor=t,this[Mm]()}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var lg;const hg=Symbol("pbrMetallicRoughness"),cg=Symbol("normalTexture"),ug=Symbol("occlusionTexture"),dg=Symbol("emissiveTexture"),Ag=Symbol("backingThreeMaterial"),pg=Symbol("applyAlphaCutoff"),mg=Symbol("lazyLoadGLTFInfo"),gg=Symbol("initialize"),fg=Symbol("getLoadedMaterial"),vg=Symbol("ensureMaterialIsLoaded"),yg=Symbol("gltfIndex"),xg=Symbol("setActive"),_g=Symbol("variantIndices"),Eg=Symbol("isActive"),wg=Symbol("variantSet"),Cg=Symbol("modelVariants");class Ig extends Bm{constructor(t,e,i,n,r,s,a,o=void 0){super(t,i,a),this[lg]=new Set,this[yg]=n,this[Eg]=r,this[Cg]=s,null==o?this[gg](e):this[mg]=o}get[(lg=wg,Ag)](){return this[bm].values().next().value}[gg](t){const e=this[Mm],i=this[Sm],n=this[bm];i.extensions&&i.extensions.KHR_materials_pbrSpecularGlossiness&&console.warn(`Material ${i.name} uses a deprecated extension\n          "KHR_materials_pbrSpecularGlossiness", please use\n          "pbrMetallicRoughness" instead. Specular Glossiness materials are\n          no longer supported; to convert to metal-rough, see \n          https://www.donmccurdy.com/2022/11/28/converting-gltf-pbr-materials-from-specgloss-to-metalrough/.`),null==i.pbrMetallicRoughness&&(i.pbrMetallicRoughness={}),this[hg]=new og(e,t,i.pbrMetallicRoughness,n),null==i.emissiveFactor&&(i.emissiveFactor=[0,0,0]),null==i.doubleSided&&(i.doubleSided=!1),null==i.alphaMode&&(i.alphaMode="OPAQUE"),null==i.alphaCutoff&&(i.alphaCutoff=.5);const{normalTexture:r,occlusionTexture:s,emissiveTexture:a}=i,{normalMap:o,aoMap:l,emissiveMap:h}=n.values().next().value;this[cg]=new ng(e,ig.Normal,o,n,t,r||null),this[ug]=new ng(e,ig.Occlusion,l,n,t,s||null),this[dg]=new ng(e,ig.Emissive,h,n,t,a||null)}async[fg](){if(null!=this[mg]){const{set:t,material:e}=await this[mg].doLazyLoad();return this[bm]=t,this[gg](this[mg].gltf),this[mg]=void 0,this.ensureLoaded=async()=>{},e}return this[bm].values().next().value}[vg](){if(null!=this[mg])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n    myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[fg]()}get isLoaded(){return null==this[mg]}get isActive(){return this[Eg]}[xg](t){this[Eg]=t}get name(){return this[Sm].name}set name(t){const e=this[Sm];if(null!=e&&(e.name=t),null!=this[bm])for(const e of this[bm])e.name=t}get pbrMetallicRoughness(){return this[vg](),this[hg]}get normalTexture(){return this[vg](),this[cg]}get occlusionTexture(){return this[vg](),this[ug]}get emissiveTexture(){return this[vg](),this[dg]}get emissiveFactor(){return this[vg](),this[Sm].emissiveFactor}get index(){return this[yg]}[_g](){return this[wg]}hasVariant(t){const e=this[Cg].get(t);return null!=e&&this[wg].has(e.index)}setEmissiveFactor(t){this[vg]();const e=new bi;t instanceof Array?e.fromArray(t):e.set(t).convertSRGBToLinear();for(const t of this[bm])t.emissive.set(e);this[Sm].emissiveFactor=e.toArray(),this[Mm]()}[pg](){this[vg]();const t=this[Sm];for(const e of this[bm])"MASK"===this[Sm].alphaMode?e.alphaTest=t.alphaCutoff:e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(t){this[vg](),this[Sm].alphaCutoff=t,this[pg](),this[Mm]()}getAlphaCutoff(){return this[vg](),this[Sm].alphaCutoff}setDoubleSided(t){this[vg]();for(const e of this[bm])e.side=t?h:o,e.needsUpdate=!0;this[Sm].doubleSided=t,this[Mm]()}getDoubleSided(){return this[vg](),this[Sm].doubleSided}setAlphaMode(t){this[vg]();const e=(t,e)=>{t.transparent=e,t.depthWrite=!e};this[Sm].alphaMode=t;for(const i of this[bm])e(i,"BLEND"===t),this[pg](),i.needsUpdate=!0;this[Mm]()}getAlphaMode(){return this[vg](),this[Sm].alphaMode}}class bg{constructor(t){this.name="",this.children=new Array,this.name=t}}class Sg extends bg{constructor(t,e,i,n){super(t.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=t;const{gltf:r,threeGLTF:s,threeObjectMap:a}=n;this.modelVariants=i,this.mesh.userData.variantData=i;const o=a.get(t.material);null!=o.materials?this.initialMaterialIdx=this.activeMaterialIdx=o.materials:console.error(`Primitive (${t.name}) missing initial material reference.`);const l=t.userData.associations||{};if(null==l.meshes)return void console.error("Mesh is missing primitive index association");const h=((r.meshes||[])[l.meshes].primitives||[])[l.primitives];if(null!=h){if(null!=h.material)this.materials.set(h.material,e[h.material]);else{const t=e.findIndex((t=>"Default"===t.name));t>=0?this.materials.set(t,e[t]):console.warn("gltfPrimitive has no material!")}if(h.extensions&&h.extensions.KHR_materials_variants){const t=h.extensions.KHR_materials_variants,n=s.parser.json.extensions.KHR_materials_variants.variants;for(const r of t.mappings){const t=e[r.material];this.materials.set(r.material,t);for(const e of r.variants){const{name:r}=n[e];this.variantToMaterialMap.set(e,t),t[_g]().add(e),i.has(r)||i.set(r,{name:r,index:e})}}}}else console.error("Mesh primitive definition is missing.")}async setActiveMaterial(t){const e=this.materials.get(t);return null!=e&&(this.mesh.material=await e[fg](),this.activeMaterialIdx=t),this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(t){return this.materials.get(t)}async enableVariant(t){if(null==t)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(t)){const e=this.modelVariants.get(t);return this.enableVariantHelper(e.index)}return null}async enableVariantHelper(t){if(null!=this.variantToMaterialMap&&null!=t){const e=this.variantToMaterialMap.get(t);if(null!=e)return this.setActiveMaterial(e.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const t of this.variantToMaterialMap.keys()){const e=this.mesh.userData.variantMaterials.get(t);if(null!=e.material)continue;const i=await this.enableVariantHelper(t);null!=i&&(e.material=i)}}get variantInfo(){return this.variantToMaterialMap}addVariant(t,e){if(!this.ensureVariantIsUnused(e))return!1;this.modelVariants.has(e)||this.modelVariants.set(e,{name:e,index:this.modelVariants.size});const i=this.modelVariants.get(e).index;return t[_g]().add(i),this.variantToMaterialMap.set(i,t),this.materials.set(t.index,t),this.updateVariantUserData(i,t),!0}deleteVariant(t){if(this.variantInfo.has(t)){this.variantInfo.delete(t);const e=this.mesh.userData.variantMaterials;null!=e&&e.delete(t)}}updateVariantUserData(t,e){e[_g]().add(t),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(t,{material:e[bm].values().next().value,gltfMaterialIndex:e.index})}ensureVariantIsUnused(t){const e=this.modelVariants.get(t);return null==e||!this.variantInfo.has(e.index)||(console.warn(`Primitive cannot add variant '${t}' for this material, it already exists.`),!1)}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Mg,Bg,Tg,Rg,Lg,Dg;const Qg=Symbol("materials"),Pg=Symbol("hierarchy"),Ug=Symbol("roots"),Ng=Symbol("primitives"),Fg=Symbol("correlatedSceneGraph"),kg=Symbol("prepareVariantsForExport"),Og=Symbol("switchVariant"),Gg=Symbol("materialFromPoint"),Hg=Symbol("nodeFromPoint"),zg=Symbol("nodeFromIndex"),Vg=Symbol("variantData"),Wg=Symbol("availableVariants"),qg=Symbol("modelOnUpdate"),jg=Symbol("cloneMaterial");class Yg{constructor(t,e,i,n){this.gltf=t,this.gltfElementMap=e,this.mapKey=i,this.doLazyLoad=n}}class Jg{constructor(t,e=(()=>{})){this[Mg]=new Array,this[Bg]=new Array,this[Tg]=new Array,this[Rg]=new Array,this[Lg]=()=>{},this[Dg]=new Map,this[qg]=e,this[Fg]=t;const{gltf:i,threeGLTF:n,gltfElementMap:r}=t;for(const[t,s]of i.materials.entries()){const a=r.get(s);if(null!=a)this[Qg].push(new Ig(e,i,s,t,!0,this[Vg],a));else{const s=(i.materials||[])[t],o=t,l=async()=>{const t=await n.parser.getDependency("material",o),e=new Set;return r.set(s,e),e.add(t),{set:e,material:t}};this[Qg].push(new Ig(e,i,s,t,!1,this[Vg],a,new Yg(i,r,s,l)))}}const s=new Map,a=new Array;for(const t of n.scene.children)a.push(t);for(;a.length>0;){const e=a.pop();let i=null;e instanceof cn?(i=new Sg(e,this.materials,this[Vg],t),this[Ng].push(i)):i=new bg(e.name);const n=s.get(e);null!=n?n.children.push(i):this[Ug].push(i),this[Pg].push(i);for(const t of e.children)a.push(t),s.set(e,i)}}get materials(){return this[Qg]}[(Mg=Qg,Bg=Pg,Tg=Ug,Rg=Ng,Lg=qg,Dg=Vg,Wg)](){const t=Array.from(this[Vg].values());return t.sort(((t,e)=>t.index-e.index)),t.map((t=>t.name))}getMaterialByName(t){const e=this[Qg].filter((e=>e.name===t));return e.length>0?e[0]:null}[zg](t,e){const i=this[Pg].find((i=>{if(i instanceof Sg){const{meshes:n,primitives:r}=i.mesh.userData.associations;if(n==t&&r==e)return!0}return!1}));return null==i?null:i}[Hg](t){return this[Pg].find((e=>{if(e instanceof Sg){if(e.mesh===t.object)return!0}return!1}))}[Gg](t){return this[Hg](t).getActiveMaterial()}async[Og](t){for(const e of this[Ng])await e.enableVariant(t);for(const t of this.materials)t[xg](!1);for(const t of this[Ng])this.materials[t.getActiveMaterial().index][xg](!0)}async[kg](){const t=new Array;for(const e of this[Ng])t.push(e.instantiateVariants());await Promise.all(t)}[jg](t,e){const i=this.materials[t];i.isLoaded||console.error("Cloning an unloaded material,\n           call 'material.ensureLoaded() before cloning the material.");const n=i[bm],r=JSON.parse(JSON.stringify(i[Sm]));r.name=e;this[Fg].gltf.materials.push(r);const s=new Set;for(const[t,i]of n.entries()){const r=i.clone();r.name=e+(n.size>1?"_inst"+t:""),s.add(r)}const a=new Ig(this[qg],this[Fg].gltf,r,this[Qg].length,!1,this[Vg],s);return this[Qg].push(a),a}createMaterialInstanceForVariant(t,e,i,n=!0){let r=null;for(const n of this[Ng]){const s=this[Vg].get(i);null!=s&&n.variantInfo.has(s.index)||null!=n.getMaterial(t)&&(this.hasVariant(i)||this.createVariant(i),null==r&&(r=this[jg](t,e)),n.addVariant(r,i))}if(n&&null!=r){r[xg](!0),this.materials[t][xg](!1);for(const t of this[Ng])t.enableVariant(i)}return r}createVariant(t){this[Vg].has(t)?console.warn(`Variant '${t}'' already exists`):this[Vg].set(t,{name:t,index:this[Vg].size})}hasVariant(t){return this[Vg].has(t)}setMaterialToVariant(t,e){if(null!=this[Wg]().find((t=>t===e)))if(t<0||t>=this.materials.length)console.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const i of this[Ng]){const n=i.getMaterial(t);null!=n&&i.addVariant(n,e)}else console.warn(`Can't add material to '${e}', the variant does not exist.'`)}updateVariantName(t,e){const i=this[Vg].get(t);null!=i&&(i.name=e,this[Vg].set(e,i),this[Vg].delete(t))}deleteVariant(t){const e=this[Vg].get(t);if(null!=e){for(const i of this.materials)i.hasVariant(t)&&i[wg].delete(e.index);for(const t of this[Ng])t.deleteVariant(e.index);this[Vg].delete(t)}}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Xg=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Kg=Symbol("currentGLTF"),$g=Symbol("originalGltfJson"),Zg=Symbol("model"),tf=Symbol("getOnUpdateMethod"),ef=Symbol("buildTexture"),nf=new ae,rf=new ae,sf=new ae,af=new Ft,of=new yi,lf=new se;class hf extends Tu{constructor(t){super(document.createElement("div")),this.normal=new ae(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=t.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(t.position),this.updateNormal(t.normal),this.surface=t.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(t){if(null==t)return;const e=Gd(t)[0].terms;for(let t=0;t<3;++t)this.position.setComponent(t,$d(e[t]).number);this.updateMatrixWorld()}updateNormal(t){if(null==t)return;const e=Gd(t)[0].terms;for(let t=0;t<3;++t)this.normal.setComponent(t,e[t].number)}updateSurface(t){if(!t&&this.initialized)return;const{mesh:e,tri:i,bary:n}=this;if(null==e||null==i||null==n)return;e.getVertexPosition(i.x,nf),e.getVertexPosition(i.y,rf),e.getVertexPosition(i.z,sf),nf.toArray(af.elements,0),rf.toArray(af.elements,3),sf.toArray(af.elements,6),this.position.copy(n).applyMatrix3(af);const r=this.parent;r.worldToLocal(e.localToWorld(this.position)),of.set(nf,rf,sf),of.getNormal(this.normal).transformDirection(e.matrixWorld);const s=r.parent;lf.setFromAxisAngle(nf.set(0,1,0),-s.yaw),this.normal.applyQuaternion(lf)}orient(t){this.pivot.style.transform=`rotate(${t}rad)`}updateVisibility(t){t?this.element.classList.remove("hide"):this.element.classList.add("hide"),this.slot.assignedNodes().forEach((e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const i=e,n=i.dataset.visibilityAttribute;if(null!=n){const e=`data-${n}`;t?i.setAttribute(e,""):i.removeAttribute(e)}i.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:t}}))})),this.initialized=!0}}const cf={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},uf={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};function df(t,e,i){return(1-i)*t+i*e}
/* @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Af extends oi{constructor(t,e,i){super(),this.camera=new Vn,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new Xs,this.horizontalBlurMaterial=new fn(cf),this.verticalBlurMaterial=new fn(uf),this.intensity=0,this.softness=1,this.boundingBox=new he,this.size=new ae,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:n}=this;n.rotation.x=Math.PI/2,n.left=-.5,n.right=.5,n.bottom=-.5,n.top=.5,this.add(n);const r=new Dn,s=new Mi({opacity:1,transparent:!0,side:l});this.floor=new cn(r,s),this.floor.userData.shadow=!0,n.add(this.floor),this.blurPlane=new cn(r),this.blurPlane.visible=!1,n.add(this.blurPlane),t.target.add(this),this.depthMaterial.onBeforeCompile=function(t){t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(t,e,i)}setScene(t,e,i){const{boundingBox:n,size:r,rotation:s,position:a}=this;if(this.isAnimated=t.animationNames.length>0,this.boundingBox.copy(t.boundingBox),this.size.copy(t.size),this.maxDimension=Math.max(r.x,r.y,r.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(a),"back"===i){const{min:t,max:e}=n;[t.y,t.z]=[t.z,t.y],[e.y,e.z]=[e.z,e.y],[r.y,r.z]=[r.z,r.y],s.x=Math.PI/2,s.y=Math.PI}else s.x=0,s.y=0;if(this.isAnimated){const t=n.min.y,e=n.max.y;r.y=this.maxDimension,n.expandByVector(r.subScalar(this.maxDimension).multiplyScalar(-.5)),n.min.y=t,n.max.y=e,r.set(this.maxDimension,e-t,this.maxDimension)}"bottom"===i?a.y=n.min.y:a.z=n.min.y,this.setSoftness(e)}setSoftness(t){this.softness=t;const{size:e,camera:i}=this,n=this.isAnimated?2:1,r=n*Math.pow(2,9-3*t);this.setMapSize(r);const s=e.y/2,a=e.y*n;i.near=0,i.far=df(a,s,t),this.depthMaterial.opacity=1/t,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(t){const{size:e}=this;this.isAnimated&&(t*=2);const i=Math.floor(e.x>e.z?t:t*e.x/e.z),n=Math.floor(e.x>e.z?t*e.z/e.x:t),r=10+i,s=10+n;if(null==this.renderTarget||this.renderTarget.width===r&&this.renderTarget.height===s||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const t={format:k};this.renderTarget=new ie(r,s,t),this.renderTargetBlur=new ie(r,s,t),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(e.x*(1+10/i),e.z*(1+10/n),1),this.needsUpdate=!0}setIntensity(t){this.intensity=t,t>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=t*df(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(t){this.floor.position.z=-t+.001*this.maxDimension}render(t,e){e.overrideMaterial=this.depthMaterial;const i=t.getClearAlpha();t.setClearAlpha(0),this.floor.visible=!1;const n=t.xr.enabled;t.xr.enabled=!1;const r=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.render(e,this.camera),e.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(t),t.xr.enabled=n,t.setRenderTarget(r),t.setClearAlpha(i)}blurShadow(t){const{camera:e,horizontalBlurMaterial:i,verticalBlurMaterial:n,renderTarget:r,renderTargetBlur:s,blurPlane:a}=this;a.visible=!0,a.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,t.setRenderTarget(s),t.render(a,e),a.material=n,n.uniforms.v.value=1/this.renderTarget.height,n.uniforms.tDiffuse.value=this.renderTargetBlur.texture,t.setRenderTarget(r),t.render(a,e),a.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const pf=new ae,mf=new ae,gf=new ae,ff=new class{constructor(t,e,i=0,n=1/0){this.ray=new Pe(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new je,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!0,i=[]){return pl(t,this,i,e),i.sort(Al),i}intersectObjects(t,e=!0,i=[]){for(let n=0,r=t.length;n<r;n++)pl(t[n],this,i,e);return i.sort(Al),i}},vf=new ae,yf=new Nt;class xf extends da{constructor({canvas:t,element:e,width:i,height:n}){super(),this.annotationRenderer=new Uu,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new yn(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new oi,this.animationNames=[],this.boundingBox=new he,this.boundingSphere=new Se,this.size=new ae,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.canScale=!0,this.isDirty=!1,this.goalTarget=new ae,this.targetDamperX=new Qd,this.targetDamperY=new Qd,this.targetDamperZ=new Qd,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.name="ModelScene",this.element=e,this.canvas=t,this.camera=new yn(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(i,n),this.target.name="Target",this.mixer=new dl(this.target);const{domElement:r}=this.annotationRenderer,{style:s}=r;s.display="none",s.pointerEvents="none",s.position="absolute",s.top="0",this.element.shadowRoot.querySelector(".default").appendChild(r),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(t){this.reset(),this._model=t,this.target.add(t),await this.setupScene()}async setSource(t,e=(()=>{})){if(!t||t===this.url)return void e(1);if(this.reset(),this.url=t,null!=this.externalRenderer){const t=await this.externalRenderer.load(e);return this.boundingSphere.radius=t.framedRadius,void(this.idealAspect=t.fieldOfViewAspect)}let i;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{i=await new Promise((async(i,n)=>{this.cancelPendingSourceChange=()=>n();try{i(await this.element[uv].loader.load(t,this.element,e))}catch(t){n(t)}}))}catch(t){if(null==t)return;throw t}this.cancelPendingSourceChange=null,this.reset(),this.url=t,this._currentGLTF=i,null!=i&&(this._model=i.scene,this.target.add(i.scene));const{animations:n}=i,r=new Map,s=[];for(const t of n)r.set(t.name,t),s.push(t.name);this.animations=n,this.animationsByName=r,this.animationNames=s,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity)}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:t}=this;null!=t&&(t.removeFromParent(),this._model=null);const e=this._currentGLTF;null!=e&&(e.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[Kg]=null,this.element[$g]=null,this.element[Zg]=null}get currentGLTF(){return this._currentGLTF}setSize(t,e){if(this.width!==t||this.height!==e){if(this.width=Math.max(t,1),this.height=Math.max(e,1),this.annotationRenderer.setSize(t,e),this.aspect=this.width/this.height,null!=this.externalRenderer){const i=Uh();this.externalRenderer.resize(t*i,e*i)}this.queueRender()}}markBakedShadow(t){t.userData.shadow=!0,this.bakedShadows.add(t)}unmarkBakedShadow(t){t.userData.shadow=!1,t.visible=!0,this.bakedShadows.delete(t),this.boundingBox.expandByObject(t)}findBakedShadows(t){const e=new he;t.traverse((t=>{const i=t;if(!i.material)return;if(!i.material.transparent)return;e.setFromObject(i);const n=e.getSize(vf),r=Math.min(n.x,n.y,n.z);Math.max(n.x,n.y,n.z)<100*r||this.markBakedShadow(i)}))}checkBakedShadows(){const{min:t,max:e}=this.boundingBox,i=new he;this.boundingBox.getSize(this.size);for(const n of this.bakedShadows)i.setFromObject(n),i.min.y<t.y+this.size.y/100&&i.min.x<=t.x&&i.max.x>=e.x&&i.min.z<=t.z&&i.max.z>=e.z||i.min.z<t.z+this.size.z/100&&i.min.x<=t.x&&i.max.x>=e.x&&i.min.y<=t.y&&i.max.y>=e.y||this.unmarkBakedShadow(n)}applyTransform(){const{model:t}=this;if(null==t)return;const e=Gd(this.element.orientation)[0].terms,i=$d(e[0]).number,n=$d(e[1]).number,r=$d(e[2]).number;t.quaternion.setFromEuler(new qe(n,r,i,"YXZ"));const s=Gd(this.element.scale)[0].terms;t.scale.set(s[0].number,s[1].number,s[2].number)}updateBoundingBox(){const{model:t}=this;if(null==t)return;this.target.remove(t),this.findBakedShadows(t);const e=(t,e)=>t.expandByPoint(e);this.setBakedShadowVisibility(!1),this.boundingBox=Nu(t,e,new he),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((t=>this.unmarkBakedShadow(t))),this.boundingBox=Nu(t,e,new he)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(t)}async updateFraming(){const{model:t}=this;if(null==t)return;this.target.remove(t),this.setBakedShadowVisibility(!1);const{center:e}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,e.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(Nu(t,((t,i)=>Math.max(t,e.distanceToSquared(i))),0));this.idealAspect=Nu(t,((t,i)=>{i.sub(e);const n=Math.sqrt(i.x*i.x+i.z*i.z);return Math.max(t,n/(this.idealCameraDistance()-Math.abs(i.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(t)}setBakedShadowVisibility(t=this.shadowIntensity<=0){for(const e of this.bakedShadows)e.visible=t}idealCameraDistance(){const t=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(t)}adjustedFoV(t){const e=Math.tan(t/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(e)*180/Math.PI}getNDC(t,e){if(null!=this.xrCamera)yf.set(t/window.screen.width,e/window.screen.height);else{const i=this.element.getBoundingClientRect();yf.set((t-i.x)/this.width,(e-i.y)/this.height)}return yf.multiplyScalar(2).subScalar(1),yf.y*=-1,yf}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(t,e){this.element[uv].arRenderer.presentedScene!==this&&(this.environment=t,this.background=e,this.queueRender())}setTarget(t,e,i){this.goalTarget.set(-t,-e,-i)}setTargetDamperDecayTime(t){this.targetDamperX.setDecayTime(t),this.targetDamperY.setDecayTime(t),this.targetDamperZ.setDecayTime(t)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(t){const e=this.goalTarget,i=this.target.position;if(e.equals(i))return!1;{const n=this.boundingSphere.radius/10;let{x:r,y:s,z:a}=i;return r=this.targetDamperX.update(r,e.x,t,n),s=this.targetDamperY.update(s,e.y,t,n),a=this.targetDamperZ.update(a,e.z,t,n),this.target.position.set(r,s,a),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(t,e){const{x:i,z:n}=this.position;this.yaw=Math.atan2(t-i,e-n)}get model(){return this._model}set yaw(t){this.rotation.y=t,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(t){this.mixer.setTime(t),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const t=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop===it&&1==(1&t)?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(t){this.mixer.timeScale=t}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(t=null,e=0,i=2201,n=1/0){if(null==this._currentGLTF)return;const{animations:r}=this;if(null==r||0===r.length)return;let s=null;if(null!=t&&(s=this.animationsByName.get(t),null==s)){const e=parseInt(t);!isNaN(e)&&e>=0&&e<r.length&&(s=r[e])}null==s&&(s=r[0]);try{const{currentAnimationAction:t}=this,r=this.mixer.clipAction(s,this);this.currentAnimationAction=r,this.element.paused?this.mixer.stopAllAction():(r.paused=!1,null!=t&&r!==t?r.crossFadeFrom(t,e,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),r.setLoop(i,n),r.enabled=!0,r.clampWhenFinished=!0,r.play()}catch(t){console.error(t)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(t){this.mixer.update(t),this.queueShadowRender()}subscribeMixerEvent(t,e){this.mixer.addEventListener(t,e)}updateShadow(){const t=this.shadow;if(null!=t){const e="wall"===this.element.arPlacement?"back":"bottom";t.setScene(this,this.shadowSoftness,e),t.needsUpdate=!0}}renderShadow(t){const e=this.shadow;null!=e&&1==e.needsUpdate&&(e.render(t,this),e.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(t){if(this.shadowIntensity=t,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(t<=0&&null==this.shadow))){if(null==this.shadow){const t="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Af(this,this.shadowSoftness,t)}this.shadow.setIntensity(t)}}setShadowSoftness(t){this.shadowSoftness=t;const e=this.shadow;null!=e&&e.setSoftness(t)}setShadowOffset(t){const e=this.shadow;null!=e&&e.setOffset(t)}hitFromPoint(t,e=this){ff.setFromCamera(t,this.getCamera());return ff.intersectObject(e,!0).find((t=>t.object.visible&&!t.object.userData.shadow))}positionAndNormalFromPoint(t,e=this){var i;const n=this.hitFromPoint(t,e);if(null==n)return null;return{position:n.point,normal:null!=n.face?n.face.normal.clone().applyNormalMatrix((new Ft).getNormalMatrix(n.object.matrixWorld)):ff.ray.direction.clone().multiplyScalar(-1),uv:null!==(i=n.uv)&&void 0!==i?i:null}}surfaceFromPoint(t,e=this){const i=this.element.model;if(null==i)return null;const n=this.hitFromPoint(t,e);if(null==n||null==n.face)return null;const r=i[Hg](n),{meshes:s,primitives:a}=r.mesh.userData.associations,o=new ae,l=new ae,h=new ae,{a:c,b:u,c:d}=n.face,A=n.object;A.getVertexPosition(c,o),A.getVertexPosition(u,l),A.getVertexPosition(d,h);const p=new yi(o,l,h),m=new ae;return p.getBarycoord(A.worldToLocal(n.point),m),`${s} ${a} ${c} ${u} ${d} ${m.x.toFixed(3)} ${m.y.toFixed(3)} ${m.z.toFixed(3)}`}addHotspot(t){this.target.add(t),this.annotationRenderer.domElement.appendChild(t.element)}removeHotspot(t){this.target.remove(t)}forHotspots(t){const{children:e}=this.target;for(let i=0,n=e.length;i<n;i++){const n=e[i];n instanceof hf&&t(n)}}initializeSurface(t){if(null!=t.surface&&null==t.mesh){const e=Gd(t.surface)[0].terms;if(8!=e.length)return void console.warn(t.surface+" does not have exactly 8 numbers.");const i=this.element.model[zg](e[0].number,e[1].number),n=new ae(e[2].number,e[3].number,e[4].number);if(null==i)return void console.warn(t.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const r=i.mesh.geometry.attributes.position.count;if(n.x>=r||n.y>=r||n.z>=r)return void console.warn(t.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const s=new ae(e[5].number,e[6].number,e[7].number);t.mesh=i.mesh,t.tri=n,t.bary=s}}updateSurfaceHotspots(){const t=!this.element.paused;this.forHotspots((e=>{this.initializeSurface(e),e.updateSurface(t)}))}updateHotspotsVisibility(t){this.forHotspots((e=>{pf.copy(t),mf.setFromMatrixPosition(e.matrixWorld),pf.sub(mf),gf.copy(e.normal).transformDirection(this.target.matrixWorld),pf.dot(gf)<0?e.hide():e.show()}))}orientHotspots(t){this.forHotspots((e=>{e.orient(t)}))}setHotspotsVisibility(t){this.forHotspots((e=>{e.visible=t}))}updateSchema(t){var e;const{schemaElement:i,element:n}=this,{alt:r,poster:s,iosSrc:a}=n;if(null!=t){const n=[{"@type":"MediaObject",contentUrl:t,encodingFormat:"gltf"===(null===(e=t.split(".").pop())||void 0===e?void 0:e.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];a&&n.push({"@type":"MediaObject",contentUrl:a,encodingFormat:"model/vnd.usdz+zip"});const o={"@context":"http://schema.org/","@type":"3DModel",image:null!=s?s:void 0,name:null!=r?r:void 0,encoding:n};i.textContent=JSON.stringify(o),document.head.appendChild(i)}else null!=i.parentElement&&i.parentElement.removeChild(i)}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class _f extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0),e=>{let i;return i=Math.max(Ph(e,0,1),t.progress),i!==t.progress&&this.announceTotalProgress(t,i),t.progress}}announceTotalProgress(t,e){let i=0,n=0;1==e&&(t.completed=!0);for(const t of this.ongoingActivities){const{progress:e}=t;i+=1-e,!0===t.completed&&n++}const r=t.progress;t.progress=e,this.totalProgress+=(e-r)*(1-this.totalProgress)/i;const s=n===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:s}})),n===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Ef,wf,Cf,If,bf,Sf,Mf,Bf,Tf,Rf,Lf,Df,Qf,Pf=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Uf=document.createElement("canvas"),Nf=Symbol("fallbackResizeHandler"),Ff=Symbol("defaultAriaLabel"),kf=Symbol("resizeObserver"),Of=Symbol("clearModelTimeout"),Gf=Symbol("onContextLost"),Hf=Symbol("loaded"),zf=Symbol("status"),Vf=Symbol("onFocus"),Wf=Symbol("onBlur"),qf=Symbol("updateSize"),jf=Symbol("intersectionObserver"),Yf=Symbol("isElementInViewport"),Jf=Symbol("announceModelVisibility"),Xf=Symbol("ariaLabel"),Kf=Symbol("altDefaulted"),$f=Symbol("statusElement"),Zf=Symbol("updateStatus"),tv=Symbol("loadedTime"),ev=Symbol("updateSource"),iv=Symbol("markLoaded"),nv=Symbol("container"),rv=Symbol("input"),sv=Symbol("canvas"),av=Symbol("scene"),ov=Symbol("needsRender"),lv=Symbol("tick"),hv=Symbol("onModelLoad"),cv=Symbol("onResize"),uv=Symbol("renderer"),dv=Symbol("progressTracker"),Av=Symbol("getLoaded"),pv=Symbol("getModelIsVisible"),mv=Symbol("shouldAttemptPreload"),gv=t=>({x:t.x,y:t.y,z:t.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),fv=t=>({u:t.x,v:t.y,toString(){return`${this.u} ${this.v}`}});class vv extends Tl{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[Ef]=!1,this[wf]=!1,this[Cf]=0,this[If]="",this[bf]=null,this[Sf]=Qh((()=>{const t=this.getBoundingClientRect();this[qf](t)}),50),this[Mf]=Qh((t=>{const e=this.modelIsVisible;e!==t&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:e}}))}),0),this[Bf]=null,this[Tf]=null,this[Rf]=new _f,this[Lf]=()=>{this[$f].textContent=this[zf]},this[Df]=()=>{this[$f].textContent=""},this[Qf]=t=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:t.sourceEvent}}))},this.attachShadow({mode:"open"});const t=this.shadowRoot;let e,i;if((t=>{ph(zh,t)})(t),this[nv]=t.querySelector(".container"),this[rv]=t.querySelector(".userInput"),this[sv]=t.querySelector("canvas"),this[$f]=t.querySelector("#status"),this[Ff]=this[rv].getAttribute("aria-label"),this.isConnected){const t=this.getBoundingClientRect();e=t.width,i=t.height}else e=300,i=150;this[av]=new xf({canvas:this[sv],element:this,width:e,height:i}),Promise.resolve().then((()=>{this[qf](this.getBoundingClientRect())})),_h&&(this[kf]=new ResizeObserver((t=>{if(!this[uv].isPresenting)for(let e of t)e.target===this&&this[qf](e.contentRect)}))),Eh?this[jf]=new IntersectionObserver((t=>{for(let e of t)if(e.target===this){const t=this.modelIsVisible;this[Yf]=e.isIntersecting,this[Jf](t),this[Yf]&&!this.loaded&&this[ev]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[Yf]=!0}static get is(){return"model-viewer"}static set modelCacheSize(t){Bu[Su].evictionThreshold=t}static get modelCacheSize(){return Bu[Su].evictionThreshold}static set minimumRenderScale(t){t>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),t<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Im.singleton.minScale=t}static get minimumRenderScale(){return Im.singleton.minScale}get loaded(){return this[Av]()}get[(Ef=Yf,wf=Hf,Cf=tv,If=zf,bf=Of,Sf=Nf,Mf=Jf,Bf=kf,Tf=jf,Rf=dv,uv)](){return Im.singleton}get modelIsVisible(){return this[pv]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),_h?this[kf].observe(this):self.addEventListener("resize",this[Nf]),Eh&&this[jf].observe(this),this.addEventListener("focus",this[Vf]),this.addEventListener("blur",this[Wf]);const t=this[uv];t.addEventListener("contextlost",this[Gf]),t.registerScene(this[av]),null!=this[Of]&&(self.clearTimeout(this[Of]),this[Of]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),_h?this[kf].unobserve(this):self.removeEventListener("resize",this[Nf]),Eh&&this[jf].unobserve(this),this.removeEventListener("focus",this[Vf]),this.removeEventListener("blur",this[Wf]);const t=this[uv];t.removeEventListener("contextlost",this[Gf]),t.unregisterScene(this[av]),this[Of]=self.setTimeout((()=>{this[av].dispose(),this[Of]=null}),10)}updated(t){super.updated(t),t.has("src")&&(null==this.src?(this[Hf]=!1,this[tv]=0,this[av].reset()):this.src!==this[av].url&&(this[Hf]=!1,this[tv]=0,this[ev]())),t.has("alt")&&this[rv].setAttribute("aria-label",this[Xf]),t.has("withCredentials")&&(Bu.withCredentials=this.withCredentials,this[uv].textureUtils.withCredentials=this.withCredentials),t.has("generateSchema")&&(this.generateSchema?this[av].updateSchema(this.src):this[av].updateSchema(null))}toDataURL(t,e){return this[uv].displayCanvas(this[av]).toDataURL(t,e)}async toBlob(t){const e=t?t.mimeType:void 0,i=t?t.qualityArgument:void 0,n=t?t.idealAspect:void 0,{width:r,height:s,idealAspect:a,aspect:o}=this[av],{dpr:l,scaleFactor:h}=this[uv];let c=r*h*l,u=s*h*l,d=0,A=0;if(!0===n)if(a>o){const t=u;u=Math.round(c/a),A=(t-u)/2}else{const t=c;c=Math.round(u*a),d=(t-c)/2}Uf.width=c,Uf.height=u;try{return new Promise((async(t,n)=>(Uf.getContext("2d").drawImage(this[uv].displayCanvas(this[av]),d,A,c,u,0,0,c,u),!Uf.msToBlob||e&&"image/png"!==e?Uf.toBlob?void Uf.toBlob((e=>{if(!e)return n(new Error("Unable to retrieve canvas blob"));t(e)}),e,i):t(await(async t=>new Promise(((e,i)=>{const n=t.match(/data:(.*);/);if(!n)return i(new Error(`${t} is not a valid data Url`));const r=n[1],s=t.replace(/data:image\/\w+;base64,/,""),a=atob(s),o=[];for(let t=0;t<a.length;t+=512){const e=a.slice(t,t+512),i=new Array(e.length);for(let t=0;t<e.length;t++)i[t]=e.charCodeAt(t);const n=new Uint8Array(i);o.push(n)}e(new Blob(o,{type:r}))})))(Uf.toDataURL(e,i))):t(Uf.msToBlob()))))}finally{this[qf]({width:r,height:s})}}registerRenderer(t){this[av].externalRenderer=t}unregisterRenderer(){this[av].externalRenderer=null}get[Xf](){return this[Kf]}get[Kf](){return null==this.alt||"null"===this.alt?this[Ff]:this.alt}[Av](){return this[Hf]}[pv](){return this.loaded&&this[Yf]}[mv](){return!!this.src&&this[Yf]}[qf]({width:t,height:e}){0!==t&&0!==e&&(this[nv].style.width=`${t}px`,this[nv].style.height=`${e}px`,this[cv]({width:t,height:e}))}[lv](t,e){}[iv](){this[Hf]||(this[Hf]=!0,this[tv]=performance.now())}[ov](){this[av].queueRender()}[hv](){}[Zf](t){this[zf]=t;const e=this.getRootNode();null!=e&&e.activeElement===this&&this[$f].textContent!=t&&(this[$f].textContent=t)}[(Lf=Vf,Df=Wf,cv)](t){this[av].setSize(t.width,t.height)}async[(Qf=Gf,ev)](){const t=this[av];if(this.loaded||!this[mv]()||this.src===t.url)return;this.generateSchema&&t.updateSchema(this.src),this[Zf]("Loading"),t.stopAnimation();const e=this[dv].beginActivity(),i=this.src;try{const n=t.setSource(i,(t=>e(.95*Ph(t,0,1)))),r=this[Gh]();await Promise.all([n,r]),this[iv](),this[hv](),await new Promise((t=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:i}})),t()}))}))}))}catch(t){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:t}}))}finally{e(1)}}}Pf([e({type:String})],vv.prototype,"alt",void 0),Pf([e({type:String})],vv.prototype,"src",void 0),Pf([e({type:Boolean,attribute:"with-credentials"})],vv.prototype,"withCredentials",void 0),Pf([e({type:Boolean,attribute:"generate-schema"})],vv.prototype,"generateSchema",void 0);
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var yv=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const xv=Symbol("changeAnimation"),_v=Symbol("paused"),Ev={repetitions:1/0,pingpong:!1},wv=Symbol("hotspotMap"),Cv=Symbol("mutationCallback"),Iv=Symbol("observer"),bv=Symbol("addHotspot"),Sv=Symbol("removeHotspot"),Mv=new Ue;
/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.6.9
*/
var Bv=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(Bv(""))}catch(Ql){Bv=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Tv=Uint8Array,Rv=Uint16Array,Lv=Uint32Array,Dv=new Tv([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Qv=new Tv([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Pv=new Tv([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Uv=function(t,e){for(var i=new Rv(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var r=new Lv(i[30]);for(n=1;n<30;++n)for(var s=i[n];s<i[n+1];++s)r[s]=s-i[n]<<5|n;return[i,r]},Nv=Uv(Dv,2),Fv=Nv[0],kv=Nv[1];Fv[28]=258,kv[258]=28;for(var Ov=Uv(Qv,0)[1],Gv=new Rv(32768),Hv=0;Hv<32768;++Hv){var zv=(43690&Hv)>>>1|(21845&Hv)<<1;zv=(61680&(zv=(52428&zv)>>>2|(13107&zv)<<2))>>>4|(3855&zv)<<4,Gv[Hv]=((65280&zv)>>>8|(255&zv)<<8)>>>1}var Vv=function(t,e,i){for(var n=t.length,r=0,s=new Rv(e);r<n;++r)++s[t[r]-1];var a,o=new Rv(e);for(r=0;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;if(i){a=new Rv(1<<e);var l=15-e;for(r=0;r<n;++r)if(t[r])for(var h=r<<4|t[r],c=e-t[r],u=o[t[r]-1]++<<c,d=u|(1<<c)-1;u<=d;++u)a[Gv[u]>>>l]=h}else for(a=new Rv(n),r=0;r<n;++r)t[r]&&(a[r]=Gv[o[t[r]-1]++]>>>15-t[r]);return a},Wv=new Tv(288);for(Hv=0;Hv<144;++Hv)Wv[Hv]=8;for(Hv=144;Hv<256;++Hv)Wv[Hv]=9;for(Hv=256;Hv<280;++Hv)Wv[Hv]=7;for(Hv=280;Hv<288;++Hv)Wv[Hv]=8;var qv=new Tv(32);for(Hv=0;Hv<32;++Hv)qv[Hv]=5;var jv=Vv(Wv,9,0),Yv=Vv(qv,5,0),Jv=function(t){return(t/8|0)+(7&t&&1)},Xv=function(t,e,i){(null==e||e<0)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Rv?Rv:t instanceof Lv?Lv:Tv)(i-e);return n.set(t.subarray(e,i)),n},Kv=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>>8},$v=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>>8,t[n+2]|=i>>>16},Zv=function(t,e){for(var i=[],n=0;n<t.length;++n)t[n]&&i.push({s:n,f:t[n]});var r=i.length,s=i.slice();if(!r)return[ay,0];if(1==r){var a=new Tv(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var o=i[0],l=i[1],h=0,c=1,u=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=r-1;)o=i[i[h].f<i[u].f?h++:u++],l=i[h!=c&&i[h].f<i[u].f?h++:u++],i[c++]={s:-1,f:o.f+l.f,l:o,r:l};var d=s[0].s;for(n=1;n<r;++n)s[n].s>d&&(d=s[n].s);var A=new Rv(d+1),p=ty(i[c-1],A,0);if(p>e){n=0;var m=0,g=p-e,f=1<<g;for(s.sort((function(t,e){return A[e.s]-A[t.s]||t.f-e.f}));n<r;++n){var v=s[n].s;if(!(A[v]>e))break;m+=f-(1<<p-A[v]),A[v]=e}for(m>>>=g;m>0;){var y=s[n].s;A[y]<e?m-=1<<e-A[y]++-1:++n}for(;n>=0&&m;--n){var x=s[n].s;A[x]==e&&(--A[x],++m)}p=e}return[new Tv(A),p]},ty=function(t,e,i){return-1==t.s?Math.max(ty(t.l,e,i+1),ty(t.r,e,i+1)):e[t.s]=i},ey=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Rv(++e),n=0,r=t[0],s=1,a=function(t){i[n++]=t},o=1;o<=e;++o)if(t[o]==r&&o!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=t[o]}return[i.subarray(0,n),e]},iy=function(t,e){for(var i=0,n=0;n<e.length;++n)i+=t[n]*e[n];return i},ny=function(t,e,i){var n=i.length,r=Jv(e+2);t[r]=255&n,t[r+1]=n>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;s<n;++s)t[r+s+4]=i[s];return 8*(r+4+n)},ry=function(t,e,i,n,r,s,a,o,l,h,c){Kv(e,c++,i),++r[256];for(var u=Zv(r,15),d=u[0],A=u[1],p=Zv(s,15),m=p[0],g=p[1],f=ey(d),v=f[0],y=f[1],x=ey(m),_=x[0],E=x[1],w=new Rv(19),C=0;C<v.length;++C)w[31&v[C]]++;for(C=0;C<_.length;++C)w[31&_[C]]++;for(var I=Zv(w,7),b=I[0],S=I[1],M=19;M>4&&!b[Pv[M-1]];--M);var B,T,R,L,D=h+5<<3,Q=iy(r,Wv)+iy(s,qv)+a,P=iy(r,d)+iy(s,m)+a+14+3*M+iy(w,b)+(2*w[16]+3*w[17]+7*w[18]);if(D<=Q&&D<=P)return ny(e,c,t.subarray(l,l+h));if(Kv(e,c,1+(P<Q)),c+=2,P<Q){B=Vv(d,A,0),T=d,R=Vv(m,g,0),L=m;var U=Vv(b,S,0);Kv(e,c,y-257),Kv(e,c+5,E-1),Kv(e,c+10,M-4),c+=14;for(C=0;C<M;++C)Kv(e,c+3*C,b[Pv[C]]);c+=3*M;for(var N=[v,_],F=0;F<2;++F){var k=N[F];for(C=0;C<k.length;++C){var O=31&k[C];Kv(e,c,U[O]),c+=b[O],O>15&&(Kv(e,c,k[C]>>>5&127),c+=k[C]>>>12)}}}else B=jv,T=Wv,R=Yv,L=qv;for(C=0;C<o;++C)if(n[C]>255){O=n[C]>>>18&31;$v(e,c,B[O+257]),c+=T[O+257],O>7&&(Kv(e,c,n[C]>>>23&31),c+=Dv[O]);var G=31&n[C];$v(e,c,R[G]),c+=L[G],G>3&&($v(e,c,n[C]>>>5&8191),c+=Qv[G])}else $v(e,c,B[n[C]]),c+=T[n[C]];return $v(e,c,B[256]),c+T[256]},sy=new Lv([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ay=new Tv(0),oy=function(){for(var t=new Lv(256),e=0;e<256;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ly=function(){var t=-1;return{p:function(e){for(var i=t,n=0;n<e.length;++n)i=oy[255&i^e[n]]^i>>>8;t=i},d:function(){return~t}}},hy=function(t,e,i,n,r){return function(t,e,i,n,r,s){var a=t.length,o=new Tv(n+a+5*(1+Math.ceil(a/7e3))+r),l=o.subarray(n,o.length-r),h=0;if(!e||a<8)for(var c=0;c<=a;c+=65535){var u=c+65535;u<a?h=ny(l,h,t.subarray(c,u)):(l[c]=s,h=ny(l,h,t.subarray(c,a)))}else{for(var d=sy[e-1],A=d>>>13,p=8191&d,m=(1<<i)-1,g=new Rv(32768),f=new Rv(m+1),v=Math.ceil(i/3),y=2*v,x=function(e){return(t[e]^t[e+1]<<v^t[e+2]<<y)&m},_=new Lv(25e3),E=new Rv(288),w=new Rv(32),C=0,I=0,b=(c=0,0),S=0,M=0;c<a;++c){var B=x(c),T=32767&c,R=f[B];if(g[T]=R,f[B]=T,S<=c){var L=a-c;if((C>7e3||b>24576)&&L>423){h=ry(t,l,0,_,E,w,I,b,M,c-M,h),b=C=I=0,M=c;for(var D=0;D<286;++D)E[D]=0;for(D=0;D<30;++D)w[D]=0}var Q=2,P=0,U=p,N=T-R&32767;if(L>2&&B==x(c-N))for(var F=Math.min(A,L)-1,k=Math.min(32767,c),O=Math.min(258,L);N<=k&&--U&&T!=R;){if(t[c+Q]==t[c+Q-N]){for(var G=0;G<O&&t[c+G]==t[c+G-N];++G);if(G>Q){if(Q=G,P=N,G>F)break;var H=Math.min(N,G-2),z=0;for(D=0;D<H;++D){var V=c-N+D+32768&32767,W=V-g[V]+32768&32767;W>z&&(z=W,R=V)}}}N+=(T=R)-(R=g[T])+32768&32767}if(P){_[b++]=268435456|kv[Q]<<18|Ov[P];var q=31&kv[Q],j=31&Ov[P];I+=Dv[q]+Qv[j],++E[257+q],++w[j],S=c+Q,++C}else _[b++]=t[c],++E[t[c]]}}h=ry(t,l,s,_,E,w,I,b,M,c-M,h),!s&&7&h&&(h=ny(l,h+1,ay))}return Xv(o,0,n+Jv(h)+r)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,i,n,!r)},cy=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i},uy=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function dy(t,e){return hy(t,e||{},0,0)}var Ay=function(t,e,i,n){for(var r in t){var s=t[r],a=e+r;s instanceof Tv?i[a]=[s,n]:Array.isArray(s)?i[a]=[s[0],cy(n,s[1])]:Ay(s,a+"/",i,n)}},py="undefined"!=typeof TextEncoder&&new TextEncoder,my="undefined"!=typeof TextDecoder&&new TextDecoder;try{my.decode(ay,{stream:!0}),1}catch(Ql){}function gy(t,e){if(e){for(var i=new Tv(t.length),n=0;n<t.length;++n)i[n]=t.charCodeAt(n);return i}if(py)return py.encode(t);var r=t.length,s=new Tv(t.length+(t.length>>1)),a=0,o=function(t){s[a++]=t};for(n=0;n<r;++n){if(a+5>s.length){var l=new Tv(a+8+(r-n<<1));l.set(s),s=l}var h=t.charCodeAt(n);h<128||e?o(h):h<2048?(o(192|h>>6),o(128|63&h)):h>55295&&h<57344?(o(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++n))>>18),o(128|h>>12&63),o(128|h>>6&63),o(128|63&h)):(o(224|h>>12),o(128|h>>6&63),o(128|63&h))}return Xv(s,0,a)}var fy=function(t){var e=0;if(t)for(var i in t){var n=t[i].length;if(n>65535)throw"extra field too long";e+=n+4}return e},vy=function(t,e,i,n,r,s,a,o){var l=n.length,h=i.extra,c=o&&o.length,u=fy(h);uy(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=i.os),t[e]=20,e+=2,t[e++]=i.flag<<1|(null==s&&8),t[e++]=r&&8,t[e++]=255&i.compression,t[e++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),A=d.getFullYear()-1980;if(A<0||A>119)throw"date not in range 1980-2099";if(uy(t,e,A<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),e+=4,null!=s&&(uy(t,e,i.crc),uy(t,e+4,s),uy(t,e+8,i.size)),uy(t,e+12,l),uy(t,e+14,u),e+=16,null!=a&&(uy(t,e,c),uy(t,e+6,i.attrs),uy(t,e+10,a),e+=14),t.set(n,e),e+=l,u)for(var p in h){var m=h[p],g=m.length;uy(t,e,+p),uy(t,e+2,g),t.set(m,e+4),e+=4+g}return c&&(t.set(o,e),e+=c),e};function yy(t,e){e||(e={});var i={},n=[];Ay(t,"",i,e);var r=0,s=0;for(var a in i){var o=i[a],l=o[0],h=o[1],c=0==h.level?0:8,u=(w=gy(a)).length,d=h.comment,A=d&&gy(d),p=A&&A.length,m=fy(h.extra);if(u>65535)throw"filename too long";var g=c?dy(l,h):l,f=g.length,v=ly();v.p(l),n.push(cy(h,{size:l.length,crc:v.d(),c:g,f:w,m:A,u:u!=a.length||A&&d.length!=p,o:r,compression:c})),r+=30+u+m+f,s+=76+2*(u+m)+(p||0)+f}for(var y=new Tv(s+22),x=r,_=s-r,E=0;E<n.length;++E){var w=n[E];vy(y,w.o,w,w.f,w.u,w.c.length);var C=30+w.f.length+fy(w.extra);y.set(w.c,w.o+C),vy(y,r,w,w.f,w.u,w.c.length,w.o,w.m),r+=16+C+(w.m?w.m.length:0)}return function(t,e,i,n,r){uy(t,e,101010256),uy(t,e+8,i),uy(t,e+10,i),uy(t,e+12,n),uy(t,e+16,r)}(y,r,n.length,_,x),y}class xy{async parse(t,e={}){e=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}}},e);const i={},n="model.usda";i[n]=null;let r=wy();r+=function(t){return`def Xform "Root"\n{\n    def Scope "Scenes" (\n        kind = "sceneLibrary"\n    )\n    {\n        def Xform "Scene" (\n            customData = {\n                bool preliminary_collidesWithEnvironment = 0\n                string sceneName = "Scene"\n            }\n            sceneName = "Scene"\n        )\n        {\n        token preliminary:anchoring:type = "${t.ar.anchoring.type}"\n        token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"\n\n`}(e);const s={},a={};t.traverseVisible((t=>{if(t.isMesh){const e=t.geometry,n=t.material;if(n.isMeshStandardMaterial){const a="geometries/Geometry_"+e.id+".usd";if(!(a in i)){const t=function(t){const e=function(t){const e="Geometry",i=t.attributes,n=i.position.count;return`\n    def Mesh "${e}"\n    {\n        int[] faceVertexCounts = [${function(t){const e=null!==t.index?t.index.count:t.attributes.position.count;return Array(e/3).fill(3).join(", ")}(t)}]\n        int[] faceVertexIndices = [${function(t){const e=t.index,i=[];if(null!==e)for(let t=0;t<e.count;t++)i.push(e.getX(t));else{const e=t.attributes.position.count;for(let t=0;t<e;t++)i.push(t)}return i.join(", ")}(t)}]\n        normal3f[] normals = [${by(i.normal,n)}] (\n            interpolation = "vertex"\n        )\n        point3f[] points = [${by(i.position,n)}]\n        float2[] primvars:st = [${function(t,e){if(void 0===t)return console.warn("USDZExporter: UVs missing."),Array(e).fill("(0, 0)").join(", ");const i=[];for(let e=0;e<t.count;e++){const n=t.getX(e),r=t.getY(e);i.push(`(${n.toPrecision(Ey)}, ${1-r.toPrecision(Ey)})`)}return i.join(", ")}(i.uv,n)}] (\n            interpolation = "vertex"\n        )\n        uniform token subdivisionScheme = "none"\n    }\n`}(t);return`\ndef "Geometry"\n{\n  ${e}\n}\n`}(e);i[a]=function(t){let e=wy();return e+=t,gy(e)}(t)}n.uuid in s||(s[n.uuid]=n),r+=function(t,e,i){const n="Object_"+t.id,r=Cy(t.matrixWorld);t.matrixWorld.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",t);return`def Xform "${n}" (\n    prepend references = @./geometries/Geometry_${e.id}.usd@</Geometry>\n)\n{\n    matrix4d xformOp:transform = ${r}\n    uniform token[] xformOpOrder = ["xformOp:transform"]\n\n    rel material:binding = </Materials/Material_${i.id}>\n}\n\n`}(t,e,n)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",t)}else t.isCamera&&(r+=function(t){const e=t.name?t.name:"Camera_"+t.id,i=Cy(t.matrixWorld);t.matrixWorld.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",t);return t.isOrthographicCamera?`def Camera "${e}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${i}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\t\n\t\t\tfloat2 clippingRange = (${t.near.toPrecision(Ey)}, ${t.far.toPrecision(Ey)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(t.left)+Math.abs(t.right))).toPrecision(Ey)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(t.top)+Math.abs(t.bottom))).toPrecision(Ey)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${e}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${i}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\t\n\t\t\tfloat2 clippingRange = (${t.near.toPrecision(Ey)}, ${t.far.toPrecision(Ey)})\n\t\t\tfloat focalLength = ${t.getFocalLength().toPrecision(Ey)}\n\t\t\tfloat focusDistance = ${t.focus.toPrecision(Ey)}\n\t\t\tfloat horizontalAperture = ${t.getFilmWidth().toPrecision(Ey)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${t.getFilmHeight().toPrecision(Ey)}\n\t\t}\n\t\n\t`}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t))})),r+="\n        }\n    }\n}\n\n",r+=function(t,e){const i=[];for(const n in t){const r=t[n];i.push(Sy(r,e))}return`def "Materials"\n{\n${i.join("")}\n}\n\n`}(s,a),i[n]=gy(r),r=null;for(const t in a){const e=a[t],n=t.split("_")[1],r=1023===e.format,s=_y(e.image,n,e.flipY),o=await new Promise((t=>s.toBlob(t,r?"image/png":"image/jpeg",1)));i[`textures/Texture_${t}.${r?"png":"jpg"}`]=new Uint8Array(await o.arrayBuffer())}let o=0;for(const t in i){const e=i[t];o+=34+t.length;const n=63&o;if(4!==n){const r=new Uint8Array(64-n);i[t]=[e,{extra:{12345:r}}]}o=e.length}return yy(i,{level:0})}}function _y(t,e,i){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=1024/Math.max(t.width,t.height),r=document.createElement("canvas");r.width=t.width*Math.min(1,n),r.height=t.height*Math.min(1,n);const s=r.getContext("2d");if(!0===i&&(s.translate(0,r.height),s.scale(1,-1)),s.drawImage(t,0,0,r.width,r.height),void 0!==e){const t=parseInt(e,16),i=(t>>16&255)/255,n=(t>>8&255)/255,a=(255&t)/255,o=s.getImageData(0,0,r.width,r.height),l=o.data;for(let t=0;t<l.length;t+=4)l[t+0]=l[t+0]*i,l[t+1]=l[t+1]*n,l[t+2]=l[t+2]*a;s.putImageData(o,0,0)}return r}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const Ey=7;function wy(){return'#usda 1.0\n(\n    customLayerData = {\n        string creator = "Three.js USDZExporter"\n    }\n    metersPerUnit = 1\n    upAxis = "Y"\n)\n\n'}function Cy(t){const e=t.elements;return`( ${Iy(e,0)}, ${Iy(e,4)}, ${Iy(e,8)}, ${Iy(e,12)} )`}function Iy(t,e){return`(${t[e+0]}, ${t[e+1]}, ${t[e+2]}, ${t[e+3]})`}function by(t,e){if(void 0===t)return console.warn("USDZExporter: Normals missing."),Array(e).fill("(0, 0, 0)").join(", ");const i=[];for(let e=0;e<t.count;e++){const n=t.getX(e),r=t.getY(e),s=t.getZ(e);i.push(`(${n.toPrecision(Ey)}, ${r.toPrecision(Ey)}, ${s.toPrecision(Ey)})`)}return i.join(", ")}function Sy(t,e){const i="            ",n=[],r=[];function s(i,n,r){const s=i.id+(r?"_"+r.getHexString():""),a=1023===i.format;return e[s]=i,`\n        def Shader "Transform2d_${n}" (\n            sdrMetadata = {\n                string role = "math"\n            }\n        )\n        {\n            uniform token info:id = "UsdTransform2d"\n            float2 inputs:in.connect = </Materials/Material_${t.id}/uvReader_st.outputs:result>\n            float2 inputs:scale = ${By(i.repeat)}\n            float2 inputs:translation = ${By(i.offset)}\n            float2 outputs:result\n        }\n\n        def Shader "Texture_${i.id}_${n}"\n        {\n            uniform token info:id = "UsdUVTexture"\n            asset inputs:file = @textures/Texture_${s}.${a?"png":"jpg"}@\n            float2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${n}.outputs:result>\n            token inputs:wrapS = "repeat"\n            token inputs:wrapT = "repeat"\n            float outputs:r\n            float outputs:g\n            float outputs:b\n            float3 outputs:rgb\n            ${t.transparent||t.alphaTest>0?"float outputs:a":""}\n        }`}return t.side===h&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",t),null!==t.map?(n.push(`${i}color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`),t.transparent?n.push(`${i}float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`):t.alphaTest>0&&(n.push(`${i}float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`),n.push(`${i}float inputs:opacityThreshold = ${t.alphaTest}`)),r.push(s(t.map,"diffuse",t.color))):n.push(`${i}color3f inputs:diffuseColor = ${My(t.color)}`),null!==t.emissiveMap?(n.push(`${i}color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`),r.push(s(t.emissiveMap,"emissive"))):t.emissive.getHex()>0&&n.push(`${i}color3f inputs:emissiveColor = ${My(t.emissive)}`),null!==t.normalMap&&(n.push(`${i}normal3f inputs:normal.connect = </Materials/Material_${t.id}/Texture_${t.normalMap.id}_normal.outputs:rgb>`),r.push(s(t.normalMap,"normal"))),null!==t.aoMap&&(n.push(`${i}float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`),r.push(s(t.aoMap,"occlusion"))),null!==t.roughnessMap&&1===t.roughness?(n.push(`${i}float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`),r.push(s(t.roughnessMap,"roughness"))):n.push(`${i}float inputs:roughness = ${t.roughness}`),null!==t.metalnessMap&&1===t.metalness?(n.push(`${i}float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`),r.push(s(t.metalnessMap,"metallic"))):n.push(`${i}float inputs:metallic = ${t.metalness}`),null!==t.alphaMap?(n.push(`${i}float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.alphaMap.id}_opacity.outputs:r>`),n.push(`${i}float inputs:opacityThreshold = 0.0001`),r.push(s(t.alphaMap,"opacity"))):n.push(`${i}float inputs:opacity = ${t.opacity}`),t.isMeshPhysicalMaterial&&(n.push(`${i}float inputs:clearcoat = ${t.clearcoat}`),n.push(`${i}float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`),n.push(`${i}float inputs:ior = ${t.ior}`)),`\n    def Material "Material_${t.id}"\n    {\n        def Shader "PreviewSurface"\n        {\n            uniform token info:id = "UsdPreviewSurface"\n${n.join("\n")}\n            int inputs:useSpecularWorkflow = 0\n            token outputs:surface\n        }\n\n        token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>\n        token inputs:frame:stPrimvarName = "st"\n\n        def Shader "uvReader_st"\n        {\n            uniform token info:id = "UsdPrimvarReader_float2"\n            token inputs:varname.connect = </Materials/Material_${t.id}.inputs:frame:stPrimvarName>\n            float2 inputs:fallback = (0.0, 0.0)\n            float2 outputs:result\n        }\n\n${r.join("\n")}\n\n    }\n`}function My(t){return`(${t.r}, ${t.g}, ${t.b})`}function By(t){return`(${t.x}, ${t.y})`}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var Ty=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Ry=!1,Ly=!1;const Dy="#model-viewer-no-ar-fallback",Qy=(Py=["quick-look","scene-viewer","webxr","none"],t=>{try{const e=Gd(t),i=(e.length?e[0].terms:[]).filter((t=>t&&"ident"===t.type)).map((t=>t.value)).filter((t=>Py.indexOf(t)>-1)),n=new Set;for(const t of i)n.add(t);return n}catch(t){}return new Set});var Py;const Uy="quick-look",Ny="scene-viewer",Fy="webxr",ky="none",Oy=Symbol("arButtonContainer"),Gy=Symbol("enterARWithWebXR"),Hy=Symbol("openSceneViewer"),zy=Symbol("openIOSARQuickLook"),Vy=Symbol("canActivateAR"),Wy=Symbol("arMode"),qy=Symbol("arModes"),jy=Symbol("arAnchor"),Yy=Symbol("preload"),Jy=Symbol("onARButtonContainerClick"),Xy=Symbol("onARStatus"),Ky=Symbol("onARTracking"),$y=Symbol("onARTap"),Zy=Symbol("selectARMode"),tx=Symbol("triggerLoad");
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var ex=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const ix="auto",nx="auto",rx="eager",sx=Symbol("defaultProgressBarElement"),ax=Symbol("posterContainerElement"),ox=Symbol("defaultPosterElement"),lx=Symbol("shouldDismissPoster"),hx=Symbol("hidePoster"),cx=Symbol("modelIsRevealed"),ux=Symbol("updateProgressBar"),dx=Symbol("ariaLabelCallToAction"),Ax=Symbol("onProgress");
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var px=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const mx=Math.PI/32,gx={basis:[Xd(Od(mx,"rad"))],keywords:{auto:[null]}},fx=Symbol("autoRotateStartTime"),vx=Symbol("radiansPerSecond"),yx=Symbol("syncRotationRate"),xx=Symbol("onCameraChange"),_x=(t=>{var e,i,n;class r extends t{constructor(){super(...arguments),this[e]=new Map,this[i]=t=>{t.forEach((t=>{t instanceof MutationRecord&&"childList"!==t.type||(t.addedNodes.forEach((t=>{this[bv](t)})),t.removedNodes.forEach((t=>{this[Sv](t)})),this[ov]())}))},this[n]=new MutationObserver(this[Cv])}connectedCallback(){super.connectedCallback();for(let t=0;t<this.children.length;++t)this[bv](this.children[t]);const{ShadyDOM:t}=self;null==t?this[Iv].observe(this,{childList:!0}):this[Iv]=t.observeChildren(this,this[Cv])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:t}=self;null==t?this[Iv].disconnect():t.unobserveChildren(this[Iv])}[(e=wv,i=Cv,n=Iv,lv)](t,e){super[lv](t,e);const i=this[av],{annotationRenderer:n}=i,r=i.getCamera();i.shouldRender()&&(i.updateSurfaceHotspots(),i.updateHotspotsVisibility(r.position),n.domElement.style.display="",n.render(i,r))}updateHotspot(t){const e=this[wv].get(t.name);null!=e&&(e.updatePosition(t.position),e.updateNormal(t.normal),e.surface=t.surface,this[ov]())}queryHotspot(t){const e=this[wv].get(t);if(null==e)return null;const i=gv(e.position),n=gv(e.normal),r=e.facingCamera,s=this[av],a=s.getCamera(),o=new ae;o.setFromMatrixPosition(e.matrixWorld),o.project(a);const l=s.width/2,h=s.height/2;o.x=o.x*l+l,o.y=-o.y*h+h;const c=gv(new ae(o.x,o.y,o.z));return Number.isFinite(c.x)&&Number.isFinite(c.y)?{position:i,normal:n,canvasPosition:c,facingCamera:r}:null}positionAndNormalFromPoint(t,e){const i=this[av],n=i.getNDC(t,e),r=i.positionAndNormalFromPoint(n);if(null==r)return null;Mv.copy(i.target.matrixWorld).invert();const s=gv(r.position.applyMatrix4(Mv)),a=gv(r.normal.transformDirection(Mv));let o=null;return null!=r.uv&&(o=fv(r.uv)),{position:s,normal:a,uv:o}}surfaceFromPoint(t,e){const i=this[av],n=i.getNDC(t,e);return i.surfaceFromPoint(n)}[bv](t){if(!(t instanceof HTMLElement&&0===t.slot.indexOf("hotspot")))return;let e=this[wv].get(t.slot);null!=e?e.increment():(e=new hf({name:t.slot,position:t.dataset.position,normal:t.dataset.normal,surface:t.dataset.surface}),this[wv].set(t.slot,e),this[av].addHotspot(e)),this[av].queueRender()}[Sv](t){if(!(t instanceof HTMLElement))return;const e=this[wv].get(t.slot);e&&(e.decrement()&&(this[av].removeHotspot(e),this[wv].delete(t.slot)),this[av].queueRender())}}return r})((t=>{var i,n,r;class s extends t{constructor(){super(...arguments),this[i]=void 0,this[n]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[Zg]}get availableVariants(){return this.model?this.model[Wg]():[]}get originalGltfJson(){return this[$g]}[(i=Zg,n=Kg,r=$g,tf)](){return()=>{this[ov]()}}[ef](t){return t.encoding=At,t.wrapS=I,t.wrapT=I,new qm(this[tf](),t)}async createTexture(t,e="image/png"){const{textureUtils:i}=this[uv],n=await i.loadImage(t);return n.userData.mimeType=e,this[ef](n)}async createLottieTexture(t,e=1){const{textureUtils:i}=this[uv],n=await i.loadLottie(t,e);return this[ef](n)}createVideoTexture(t){const e=document.createElement("video");e.src=t,e.muted=!0,e.playsInline=!0,e.loop=!0,e.play();const i=new eo(e);return this[ef](i)}createCanvasTexture(){const t=document.createElement("canvas"),e=new ro(t);return this[ef](e)}async updated(t){if(super.updated(t),t.has("variantName")){const t=this[dv].beginActivity();t(.1);const e=this[Zg],{variantName:i}=this;null!=e&&(await e[Og](i),this[ov](),this.dispatchEvent(new CustomEvent("variant-applied"))),t(1)}if(t.has("orientation")||t.has("scale")){if(!this.loaded)return;const t=this[av];t.applyTransform(),t.updateBoundingBox(),t.updateShadow(),this[uv].arRenderer.onUpdateScene(),this[ov]()}}[hv](){super[hv]();const{currentGLTF:t}=this[av];if(null!=t){const{correlatedSceneGraph:e}=t;null!=e&&t!==this[Kg]&&(this[Zg]=new Jg(e,this[tf]()),this[$g]=JSON.parse(JSON.stringify(e.gltf))),"variants"in t.userData&&this.requestUpdate("variantName")}this[Kg]=t}async exportScene(t){const e=this[av];return new Promise((async(i,n)=>{const r={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(r,t),r.animations=e.animations,r.truncateDrawRange=!0;const s=e.shadow;let a=!1;null!=s&&(a=s.visible,s.visible=!1),await this[Zg][kg]();(new ku).register((t=>new Rd(t))).parse(e.model,(t=>i(new Blob([r.binary?t:JSON.stringify(t)],{type:r.binary?"application/octet-stream":"application/json"}))),(()=>n("glTF export failed")),r),null!=s&&(s.visible=a)}))}materialFromPoint(t,e){const i=this[Zg];if(null==i)return null;const n=this[av],r=n.getNDC(t,e),s=n.hitFromPoint(r);return null==s||null==s.face?null:i[Gg](s)}}return Xg([e({type:String,attribute:"variant-name"})],s.prototype,"variantName",void 0),Xg([e({type:String,attribute:"orientation"})],s.prototype,"orientation",void 0),Xg([e({type:String,attribute:"scale"})],s.prototype,"scale",void 0),s})((t=>{var i,n,r;class s extends t{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[i]=performance.now(),this[n]=0,this[r]=t=>{this.autoRotate&&"user-interaction"===t.detail.source&&(this[fx]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[xx]),this[fx]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[xx]),this[fx]=performance.now()}updated(t){super.updated(t),t.has("autoRotate")&&(this[fx]=performance.now())}[(i=fx,n=vx,yx)](t){this[vx]=t[0]}[lv](t,e){if(super[lv](t,e),!this.autoRotate||!this[pv]()||this[uv].isPresenting)return;const i=Math.min(e,t-this[fx]-this.autoRotateDelay);i>0&&(this[av].yaw=this.turntableRotation+this[vx]*i*.001)}get turntableRotation(){return this[av].yaw}resetTurntableRotation(t=0){this[av].yaw=t}}return r=xx,px([e({type:Boolean,attribute:"auto-rotate"})],s.prototype,"autoRotate",void 0),px([e({type:Number,attribute:"auto-rotate-delay"})],s.prototype,"autoRotateDelay",void 0),px([UA({intrinsics:gx,updateHandler:yx}),e({type:String,attribute:"rotation-per-second"})],s.prototype,"rotationPerSecond",void 0),s})((t=>{var i,n,r;class s extends t{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this[i]=null,this[n]=null,this[r]=null}updated(t){super.updated(t),t.has("shadowIntensity")&&(this[av].setShadowIntensity(.5*this.shadowIntensity),this[ov]()),t.has("shadowSoftness")&&(this[av].setShadowSoftness(this.shadowSoftness),this[ov]()),t.has("exposure")&&(this[av].exposure=this.exposure,this[ov]()),(t.has("environmentImage")||t.has("skyboxImage"))&&this[mv]()&&this[Gh]()}hasBakedShadow(){return this[av].bakedShadows.size>0}async[(i=kh,n=Oh,r=Hh,Gh)](){const{skyboxImage:t,environmentImage:e}=this;null!=this[Hh]&&(this[Hh](),this[Hh]=null);const{textureUtils:i}=this[uv];if(null==i)return;const n=this[dv].beginActivity();try{const{environmentMap:r,skybox:s}=await i.generateEnvironmentMapAndSkybox(Rh(t),e,(t=>n(Ph(t,0,1))));this[kh]!==r&&(this[kh]=r,this.dispatchEvent(new CustomEvent("environment-change"))),this[Oh]=null!=s?s.name===r.name?r:s:null,this[av].setEnvironmentAndSkybox(this[kh],this[Oh]),this[av].dispatchEvent({type:"envmap-update"})}catch(t){if(t instanceof Error)throw this[av].setEnvironmentAndSkybox(null,null),t}finally{n(1)}}}return Fh([e({type:String,attribute:"environment-image"})],s.prototype,"environmentImage",void 0),Fh([e({type:String,attribute:"skybox-image"})],s.prototype,"skyboxImage",void 0),Fh([e({type:Number,attribute:"shadow-intensity"})],s.prototype,"shadowIntensity",void 0),Fh([e({type:Number,attribute:"shadow-softness"})],s.prototype,"shadowSoftness",void 0),Fh([e({type:Number})],s.prototype,"exposure",void 0),s})((t=>{var i,n,r,s,a,o,l,h,c,u,d,A,p,m,g,f,v;class y extends t{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=zA,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=qA,this.interactionPromptStyle=YA,this.orbitSensitivity=1,this.touchAction=JA,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this[i]=this.shadowRoot.querySelector(".interaction-prompt"),this[n]=this.shadowRoot.querySelector("#prompt"),this[r]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[s]=this.shadowRoot.querySelector(".pan-target"),this[a]=0,this[o]=1/0,this[l]=!1,this[h]=!1,this[c]=Fp.AUTOMATIC,this[u]=new kp(this[av].camera,this[rv],this[av]),this[d]=new ml,this[A]=!1,this[p]=!1,this[m]=!1,this[g]=()=>{const t=this[ap].changeSource;this[_p]=t,t===Fp.USER_INTERACTION&&(this[vp]=!0,this[up]())},this[f]=()=>{this[dp](),this[ov]();const t=this[ap].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))},this[v]=t=>{"pointer-change-start"===t.type?this[nv].classList.add("pointer-tumbling"):this[nv].classList.remove("pointer-tumbling")}}get inputSensitivity(){return this[ap].inputSensitivity}set inputSensitivity(t){this[ap].inputSensitivity=t}getCameraOrbit(){const{theta:t,phi:e,radius:i}=this[Ep];return{theta:t,phi:e,radius:i,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return gv(this[uv].isPresenting?this[uv].arRenderer.target:this[av].getTarget())}getFieldOfView(){return this[ap].getFieldOfView()}getMinimumFieldOfView(){return this[ap].options.minimumFieldOfView}getMaximumFieldOfView(){return this[ap].options.maximumFieldOfView}getIdealAspect(){return this[av].idealAspect}jumpCameraToGoal(){this[wp]=!0,this.requestUpdate(wp,!1)}resetInteractionPrompt(){this[xp]=0,this[yp]=1/0,this[vp]=!1,this[fp]=this.interactionPrompt===qA&&this.cameraControls}zoom(t){const e=new WheelEvent("wheel",{deltaY:-30*t});this[rv].dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this[ap].addEventListener("user-interaction",this[pp]),this[ap].addEventListener("pointer-change-start",this[gp]),this[ap].addEventListener("pointer-change-end",this[gp])}disconnectedCallback(){super.disconnectedCallback(),this[ap].removeEventListener("user-interaction",this[pp]),this[ap].removeEventListener("pointer-change-start",this[gp]),this[ap].removeEventListener("pointer-change-end",this[gp])}updated(t){super.updated(t);const e=this[ap],i=this[av];if(t.has("cameraControls")&&(this.cameraControls?(e.enableInteraction(),this.interactionPrompt===qA&&(this[fp]=!0)):(e.disableInteraction(),this[up]()),this[rv].setAttribute("aria-label",this[Xf])),t.has("disableZoom")&&(e.disableZoom=this.disableZoom),t.has("disablePan")&&(e.enablePan=!this.disablePan),t.has("disableTap")&&(e.enableTap=!this.disableTap),(t.has("interactionPrompt")||t.has("cameraControls")||t.has("src"))&&(this.interactionPrompt===qA&&this.cameraControls&&!this[vp]?this[fp]=!0:this[up]()),t.has("interactionPromptStyle")&&(this[hp].style.opacity=this.interactionPromptStyle==jA?"1":"0"),t.has("touchAction")){const t=this.touchAction;e.applyOptions({touchAction:t}),e.updateTouchActionStyle()}t.has("orbitSensitivity")&&(e.orbitSensitivity=this.orbitSensitivity),t.has("interpolationDecay")&&(e.setDamperDecayTime(this.interpolationDecay),i.setTargetDamperDecayTime(this.interpolationDecay)),!0===this[wp]&&Promise.resolve().then((()=>{e.jumpToGoal(),i.jumpToGoal(),this[mp](),this[wp]=!1}))}async updateFraming(){const t=this[av],e=t.adjustedFoV(t.framedFoVDeg);await t.updateFraming();const i=t.adjustedFoV(t.framedFoVDeg),n=this[ap].getFieldOfView()/e;this[ap].setFieldOfView(i*n),this[Ip]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(t,e,i){const n=this[rv],r=this[cp];if("1"===r[0].style.opacity)return void console.warn("interact() failed because an existing interaction is running.");const s=new Array;s.push({x:kA(e.x),y:kA(e.y)});const a=[{x:s[0].x(0),y:s[0].y(0)}];null!=i&&(s.push({x:kA(i.x),y:kA(i.y)}),a.push({x:s[1].x(0),y:s[1].y(0)}));let o=performance.now();const{width:l,height:h}=this[av],c=t=>{for(const[e,i]of a.entries()){const{style:s}=r[e];s.transform=`translateX(${l*i.x}px) translateY(${h*i.y}px)`,"pointerdown"===t?s.opacity="1":"pointerup"===t&&(s.opacity="0");const a={pointerId:e-5678,pointerType:"touch",target:n,clientX:l*i.x,clientY:h*i.y,altKey:!0};n.dispatchEvent(new PointerEvent(t,a))}},u=()=>{const e=this[_p];if(e!==Fp.AUTOMATIC||!n.isConnected){for(const t of this[cp])t.style.opacity="0";return c("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:e}})),void document.removeEventListener("visibilitychange",d)}const i=Math.min(1,(performance.now()-o)/t);for(const[t,e]of a.entries())e.x=s[t].x(i),e.y=s[t].y(i);c("pointermove"),i<1?requestAnimationFrame(u):(c("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Fp.AUTOMATIC}})),document.removeEventListener("visibilitychange",d))},d=()=>{let t=0;"hidden"===document.visibilityState?t=performance.now()-o:o=performance.now()-t};document.addEventListener("visibilitychange",d),c("pointerdown"),this[_p]=Fp.AUTOMATIC,requestAnimationFrame(u)}[(i=lp,n=hp,r=cp,s=op,a=xp,o=yp,l=vp,h=fp,c=_p,u=ap,d=Ep,A=wp,p=Cp,m=Ip,Sp)](t){const e=this[ap],i=this[av];i.framedFoVDeg=180*t[0]/Math.PI,e.changeSource=Fp.NONE,e.setFieldOfView(i.adjustedFoV(i.framedFoVDeg)),this[pp]()}[bp](t){const e=this[ap];if(this[Ip]){const{theta:e,phi:i}=this.getCameraOrbit();t[0]=e,t[1]=i,this[Ip]=!1}e.changeSource=Fp.NONE,e.setOrbit(t[0],t[1],t[2]),this[pp]()}[Bp](t){this[ap].applyOptions({minimumAzimuthalAngle:t[0],minimumPolarAngle:t[1],minimumRadius:t[2]}),this.jumpCameraToGoal()}[Tp](t){this[ap].applyOptions({maximumAzimuthalAngle:t[0],maximumPolarAngle:t[1],maximumRadius:t[2]}),this[Ap](t[2]),this.jumpCameraToGoal()}[Rp](t){this[ap].applyOptions({minimumFieldOfView:180*t[0]/Math.PI}),this.jumpCameraToGoal()}[Lp](t){const e=this[av].adjustedFoV(180*t[0]/Math.PI);this[ap].applyOptions({maximumFieldOfView:e}),this.jumpCameraToGoal()}[Mp](t){const[e,i,n]=t;this[uv].arRenderer.isPresenting||this[av].setTarget(e,i,n),this[ap].changeSource=Fp.NONE,this[uv].arRenderer.updateTarget(),this[pp]()}[lv](t,e){if(super[lv](t,e),this[uv].isPresenting||!this[pv]())return;const i=this[ap],n=this[av],r=performance.now();if(this[fp]&&this.loaded&&r>this[tv]+this.interactionPromptThreshold&&(this[fp]=!1,this[yp]=r,this[lp].classList.add("visible")),isFinite(this[yp])&&this.interactionPromptStyle===YA){const t=(r-this[yp])/5e3%1,e=GA(t),s=HA(t);if(this[hp].style.opacity=`${s}`,e!==this[xp]){const t=e*n.width*.05,r=(e-this[xp])*Math.PI/16;this[hp].style.transform=`translateX(${t}px)`,i.changeSource=Fp.AUTOMATIC,i.adjustOrbit(r,0,0),this[xp]=e}}const s=i.update(t,e),a=n.updateTarget(e);(s||a)&&this[mp]()}[up](){this[fp]=!1,this[lp].classList.remove("visible"),this[yp]=1/0}[Ap](t){const e=2*Math.max(this[av].boundingSphere.radius,t);this[ap].updateNearFar(0,e)}[dp](){const{theta:t,phi:e}=this[ap].getCameraSpherical(this[Ep]),i=(4+Math.floor((t%sp+rp)/ip))%4,n=Math.floor(e/np),r=VA[i],s=WA[n];this[Zf](`View from stage ${s}${r}`)}get[Xf](){return super[Xf].replace(/\.$/,"")+(this.cameraControls?". Use mouse, touch or arrow keys to move.":"")}async[cv](t){const e=this[ap],i=this[av],n=i.adjustedFoV(i.framedFoVDeg);super[cv](t);const r=i.adjustedFoV(i.framedFoVDeg)/n,s=e.getFieldOfView()*(isFinite(r)?r:1);e.updateAspect(this[av].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[ap].setFieldOfView(s),this.jumpCameraToGoal()}[hv](){super[hv](),this[Cp]?this[Ip]=!0:this[Cp]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}}return g=pp,f=mp,v=gp,OA([e({type:Boolean,attribute:"camera-controls"})],y.prototype,"cameraControls",void 0),OA([UA({intrinsics:$A,observeEffects:!0,updateHandler:bp}),e({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],y.prototype,"cameraOrbit",void 0),OA([UA({intrinsics:ep,observeEffects:!0,updateHandler:Mp}),e({type:String,attribute:"camera-target",hasChanged:()=>!0})],y.prototype,"cameraTarget",void 0),OA([UA({intrinsics:XA,observeEffects:!0,updateHandler:Sp}),e({type:String,attribute:"field-of-view",hasChanged:()=>!0})],y.prototype,"fieldOfView",void 0),OA([UA({intrinsics:ZA,updateHandler:Bp}),e({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],y.prototype,"minCameraOrbit",void 0),OA([UA({intrinsics:tp,updateHandler:Tp}),e({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],y.prototype,"maxCameraOrbit",void 0),OA([UA({intrinsics:KA,updateHandler:Rp}),e({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],y.prototype,"minFieldOfView",void 0),OA([UA({intrinsics:XA,updateHandler:Lp}),e({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],y.prototype,"maxFieldOfView",void 0),OA([e({type:Number,attribute:"interaction-prompt-threshold"})],y.prototype,"interactionPromptThreshold",void 0),OA([e({type:String,attribute:"interaction-prompt"})],y.prototype,"interactionPrompt",void 0),OA([e({type:String,attribute:"interaction-prompt-style"})],y.prototype,"interactionPromptStyle",void 0),OA([e({type:Number,attribute:"orbit-sensitivity"})],y.prototype,"orbitSensitivity",void 0),OA([e({type:String,attribute:"touch-action"})],y.prototype,"touchAction",void 0),OA([e({type:Boolean,attribute:"disable-zoom"})],y.prototype,"disableZoom",void 0),OA([e({type:Boolean,attribute:"disable-pan"})],y.prototype,"disablePan",void 0),OA([e({type:Boolean,attribute:"disable-tap"})],y.prototype,"disableTap",void 0),OA([e({type:Number,attribute:"interpolation-decay"})],y.prototype,"interpolationDecay",void 0),y})((t=>{var i,n,r,s,a,o,l,h,c,u;class d extends t{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[i]=!1,this[n]=this.shadowRoot.querySelector(".ar-button"),this[r]=document.createElement("a"),this[s]=new Set,this[a]=ky,this[o]=!1,this[l]=t=>{t.preventDefault(),this.activateAR()},this[h]=({status:t})=>{t!==Op&&this[uv].arRenderer.presentedScene!==this[av]||(this.setAttribute("ar-status",t),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:t}})),t===Op?this.removeAttribute("ar-tracking"):t===Gp&&this.setAttribute("ar-tracking",Vp))},this[c]=({status:t})=>{this.setAttribute("ar-tracking",t),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:t}}))},this[u]=t=>{"_apple_ar_quicklook_button_tapped"==t.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[Wy]!==ky}connectedCallback(){super.connectedCallback(),this[uv].arRenderer.addEventListener("status",this[Xy]),this.setAttribute("ar-status",Op),this[uv].arRenderer.addEventListener("tracking",this[Ky]),this[jy].addEventListener("message",this[$y])}disconnectedCallback(){super.disconnectedCallback(),this[uv].arRenderer.removeEventListener("status",this[Xy]),this[uv].arRenderer.removeEventListener("tracking",this[Ky]),this[jy].removeEventListener("message",this[$y])}update(t){super.update(t),t.has("arScale")&&(this[av].canScale="fixed"!==this.arScale),t.has("arPlacement")&&(this[av].updateShadow(),this[ov]()),t.has("arModes")&&(this[qy]=Qy(this.arModes)),(t.has("ar")||t.has("arModes")||t.has("src")||t.has("iosSrc"))&&this[Zy]()}async activateAR(){switch(this[Wy]){case Uy:this[zy]();break;case Fy:await this[Gy]();break;case Ny:this[Hy]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(i=Vy,n=Oy,r=jy,s=qy,a=Wy,o=Yy,l=Jy,h=Xy,c=Ky,u=$y,Zy)](){let t=ky;if(this.ar){if(null!=this.src)for(const e of this[qy]){if("webxr"===e&&wh&&!Ry&&await this[uv].arRenderer.supportsPresentation()){t=Fy;break}if("scene-viewer"===e&&Mh&&!Ly){t=Ny;break}if("quick-look"===e&&Th){t=Uy;break}}t===ky&&null!=this.iosSrc&&Th&&(t=Uy)}if(t!==ky)this[Oy].classList.add("enabled"),this[Oy].addEventListener("click",this[Jy]);else if(this[Oy].classList.contains("enabled")){this[Oy].removeEventListener("click",this[Jy]),this[Oy].classList.remove("enabled");const t=zp;this.setAttribute("ar-status",t),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:t}}))}this[Wy]=t}async[Gy](){console.log("Attempting to present in AR with WebXR..."),await this[tx]();try{this[Oy].removeEventListener("click",this[Jy]);const{arRenderer:t}=this[uv];t.placeOnWall="wall"===this.arPlacement,await t.present(this[av],this.xrEnvironment)}catch(t){console.warn("Error while trying to present in AR with WebXR"),console.error(t),await this[uv].arRenderer.stopPresenting(),Ry=!0,console.warn("Falling back to next ar-mode"),await this[Zy](),this.activateAR()}finally{this[Zy]()}}async[tx](){this.loaded||(this[Yy]=!0,this[ev](),await((t,e,i=null)=>new Promise((n=>{t.addEventListener(e,(function r(s){i&&!i(s)||(n(s),t.removeEventListener(e,r))}))})))(this,"load"),this[Yy]=!1)}[mv](){return super[mv]()||this[Yy]}[Hy](){const t=self.location.toString(),e=new URL(t),i=new URL(this.src,t);i.hash&&(i.hash="");const n=new URLSearchParams(i.search);if(e.hash=Dy,n.set("mode","ar_preferred"),n.has("disable_occlusion")||n.set("disable_occlusion","true"),"fixed"===this.arScale&&n.set("resizable","false"),"wall"===this.arPlacement&&n.set("enable_vertical_placement","true"),n.has("sound")){const e=new URL(n.get("sound"),t);n.set("sound",e.toString())}if(n.has("link")){const e=new URL(n.get("link"),t);n.set("link",e.toString())}const r=`intent://arvr.google.com/scene-viewer/1.0?${n.toString()+"&file="+encodeURIComponent(i.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===Dy&&(Ly=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[Zy]())}),{once:!0}),this[jy].setAttribute("href",r),console.log("Attempting to present in AR with Scene Viewer..."),this[jy].click()}async[zy](){const t=!this.iosSrc;this[Oy].classList.remove("enabled");const e=t?await this.prepareUSDZ():this.iosSrc,i=new URL(e,self.location.toString());if(t){const t=self.location.toString(),e=new URL(t),n=new URL(this.src,e);n.hash&&(i.hash=n.hash)}"fixed"===this.arScale&&(i.hash&&(i.hash+="&"),i.hash+="allowsContentScaling=0");const n=this[jy];n.setAttribute("rel","ar");const r=document.createElement("img");n.appendChild(r),n.setAttribute("href",i.toString()),t&&n.setAttribute("download","model.usdz"),n.style.display="none",n.isConnected||this.shadowRoot.appendChild(n),console.log("Attempting to present in AR with Quick Look..."),n.click(),n.removeChild(r),t&&URL.revokeObjectURL(e),this[Oy].classList.add("enabled")}async prepareUSDZ(){const t=this[dv].beginActivity();await this[tx]();const{model:e,shadow:i}=this[av];if(null==e)return"";let n=!1;null!=i&&(n=i.visible,i.visible=!1),t(.2);const r=new xy,s=await r.parse(e),a=new Blob([s],{type:"model/vnd.usdz+zip"}),o=URL.createObjectURL(a);return t(1),null!=i&&(i.visible=n),o}}return Ty([e({type:Boolean,attribute:"ar"})],d.prototype,"ar",void 0),Ty([e({type:String,attribute:"ar-scale"})],d.prototype,"arScale",void 0),Ty([e({type:String,attribute:"ar-placement"})],d.prototype,"arPlacement",void 0),Ty([e({type:String,attribute:"ar-modes"})],d.prototype,"arModes",void 0),Ty([e({type:String,attribute:"ios-src"})],d.prototype,"iosSrc",void 0),Ty([e({type:Boolean,attribute:"xr-environment"})],d.prototype,"xrEnvironment",void 0),d})((t=>{var i,n,r,s,a,o,l,h;class c extends t{constructor(...t){super(...t),this.poster=null,this.reveal=ix,this.loading=nx,this[i]=!1,this[n]=!1,this[r]=this.shadowRoot.querySelector(".slot.poster"),this[s]=this.shadowRoot.querySelector("#default-poster"),this[a]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[o]=this[ox].getAttribute("aria-label"),this[l]=((t,e)=>{let i=null;const n=(...n)=>{null==i&&(t(...n),i=self.setTimeout((()=>i=null),e))};return n.flush=()=>{null!=i&&(self.clearTimeout(i),i=null)},n})((t=>{const e=this[sx].parentNode;requestAnimationFrame((()=>{this[sx].style.transform=`scaleX(${t})`,0===t&&(e.removeChild(this[sx]),e.appendChild(this[sx])),1===t?this[sx].classList.add("hide"):this[sx].classList.remove("hide")}))}),100),this[h]=t=>{const e=t.detail.totalProgress;1===e&&(this[ux].flush(),this.loaded&&(this[lx]||this.reveal===ix)&&this[hx]()),this[ux](e),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:e}}))};const e=self.ModelViewerElement||{},c=e.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";Bu.setDRACODecoderLocation(c);const u=e.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";Bu.setKTX2TranscoderLocation(u),e.meshoptDecoderLocation&&Bu.setMeshoptDecoderLocation(e.meshoptDecoderLocation);const d=e.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Im.singleton.textureUtils.lottieLoaderUrl=d}static set dracoDecoderLocation(t){Bu.setDRACODecoderLocation(t)}static get dracoDecoderLocation(){return Bu.getDRACODecoderLocation()}static set ktx2TranscoderLocation(t){Bu.setKTX2TranscoderLocation(t)}static get ktx2TranscoderLocation(){return Bu.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(t){Bu.setMeshoptDecoderLocation(t)}static get meshoptDecoderLocation(){return Bu.getMeshoptDecoderLocation()}static set lottieLoaderLocation(t){Im.singleton.textureUtils.lottieLoaderUrl=t}static get lottieLoaderLocation(){return Im.singleton.textureUtils.lottieLoaderUrl}static mapURLs(t){Im.singleton.loader[bu].manager.setURLModifier(t)}dismissPoster(){this.loaded?this[hx]():(this[lx]=!0,this[ev]())}showPoster(){const t=this[ax];if(t.classList.contains("show"))return;t.classList.add("show"),this[rv].classList.remove("show");const e=this[ox];e.removeAttribute("tabindex"),e.removeAttribute("aria-hidden");const i=this.modelIsVisible;this[cx]=!1,this[Jf](i)}getDimensions(){return gv(this[av].size)}getBoundingBoxCenter(){return gv(this[av].boundingBox.getCenter(new ae))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[dv].addEventListener("progress",this[Ax])}disconnectedCallback(){super.disconnectedCallback(),this[dv].removeEventListener("progress",this[Ax])}async updated(t){super.updated(t),t.has("poster")&&null!=this.poster&&(this[ox].style.backgroundImage=`url(${this.poster})`),t.has("alt")&&this[ox].setAttribute("aria-label",this[Kf]),(t.has("reveal")||t.has("loading"))&&this[ev]()}[(i=cx,n=lx,r=ax,s=ox,a=sx,o=dx,l=ux,h=Ax,mv)](){return!!this.src&&(this[lx]||this.loading===rx||this.reveal===ix&&this[Yf])}[hx](){this[lx]=!1;const t=this[ax];if(!t.classList.contains("show"))return;t.classList.remove("show"),this[rv].classList.add("show");const e=this.modelIsVisible;this[cx]=!0,this[Jf](e);const i=this.getRootNode();i&&i.activeElement===this&&this[rv].focus();const n=this[ox];n.setAttribute("aria-hidden","true"),n.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[pv](){return super[pv]()&&this[cx]}}return ex([e({type:String})],c.prototype,"poster",void 0),ex([e({type:String})],c.prototype,"reveal",void 0),ex([e({type:String})],c.prototype,"loading",void 0),c})((t=>{var i;class n extends t{constructor(...t){super(t),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[i]=!0,this[av].subscribeMixerEvent("loop",(t=>{const e=t.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:e}}))})),this[av].subscribeMixerEvent("finished",(()=>{this[_v]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[av].animationNames:[]}get duration(){return this[av].duration}get paused(){return this[_v]}get currentTime(){return this[av].animationTime}set currentTime(t){this[av].animationTime=t,this[ov]()}get timeScale(){return this[av].animationTimeScale}set timeScale(t){this[av].animationTimeScale=t}pause(){this[_v]||(this[_v]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(t){this.availableAnimations.length>0&&(this[_v]=!1,this[xv](t),this.dispatchEvent(new CustomEvent("play")))}[(i=_v,hv)](){super[hv](),this[_v]=!0,null!=this.animationName&&this[xv](),this.autoplay&&this.play()}[lv](t,e){super[lv](t,e),this[_v]||!this[pv]()&&!this[uv].isPresenting||(this[av].updateAnimation(e/1e3),this[ov]())}updated(t){super.updated(t),t.has("autoplay")&&this.autoplay&&this.play(),t.has("animationName")&&this[xv]()}[xv](t=Ev){var e;const i=null!==(e=t.repetitions)&&void 0!==e?e:1/0,n=t.pingpong?it:1===i?2200:et;this[av].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,n,i),this[_v]&&(this[av].updateAnimation(0),this[ov]())}}return yv([e({type:Boolean})],n.prototype,"autoplay",void 0),yv([e({type:String,attribute:"animation-name"})],n.prototype,"animationName",void 0),yv([e({type:Number,attribute:"animation-crossfade-duration"})],n.prototype,"animationCrossfadeDuration",void 0),n})(vv))))))));customElements.define("model-viewer",_x);export{ro as CanvasTexture,Qo as FileLoader,Ro as Loader,_x as ModelViewerElement,M as NearestFilter};
//# sourceMappingURL=model-viewer.min.js.map
