12345678910111213 |
- !function(e){var i=e.location.href,l="";-1!=i.indexOf("&mobile=true")?Object.defineProperty(navigator,"userAgent",{value:"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",writable:!1}):/iPhone|iPad|Android/i.test(e.navigator.userAgent)?-1!==i.indexOf("pc.html")&&(l=i.replace("pc.html","mobile.html")):-1!==i.indexOf("mobile.html")&&(l=i.replace("mobile.html","pc.html")),l&&(e.location.href=l)}(window);;
- !function(i,e){var t=i.document,a=t.documentElement,r=t.querySelector('meta[name="viewport"]'),n=t.querySelector('meta[name="flexible"]'),o=0,l=0,m,s=e.flexible||(e.flexible={});if(r){console.warn("将根据已有的meta标签来设置缩放比例");var d=r.getAttribute("content").match(/initial\-scale=([\d\.]+)/);d&&(l=parseFloat(d[1]),o=parseInt(1/l))}else if(n){var p=n.getAttribute("content");if(p){var c=p.match(/initial\-dpr=([\d\.]+)/),u=p.match(/maximum\-dpr=([\d\.]+)/);c&&(o=parseFloat(c[1]),l=parseFloat((1/o).toFixed(2))),u&&(o=parseFloat(u[1]),l=parseFloat((1/o).toFixed(2)))}}if(!o&&!l){var f=i.navigator.appVersion.match(/android/gi),v=i.navigator.appVersion.match(/iphone/gi),h=i.devicePixelRatio;l=1/(o=v?3<=h&&(!o||3<=o)?3:2<=h&&(!o||2<=o)?2:1:1)}if(a.setAttribute("data-dpr",o),!r)if((r=t.createElement("meta")).setAttribute("name","viewport"),r.setAttribute("content","initial-scale="+l+", maximum-scale="+l+", minimum-scale="+l+", user-scalable=no"),a.firstElementChild)a.firstElementChild.appendChild(r);else{var x=t.createElement("div");x.appendChild(r),t.write(x.innerHTML)}function b(){var e=a.getBoundingClientRect().width;540<e/o&&(e=540*o);var t=e/10;a.style.fontSize=t+"px",s.rem=i.rem=t}i.addEventListener("resize",function(){clearTimeout(m),m=setTimeout(b,300)},!1),i.addEventListener("pageshow",function(e){e.persisted&&(clearTimeout(m),m=setTimeout(b,300))},!1),"complete"===t.readyState?t.body.style.fontSize=12*o+"px":t.addEventListener("DOMContentLoaded",function(e){t.body.style.fontSize=12*o+"px"},!1),b(),s.dpr=i.dpr=o,s.refreshRem=b,s.rem2px=function(e){var t=parseFloat(e)*this.rem;return"string"==typeof e&&e.match(/rem$/)&&(t+="px"),t},s.px2rem=function(e){var t=parseFloat(e)/this.rem;return"string"==typeof e&&e.match(/px$/)&&(t+="rem"),t}}(window,window.lib||(window.lib={}));;
- !function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(h,e){var t=[],c=t.slice,g=t.concat,a=t.push,i=t.indexOf,n={},r=n.toString,m=n.hasOwnProperty,v={},y=h.document,o="2.1.1",C=function(e,t){return new C.fn.init(e,t)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^-ms-/,l=/-([\da-z])/gi,f=function(e,t){return t.toUpperCase()};function p(e){var t=e.length,n=C.type(e);return"function"!==n&&!C.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e))}C.fn=C.prototype={jquery:o,constructor:C,selector:"",length:0,toArray:function(){return c.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:c.call(this)},pushStack:function(e){var t=C.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return C.each(this,e,t)},map:function(n){return this.pushStack(C.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(c.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:a,sort:t.sort,splice:t.splice},C.extend=C.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[a]||{},a++),"object"==typeof s||C.isFunction(s)||(s={}),a===u&&(s=this,a--);a<u;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],s!==(r=e[t])&&(l&&r&&(C.isPlainObject(r)||(i=C.isArray(r)))?(o=i?(i=!1,n&&C.isArray(n)?n:[]):n&&C.isPlainObject(n)?n:{},s[t]=C.extend(l,o,r)):void 0!==r&&(s[t]=r));return s},C.extend({expando:"jQuery"+(o+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===C.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!C.isArray(e)&&0<=e-parseFloat(e)},isPlainObject:function(e){return"object"===C.type(e)&&!e.nodeType&&!C.isWindow(e)&&!(e.constructor&&!m.call(e.constructor.prototype,"isPrototypeOf"))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[r.call(e)]||"object":typeof e},globalEval:function(e){var t,n=eval;(e=C.trim(e))&&(1===e.indexOf("use strict")?((t=y.createElement("script")).text=e,y.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(u,"ms-").replace(l,f)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=p(e);if(n){if(s)for(;i<o&&!1!==(r=t.apply(e[i],n));i++);else for(i in e)if(!1===(r=t.apply(e[i],n)))break}else if(s)for(;i<o&&!1!==(r=t.call(e[i],i,e[i]));i++);else for(i in e)if(!1===(r=t.call(e[i],i,e[i])))break;return e},trim:function(e){return null==e?"":(e+"").replace(s,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?C.merge(n,"string"==typeof e?[e]:e):a.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,s=e.length,a=!n;o<s;o++)(r=!t(e[o],o))!==a&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s,a=[];if(p(e))for(;i<o;i++)null!=(r=t(e[i],i,n))&&a.push(r);else for(i in e)null!=(r=t(e[i],i,n))&&a.push(r);return g.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),C.isFunction(e)?(r=c.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(c.call(arguments)))}).guid=e.guid=e.guid||C.guid++,i):void 0},now:Date.now,support:v}),C.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,h,b,o,r,g,f,m,w,l,c,v,T,i,y,x,s,a,C,N="sizzle"+-new Date,k=n.document,E=0,p=0,u=oe(),d=oe(),S=oe(),j=function(e,t){return e===t&&(c=!0),0},D="undefined",A=1<<31,L={}.hasOwnProperty,t=[],q=t.pop,H=t.push,O=t.push,F=t.slice,P=t.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]===e)return t;return-1},M="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",R="[\\x20\\t\\r\\n\\f]",W="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",$=W.replace("w","w#"),B="\\["+R+"*("+W+")(?:"+R+"*([*^$|!~]?=)"+R+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+$+"))|)"+R+"*\\]",I=":("+W+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+B+")*)|.*)\\)|)",_=new RegExp("^"+R+"+|((?:^|[^\\\\])(?:\\\\.)*)"+R+"+$","g"),z=new RegExp("^"+R+"*,"+R+"*"),X=new RegExp("^"+R+"*([>+~]|"+R+")"+R+"*"),U=new RegExp("="+R+"*([^\\]'\"]*?)"+R+"*\\]","g"),V=new RegExp(I),Y=new RegExp("^"+$+"$"),G={ID:new RegExp("^#("+W+")"),CLASS:new RegExp("^\\.("+W+")"),TAG:new RegExp("^("+W.replace("w","w*")+")"),ATTR:new RegExp("^"+B),PSEUDO:new RegExp("^"+I),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+R+"*(even|odd|(([+-]|)(\\d*)n|)"+R+"*(?:([+-]|)"+R+"*(\\d+)|))"+R+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+R+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+R+"*((?:-\\d)?\\d*)"+R+"*\\)|)(?=[^-]|$)","i")},Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=/'|\\/g,ne=new RegExp("\\\\([\\da-f]{1,6}"+R+"?|("+R+")|.)","ig"),re=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{O.apply(t=F.call(k.childNodes),k.childNodes),t[k.childNodes.length].nodeType}catch(e){O={apply:t.length?function(e,t){H.apply(e,F.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function ie(e,t,n,r){var i,o,s,a,u,l,c,f,p,d;if((t?t.ownerDocument||t:k)!==T&&v(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(a=(t=t||T).nodeType)&&9!==a)return[];if(y&&!r){if(i=Z.exec(e))if(s=i[1]){if(9===a){if(!(o=t.getElementById(s))||!o.parentNode)return n;if(o.id===s)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&C(t,o)&&o.id===s)return n.push(o),n}else{if(i[2])return O.apply(n,t.getElementsByTagName(e)),n;if((s=i[3])&&h.getElementsByClassName&&t.getElementsByClassName)return O.apply(n,t.getElementsByClassName(s)),n}if(h.qsa&&(!x||!x.test(e))){if(f=c=N,p=t,d=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(l=g(e),(c=t.getAttribute("id"))?f=c.replace(te,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",u=l.length;u--;)l[u]=f+ge(l[u]);p=ee.test(e)&&de(t.parentNode)||t,d=l.join(",")}if(d)try{return O.apply(n,p.querySelectorAll(d)),n}catch(e){}finally{c||t.removeAttribute("id")}}}return m(e.replace(_,"$1"),t,n,r)}function oe(){var n=[];function r(e,t){return n.push(e+" ")>b.cacheLength&&delete r[n.shift()],r[e+" "]=t}return r}function se(e){return e[N]=!0,e}function ae(e){var t=T.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var n=e.split("|"),r=e.length;r--;)b.attrHandle[n[r]]=t}function le(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||A)-(~e.sourceIndex||A);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ce(n){return function(e){var t;return"input"===e.nodeName.toLowerCase()&&e.type===n}}function fe(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function pe(s){return se(function(o){return o=+o,se(function(e,t){for(var n,r=s([],e.length,o),i=r.length;i--;)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function de(e){return e&&typeof e.getElementsByTagName!==D&&e}for(e in h=ie.support={},r=ie.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},v=ie.setDocument=function(e){var t,u=e?e.ownerDocument||e:k,n=u.defaultView;return u!==T&&9===u.nodeType&&u.documentElement?(i=(T=u).documentElement,y=!r(u),n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",function(){v()},!1):n.attachEvent&&n.attachEvent("onunload",function(){v()})),h.attributes=ae(function(e){return e.className="i",!e.getAttribute("className")}),h.getElementsByTagName=ae(function(e){return e.appendChild(u.createComment("")),!e.getElementsByTagName("*").length}),h.getElementsByClassName=K.test(u.getElementsByClassName)&&ae(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),h.getById=ae(function(e){return i.appendChild(e).id=N,!u.getElementsByName||!u.getElementsByName(N).length}),h.getById?(b.find.ID=function(e,t){if(typeof t.getElementById!==D&&y){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},b.filter.ID=function(e){var t=e.replace(ne,re);return function(e){return e.getAttribute("id")===t}}):(delete b.find.ID,b.filter.ID=function(e){var n=e.replace(ne,re);return function(e){var t=typeof e.getAttributeNode!==D&&e.getAttributeNode("id");return t&&t.value===n}}),b.find.TAG=h.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==D?t.getElementsByTagName(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;n=o[i++];)1===n.nodeType&&r.push(n);return r},b.find.CLASS=h.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==D&&y?t.getElementsByClassName(e):void 0},s=[],x=[],(h.qsa=K.test(u.querySelectorAll))&&(ae(function(e){e.innerHTML="<select msallowclip=''><option selected=''></option></select>",e.querySelectorAll("[msallowclip^='']").length&&x.push("[*^$]="+R+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||x.push("\\["+R+"*(?:value|"+M+")"),e.querySelectorAll(":checked").length||x.push(":checked")}),ae(function(e){var t=u.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&x.push("name"+R+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||x.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),x.push(",.*:")})),(h.matchesSelector=K.test(a=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.oMatchesSelector||i.msMatchesSelector))&&ae(function(e){h.disconnectedMatch=a.call(e,"div"),a.call(e,"[s!='']:x"),s.push("!=",I)}),x=x.length&&new RegExp(x.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(i.compareDocumentPosition),C=t||K.test(i.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return c=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!h.sortDetached&&t.compareDocumentPosition(e)===n?e===u||e.ownerDocument===k&&C(k,e)?-1:t===u||t.ownerDocument===k&&C(k,t)?1:l?P.call(l,e)-P.call(l,t):0:4&n?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!i||!o)return e===u?-1:t===u?1:i?-1:o?1:l?P.call(l,e)-P.call(l,t):0;if(i===o)return le(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?le(s[r],a[r]):s[r]===k?-1:a[r]===k?1:0},u):T},ie.matches=function(e,t){return ie(e,null,null,t)},ie.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&v(e),t=t.replace(U,"='$1']"),!(!h.matchesSelector||!y||s&&s.test(t)||x&&x.test(t)))try{var n=a.call(e,t);if(n||h.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return 0<ie(t,T,null,[e]).length},ie.contains=function(e,t){return(e.ownerDocument||e)!==T&&v(e),C(e,t)},ie.attr=function(e,t){(e.ownerDocument||e)!==T&&v(e);var n=b.attrHandle[t.toLowerCase()],r=n&&L.call(b.attrHandle,t.toLowerCase())?n(e,t,!y):void 0;return void 0!==r?r:h.attributes||!y?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},ie.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ie.uniqueSort=function(e){var t,n=[],r=0,i=0;if(c=!h.detectDuplicates,l=!h.sortStable&&e.slice(0),e.sort(j),c){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return l=null,e},o=ie.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=o(t);return n},(b=ie.selectors={cacheLength:50,createPseudo:se,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ne,re),e[3]=(e[3]||e[4]||e[5]||"").replace(ne,re),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ie.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ie.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&V.test(n)&&(t=g(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ne,re).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=u[e+" "];return t||(t=new RegExp("(^|"+R+")"+e+"("+R+"|$)"))&&u(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==D&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=ie.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(d,e,t,h,g){var m="nth"!==d.slice(0,3),v="last"!==d.slice(-4),y="of-type"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,s,a,u,l=m!==v?"nextSibling":"previousSibling",c=e.parentNode,f=y&&e.nodeName.toLowerCase(),p=!n&&!y;if(c){if(m){for(;l;){for(o=e;o=o[l];)if(y?o.nodeName.toLowerCase()===f:1===o.nodeType)return!1;u=l="only"===d&&!u&&"nextSibling"}return!0}if(u=[v?c.firstChild:c.lastChild],v&&p){for(a=(r=(i=c[N]||(c[N]={}))[d]||[])[0]===E&&r[1],s=r[0]===E&&r[2],o=a&&c.childNodes[a];o=++a&&o&&o[l]||(s=a=0)||u.pop();)if(1===o.nodeType&&++s&&o===e){i[d]=[E,a,s];break}}else if(p&&(r=(e[N]||(e[N]={}))[d])&&r[0]===E)s=r[1];else for(;(o=++a&&o&&o[l]||(s=a=0)||u.pop())&&((y?o.nodeName.toLowerCase()!==f:1!==o.nodeType)||!++s||(p&&((o[N]||(o[N]={}))[d]=[E,s]),o!==e)););return(s-=g)===h||s%h==0&&0<=s/h}}},PSEUDO:function(e,o){var t,s=b.pseudos[e]||b.setFilters[e.toLowerCase()]||ie.error("unsupported pseudo: "+e);return s[N]?s(o):1<s.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,t){for(var n,r=s(e,o),i=r.length;i--;)e[n=P.call(e,r[i])]=!(t[n]=r[i])}):function(e){return s(e,0,t)}):s}},pseudos:{not:se(function(e){var r=[],i=[],a=f(e.replace(_,"$1"));return a[N]?se(function(e,t,n,r){for(var i,o=a(e,null,r,[]),s=e.length;s--;)(i=o[s])&&(e[s]=!(t[s]=i))}):function(e,t,n){return r[0]=e,a(r,null,n,i),!i.pop()}}),has:se(function(t){return function(e){return 0<ie(t,e).length}}),contains:se(function(t){return function(e){return-1<(e.textContent||e.innerText||o(e)).indexOf(t)}}),lang:se(function(n){return Y.test(n||"")||ie.error("unsupported lang: "+n),n=n.replace(ne,re).toLowerCase(),function(e){var t;do{if(t=y?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===i},focus:function(e){return e===T.activeElement&&(!T.hasFocus||T.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:pe(function(){return[0]}),last:pe(function(e,t){return[t-1]}),eq:pe(function(e,t,n){return[n<0?n+t:n]}),even:pe(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:pe(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:pe(function(e,t,n){for(var r=n<0?n+t:n;0<=--r;)e.push(r);return e}),gt:pe(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=ce(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=fe(e);function he(){}function ge(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(s,e,t){var a=e.dir,u=t&&"parentNode"===a,l=p++;return e.first?function(e,t,n){for(;e=e[a];)if(1===e.nodeType||u)return s(e,t,n)}:function(e,t,n){var r,i,o=[E,l];if(n){for(;e=e[a];)if((1===e.nodeType||u)&&s(e,t,n))return!0}else for(;e=e[a];)if(1===e.nodeType||u){if((r=(i=e[N]||(e[N]={}))[a])&&r[0]===E&&r[1]===l)return o[2]=r[2];if((i[a]=o)[2]=s(e,t,n))return!0}}}function ve(i){return 1<i.length?function(e,t,n){for(var r=i.length;r--;)if(!i[r](e,t,n))return!1;return!0}:i[0]}function ye(e,t,n){for(var r=0,i=t.length;r<i;r++)ie(e,t[r],n);return n}function xe(e,t,n,r,i){for(var o,s=[],a=0,u=e.length,l=null!=t;a<u;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function be(d,h,g,m,v,e){return m&&!m[N]&&(m=be(m)),v&&!v[N]&&(v=be(v,e)),se(function(e,t,n,r){var i,o,s,a=[],u=[],l=t.length,c=e||ye(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:xe(c,a,d,n,r),p=g?v||(e?d:l||m)?[]:t:f;if(g&&g(f,p,n,r),m)for(i=xe(p,u),m(i,[],n,r),o=i.length;o--;)(s=i[o])&&(p[u[o]]=!(f[u[o]]=s));if(e){if(v||d){if(v){for(i=[],o=p.length;o--;)(s=p[o])&&i.push(f[o]=s);v(null,p=[],i,r)}for(o=p.length;o--;)(s=p[o])&&-1<(i=v?P.call(e,s):a[o])&&(e[i]=!(t[i]=s))}}else p=xe(p===t?p.splice(l,p.length):p),v?v(null,t,p,r):O.apply(t,p)})}function we(e){for(var r,t,n,i=e.length,o=b.relative[e[0].type],s=o||b.relative[" "],a=o?1:0,u=me(function(e){return e===r},s,!0),l=me(function(e){return-1<P.call(r,e)},s,!0),c=[function(e,t,n){return!o&&(n||t!==w)||((r=t).nodeType?u(e,t,n):l(e,t,n))}];a<i;a++)if(t=b.relative[e[a].type])c=[me(ve(c),t)];else{if((t=b.filter[e[a].type].apply(null,e[a].matches))[N]){for(n=++a;n<i&&!b.relative[e[n].type];n++);return be(1<a&&ve(c),1<a&&ge(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(_,"$1"),t,a<n&&we(e.slice(a,n)),n<i&&we(e=e.slice(n)),n<i&&ge(e))}c.push(t)}return ve(c)}function Te(m,v){var y=0<v.length,x=0<m.length,e=function(e,t,n,r,i){var o,s,a,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t!==T&&t);l!==g&&null!=(o=d[l]);l++){if(x&&o){for(s=0;a=m[s++];)if(a(o,t,n)){r.push(o);break}i&&(E=h)}y&&((o=!a&&o)&&u--,e&&c.push(o))}if(u+=l,y&&l!==u){for(s=0;a=v[s++];)a(c,f,t,n);if(e){if(0<u)for(;l--;)c[l]||f[l]||(f[l]=q.call(r));f=xe(f)}O.apply(r,f),i&&!e&&0<f.length&&1<u+v.length&&ie.uniqueSort(r)}return i&&(E=h,w=p),c};return y?se(e):e}return he.prototype=b.filters=b.pseudos,b.setFilters=new he,g=ie.tokenize=function(e,t){var n,r,i,o,s,a,u,l=d[e+" "];if(l)return t?0:l.slice(0);for(s=e,a=[],u=b.preFilter;s;){for(o in(!n||(r=z.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),a.push(i=[])),n=!1,(r=X.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(_," ")}),s=s.slice(n.length)),b.filter)!(r=G[o].exec(s))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?ie.error(e):d(e,a).slice(0)},f=ie.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){for(t||(t=g(e)),n=t.length;n--;)(o=we(t[n]))[N]?r.push(o):i.push(o);(o=S(e,Te(i,r))).selector=e}return o},m=ie.select=function(e,t,n,r){var i,o,s,a,u,l="function"==typeof e&&e,c=!r&&g(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(s=o[0]).type&&h.getById&&9===t.nodeType&&y&&b.relative[o[1].type]){if(!(t=(b.find.ID(s.matches[0].replace(ne,re),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=G.needsContext.test(e)?0:o.length;i--&&(s=o[i],!b.relative[a=s.type]);)if((u=b.find[a])&&(r=u(s.matches[0].replace(ne,re),ee.test(o[0].type)&&de(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&ge(o)))return O.apply(n,r),n;break}}return(l||f(e,c))(r,t,!y,n,ee.test(e)&&de(t.parentNode)||t),n},h.sortStable=N.split("").sort(j).join("")===N,h.detectDuplicates=!!c,v(),h.sortDetached=ae(function(e){return 1&e.compareDocumentPosition(T.createElement("div"))}),ae(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ue("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),h.attributes&&ae(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ue("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),ae(function(e){return null==e.getAttribute("disabled")})||ue(M,function(e,t,n){var r;return n?void 0:!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),ie}(h);C.find=d,C.expr=d.selectors,C.expr[":"]=C.expr.pseudos,C.unique=d.uniqueSort,C.text=d.getText,C.isXMLDoc=d.isXML,C.contains=d.contains;var x=C.expr.match.needsContext,b=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function T(e,n,r){if(C.isFunction(n))return C.grep(e,function(e,t){return!!n.call(e,t,e)!==r});if(n.nodeType)return C.grep(e,function(e){return e===n!==r});if("string"==typeof n){if(w.test(n))return C.filter(n,e,r);n=C.filter(n,e)}return C.grep(e,function(e){return 0<=i.call(n,e)!==r})}C.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?C.find.matchesSelector(r,e)?[r]:[]:C.find.matches(e,C.grep(t,function(e){return 1===e.nodeType}))},C.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if("string"!=typeof e)return this.pushStack(C(e).filter(function(){for(t=0;t<n;t++)if(C.contains(i[t],this))return!0}));for(t=0;t<n;t++)C.find(e,i[t],r);return(r=this.pushStack(1<n?C.unique(r):r)).selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&x.test(e)?C(e):e||[],!1).length}});var N,k=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,E;(C.fn.init=function(e,t){var n,r;if(!e)return this;if("string"!=typeof e)return e.nodeType?(this.context=this[0]=e,this.length=1,this):C.isFunction(e)?void 0!==N.ready?N.ready(e):e(C):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),C.makeArray(e,this));if(!(n="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:k.exec(e))||!n[1]&&t)return!t||t.jquery?(t||N).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof C?t[0]:t,C.merge(this,C.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:y,!0)),b.test(n[1])&&C.isPlainObject(t))for(n in t)C.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(r=y.getElementById(n[2]))&&r.parentNode&&(this.length=1,this[0]=r),this.context=y,this.selector=e,this}).prototype=C.fn,N=C(y);var S=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function D(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}C.extend({dir:function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&C(e).is(n))break;r.push(e)}return r},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),C.fn.extend({has:function(e){var t=C(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(C.contains(this,t[e]))return!0})},closest:function(e,t){for(var n,r=0,i=this.length,o=[],s=x.test(e)||"string"!=typeof e?C(e,t||this.context):0;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?-1<s.index(n):1===n.nodeType&&C.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?C.unique(o):o)},index:function(e){return e?"string"==typeof e?i.call(C(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(C.unique(C.merge(this.get(),C(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),C.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return C.dir(e,"parentNode")},parentsUntil:function(e,t,n){return C.dir(e,"parentNode",n)},next:function(e){return D(e,"nextSibling")},prev:function(e){return D(e,"previousSibling")},nextAll:function(e){return C.dir(e,"nextSibling")},prevAll:function(e){return C.dir(e,"previousSibling")},nextUntil:function(e,t,n){return C.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return C.dir(e,"previousSibling",n)},siblings:function(e){return C.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return C.sibling(e.firstChild)},contents:function(e){return e.contentDocument||C.merge([],e.childNodes)}},function(r,i){C.fn[r]=function(e,t){var n=C.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=C.filter(t,n)),1<this.length&&(j[r]||C.unique(n),S.test(r)&&n.reverse()),this.pushStack(n)}});var A=/\S+/g,L={},q;function H(e){var n=L[e]={};return C.each(e.match(A)||[],function(e,t){n[t]=!0}),n}function O(){y.removeEventListener("DOMContentLoaded",O,!1),h.removeEventListener("load",O,!1),C.ready()}C.Callbacks=function(i){i="string"==typeof i?L[i]||H(i):C.extend({},i);var t,n,r,o,s,a,u=[],l=!i.once&&[],c=function(e){for(t=i.memory&&e,n=!0,a=o||0,o=0,s=u.length,r=!0;u&&a<s;a++)if(!1===u[a].apply(e[0],e[1])&&i.stopOnFalse){t=!1;break}r=!1,u&&(l?l.length&&c(l.shift()):t?u=[]:f.disable())},f={add:function(){if(u){var e=u.length;!function r(e){C.each(e,function(e,t){var n=C.type(t);"function"===n?i.unique&&f.has(t)||u.push(t):t&&t.length&&"string"!==n&&r(t)})}(arguments),r?s=u.length:t&&(o=e,c(t))}return this},remove:function(){return u&&C.each(arguments,function(e,t){for(var n;-1<(n=C.inArray(t,u,n));)u.splice(n,1),r&&(n<=s&&s--,n<=a&&a--)}),this},has:function(e){return e?-1<C.inArray(e,u):!(!u||!u.length)},empty:function(){return u=[],s=0,this},disable:function(){return u=l=t=void 0,this},disabled:function(){return!u},lock:function(){return l=void 0,t||f.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!u||n&&!l||(t=[e,(t=t||[]).slice?t.slice():t],r?l.push(t):c(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!n}};return f},C.extend({Deferred:function(e){var o=[["resolve","done",C.Callbacks("once memory"),"resolved"],["reject","fail",C.Callbacks("once memory"),"rejected"],["notify","progress",C.Callbacks("memory")]],i="pending",s={state:function(){return i},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var i=arguments;return C.Deferred(function(r){C.each(o,function(e,t){var n=C.isFunction(i[e])&&i[e];a[t[1]](function(){var e=n&&n.apply(this,arguments);e&&C.isFunction(e.promise)?e.promise().done(r.resolve).fail(r.reject).progress(r.notify):r[t[0]+"With"](this===s?r.promise():this,n?[e]:arguments)})}),i=null}).promise()},promise:function(e){return null!=e?C.extend(e,s):s}},a={};return s.pipe=s.then,C.each(o,function(e,t){var n=t[2],r=t[3];s[t[1]]=n.add,r&&n.add(function(){i=r},o[1^e][2].disable,o[2][2].lock),a[t[0]]=function(){return a[t[0]+"With"](this===a?s:this,arguments),this},a[t[0]+"With"]=n.fireWith}),s.promise(a),e&&e.call(a,a),a},when:function(e){var t=0,n=c.call(arguments),r=n.length,i=1!==r||e&&C.isFunction(e.promise)?r:0,o=1===i?e:C.Deferred(),s=function(t,n,r){return function(e){n[t]=this,r[t]=1<arguments.length?c.call(arguments):e,r===a?o.notifyWith(n,r):--i||o.resolveWith(n,r)}},a,u,l;if(1<r)for(a=new Array(r),u=new Array(r),l=new Array(r);t<r;t++)n[t]&&C.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),C.fn.ready=function(e){return C.ready.promise().done(e),this},C.extend({isReady:!1,readyWait:1,holdReady:function(e){e?C.readyWait++:C.ready(!0)},ready:function(e){(!0===e?--C.readyWait:C.isReady)||((C.isReady=!0)!==e&&0<--C.readyWait||(q.resolveWith(y,[C]),C.fn.triggerHandler&&(C(y).triggerHandler("ready"),C(y).off("ready"))))}}),C.ready.promise=function(e){return q||(q=C.Deferred(),"complete"===y.readyState?setTimeout(C.ready):(y.addEventListener("DOMContentLoaded",O,!1),h.addEventListener("load",O,!1))),q.promise(e)},C.ready.promise();var F=C.access=function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===C.type(n))for(a in i=!0,n)C.access(e,t,a,n[a],!0,o,s);else if(void 0!==r&&(i=!0,C.isFunction(r)||(s=!0),l&&(t=s?(t.call(e,r),null):(l=t,function(e,t,n){return l.call(C(e),n)})),t))for(;a<u;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o};function P(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=C.expando+Math.random()}C.acceptData=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},P.uid=1,P.accepts=C.acceptData,P.prototype={key:function(t){if(!P.accepts(t))return 0;var n={},r=t[this.expando];if(!r){r=P.uid++;try{n[this.expando]={value:r},Object.defineProperties(t,n)}catch(e){n[this.expando]=r,C.extend(t,n)}}return this.cache[r]||(this.cache[r]={}),r},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(C.isEmptyObject(o))C.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,t){var n=this.cache[this.key(e)];return void 0===t?n:n[t]},access:function(e,t,n){var r;return void 0===t||t&&"string"==typeof t&&void 0===n?void 0!==(r=this.get(e,t))?r:this.get(e,C.camelCase(t)):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r,i,o=this.key(e),s=this.cache[o];if(void 0===t)this.cache[o]={};else{n=(r=C.isArray(t)?t.concat(t.map(C.camelCase)):(i=C.camelCase(t),t in s?[t,i]:(r=i)in s?[r]:r.match(A)||[])).length;for(;n--;)delete s[r[n]]}},hasData:function(e){return!C.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}};var M=new P,R=new P,W=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,$=/([A-Z])/g;function B(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace($,"-$1").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:W.test(n)?C.parseJSON(n):n)}catch(e){}R.set(e,t,n)}else n=void 0;return n}C.extend({hasData:function(e){return R.hasData(e)||M.hasData(e)},data:function(e,t,n){return R.access(e,t,n)},removeData:function(e,t){R.remove(e,t)},_data:function(e,t,n){return M.access(e,t,n)},_removeData:function(e,t){M.remove(e,t)}}),C.fn.extend({data:function(r,e){var t,n,i,o=this[0],s=o&&o.attributes;if(void 0!==r)return"object"==typeof r?this.each(function(){R.set(this,r)}):F(this,function(t){var e,n=C.camelCase(r);if(o&&void 0===t){if(void 0!==(e=R.get(o,r)))return e;if(void 0!==(e=R.get(o,n)))return e;if(void 0!==(e=B(o,n,void 0)))return e}else this.each(function(){var e=R.get(this,n);R.set(this,n,t),-1!==r.indexOf("-")&&void 0!==e&&R.set(this,r,t)})},null,e,1<arguments.length,null,!0);if(this.length&&(i=R.get(o),1===o.nodeType&&!M.get(o,"hasDataAttrs"))){for(t=s.length;t--;)s[t]&&(0===(n=s[t].name).indexOf("data-")&&(n=C.camelCase(n.slice(5)),B(o,n,i[n])));M.set(o,"hasDataAttrs",!0)}return i},removeData:function(e){return this.each(function(){R.remove(this,e)})}}),C.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=M.get(e,t),n&&(!r||C.isArray(n)?r=M.access(e,t,C.makeArray(n)):r.push(n)),r||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=C.queue(e,t),r=n.length,i=n.shift(),o=C._queueHooks(e,t),s=function(){C.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return M.get(e,n)||M.access(e,n,{empty:C.Callbacks("once memory").add(function(){M.remove(e,[t+"queue",n])})})}}),C.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?C.queue(this[0],t):void 0===n?this:this.each(function(){var e=C.queue(this,t,n);C._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&C.dequeue(this,t)})},dequeue:function(e){return this.each(function(){C.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=C.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";s--;)(n=M.get(o[s],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var I=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,_=["Top","Right","Bottom","Left"],z=function(e,t){return e=t||e,"none"===C.css(e,"display")||!C.contains(e.ownerDocument,e)},X=/^(?:checkbox|radio)$/i,U,V,Y;V=y.createDocumentFragment().appendChild(y.createElement("div")),(Y=y.createElement("input")).setAttribute("type","radio"),Y.setAttribute("checked","checked"),Y.setAttribute("name","t"),V.appendChild(Y),v.checkClone=V.cloneNode(!0).cloneNode(!0).lastChild.checked,V.innerHTML="<textarea>x</textarea>",v.noCloneChecked=!!V.cloneNode(!0).lastChild.defaultValue;var G="undefined";v.focusinBubbles="onfocusin"in h;var Q=/^key/,J=/^(?:mouse|pointer|contextmenu)|click/,K=/^(?:focusinfocus|focusoutblur)$/,Z=/^([^.]*)(?:\.(.+)|)$/;function ee(){return!0}function te(){return!1}function ne(){try{return y.activeElement}catch(e){}}C.event={global:{},add:function(t,e,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=M.get(t);if(m)for(n.handler&&(n=(o=n).handler,i=o.selector),n.guid||(n.guid=C.guid++),(u=m.events)||(u=m.events={}),(s=m.handle)||(s=m.handle=function(e){return typeof C!==G&&C.event.triggered!==e.type?C.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(A)||[""]).length;l--;)d=g=(a=Z.exec(e[l])||[])[1],h=(a[2]||"").split(".").sort(),d&&(f=C.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=C.event.special[d]||{},c=C.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&C.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,s)||t.addEventListener&&t.addEventListener(d,s,!1)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),C.event.global[d]=!0)},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=M.hasData(e)&&M.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(A)||[""]).length;l--;)if(d=g=(a=Z.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),d){for(f=C.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,m.handle)||C.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)C.event.remove(e,d+t[l],n,r,!0);C.isEmptyObject(u)&&(delete m.handle,M.remove(e,"events"))}},trigger:function(e,t,n,r){var i,o,s,a,u,l,c,f=[n||y],p=m.call(e,"type")?e.type:e,d=m.call(e,"namespace")?e.namespace.split("."):[];if(o=s=n=n||y,3!==n.nodeType&&8!==n.nodeType&&!K.test(p+C.event.triggered)&&(0<=p.indexOf(".")&&(p=(d=p.split(".")).shift(),d.sort()),u=p.indexOf(":")<0&&"on"+p,(e=e[C.expando]?e:new C.Event(p,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=d.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:C.makeArray(t,[e]),c=C.event.special[p]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!C.isWindow(n)){for(a=c.delegateType||p,K.test(a+p)||(o=o.parentNode);o;o=o.parentNode)f.push(o),s=o;s===(n.ownerDocument||y)&&f.push(s.defaultView||s.parentWindow||h)}for(i=0;(o=f[i++])&&!e.isPropagationStopped();)e.type=1<i?a:c.bindType||p,(l=(M.get(o,"events")||{})[e.type]&&M.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&C.acceptData(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=p,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(f.pop(),t)||!C.acceptData(n)||u&&C.isFunction(n[p])&&!C.isWindow(n)&&((s=n[u])&&(n[u]=null),n[C.event.triggered=p](),C.event.triggered=void 0,s&&(n[u]=s)),e.result}},dispatch:function(e){e=C.event.fix(e);var t,n,r,i,o,s=[],a=c.call(arguments),u=(M.get(this,"events")||{})[e.type]||[],l=C.event.special[e.type]||{};if((a[0]=e).delegateTarget=this,!l.preDispatch||!1!==l.preDispatch.call(this,e)){for(s=C.event.handlers.call(this,e,u),t=0;(i=s[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,void 0!==(r=((C.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a))&&!1===(e.result=r)&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(!0!==u.disabled||"click"!==e.type){for(r=[],n=0;n<a;n++)void 0===r[i=(o=t[n]).selector+" "]&&(r[i]=o.needsContext?0<=C(i,this).index(u):C.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return a<t.length&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,o=t.button;return null==e.pageX&&null!=t.clientX&&(r=(n=e.target.ownerDocument||y).documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||void 0===o||(e.which=1&o?1:2&o?3:4&o?2:0),e}},fix:function(e){if(e[C.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];for(s||(this.fixHooks[i]=s=J.test(i)?this.mouseHooks:Q.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new C.Event(o),t=r.length;t--;)e[n=r[t]]=o[n];return e.target||(e.target=y),3===e.target.nodeType&&(e.target=e.target.parentNode),s.filter?s.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ne()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ne()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&C.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(e){return C.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=C.extend(new C.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?C.event.trigger(i,null,t):C.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},C.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},C.Event=function(e,t){return this instanceof C.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?ee:te):this.type=e,t&&C.extend(this,t),this.timeStamp=e&&e.timeStamp||C.now(),void(this[C.expando]=!0)):new C.Event(e,t)},C.Event.prototype={isDefaultPrevented:te,isPropagationStopped:te,isImmediatePropagationStopped:te,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=ee,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=ee,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=ee,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},C.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,o){C.event.special[e]={delegateType:o,bindType:o,handle:function(e){var t,n=this,r=e.relatedTarget,i=e.handleObj;return(!r||r!==n&&!C.contains(n,r))&&(e.type=i.origType,t=i.handler.apply(this,arguments),e.type=o),t}}}),v.focusinBubbles||C.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){C.event.simulate(r,e.target,C.event.fix(e),!0)};C.event.special[r]={setup:function(){var e=this.ownerDocument||this,t=M.access(e,r);t||e.addEventListener(n,i,!0),M.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this,t=M.access(e,r)-1;t?M.access(e,r,t):(e.removeEventListener(n,i,!0),M.remove(e,r))}}}),C.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){for(s in"string"!=typeof t&&(n=n||t,t=void 0),e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=void 0):null==r&&("string"==typeof t?(r=n,n=void 0):(r=n,n=t,t=void 0)),!1===r)r=te;else if(!r)return this;return 1===i&&(o=r,(r=function(e){return C().off(e),o.apply(this,arguments)}).guid=o.guid||(o.guid=C.guid++)),this.each(function(){C.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,C(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"!=typeof e)return(!1===t||"function"==typeof t)&&(n=t,t=void 0),!1===n&&(n=te),this.each(function(){C.event.remove(this,e,n,t)});for(i in e)this.off(i,t,e[i]);return this},trigger:function(e,t){return this.each(function(){C.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?C.event.trigger(e,t,n,!0):void 0}});var re=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ie=/<([\w:]+)/,oe=/<|&#?\w+;/,se=/<(?:script|style|link)/i,ae=/checked\s*(?:[^=]|=\s*.checked.)/i,ue=/^$|\/(?:java|ecma)script/i,le=/^true\/(.*)/,ce=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,fe={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function pe(e,t){return C.nodeName(e,"table")&&C.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function de(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function he(e){var t=le.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function ge(e,t){for(var n=0,r=e.length;n<r;n++)M.set(e[n],"globalEval",!t||M.get(t[n],"globalEval"))}function me(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(M.hasData(e)&&(o=M.access(e),s=M.set(t,o),l=o.events))for(i in delete s.handle,s.events={},l)for(n=0,r=l[i].length;n<r;n++)C.event.add(t,i,l[i][n]);R.hasData(e)&&(a=R.access(e),u=C.extend({},a),R.set(t,u))}}function ve(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&C.nodeName(e,t)?C.merge([e],n):n}function ye(e,t){var n=t.nodeName.toLowerCase();"input"===n&&X.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}fe.optgroup=fe.option,fe.tbody=fe.tfoot=fe.colgroup=fe.caption=fe.thead,fe.th=fe.td,C.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=C.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||C.isXMLDoc(e)))for(s=ve(a),r=0,i=(o=ve(e)).length;r<i;r++)ye(o[r],s[r]);if(t)if(n)for(o=o||ve(e),s=s||ve(a),r=0,i=o.length;r<i;r++)me(o[r],s[r]);else me(e,a);return 0<(s=ve(a,"script")).length&&ge(s,!u&&ve(e,"script")),a},buildFragment:function(e,t,n,r){for(var i,o,s,a,u,l,c=t.createDocumentFragment(),f=[],p=0,d=e.length;p<d;p++)if((i=e[p])||0===i)if("object"===C.type(i))C.merge(f,i.nodeType?[i]:i);else if(oe.test(i)){for(o=o||c.appendChild(t.createElement("div")),s=(ie.exec(i)||["",""])[1].toLowerCase(),a=fe[s]||fe._default,o.innerHTML=a[1]+i.replace(re,"<$1></$2>")+a[2],l=a[0];l--;)o=o.lastChild;C.merge(f,o.childNodes),(o=c.firstChild).textContent=""}else f.push(t.createTextNode(i));for(c.textContent="",p=0;i=f[p++];)if((!r||-1===C.inArray(i,r))&&(u=C.contains(i.ownerDocument,i),o=ve(c.appendChild(i),"script"),u&&ge(o),n))for(l=0;i=o[l++];)ue.test(i.type||"")&&n.push(i);return c},cleanData:function(e){for(var t,n,r,i,o=C.event.special,s=0;void 0!==(n=e[s]);s++){if(C.acceptData(n)&&((i=n[M.expando])&&(t=M.cache[i]))){if(t.events)for(r in t.events)o[r]?C.event.remove(n,r):C.removeEvent(n,r,t.handle);M.cache[i]&&delete M.cache[i]}delete R.cache[n[R.expando]]}}}),C.fn.extend({text:function(e){return F(this,function(e){return void 0===e?C.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){var t;1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||pe(this,e).appendChild(e)})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pe(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,r=e?C.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||C.cleanData(ve(n)),n.parentNode&&(t&&C.contains(n.ownerDocument,n)&&ge(ve(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(C.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return C.clone(this,e,t)})},html:function(e){return F(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!se.test(e)&&!fe[(ie.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(re,"<$1></$2>");try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(C.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var t=arguments[0];return this.domManip(arguments,function(e){t=this.parentNode,C.cleanData(ve(this)),t&&t.replaceChild(e,this)}),t&&(t.length||t.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(n,r){n=g.apply([],n);var e,t,i,o,s,a,u=0,l=this.length,c=this,f=l-1,p=n[0],d=C.isFunction(p);if(d||1<l&&"string"==typeof p&&!v.checkClone&&ae.test(p))return this.each(function(e){var t=c.eq(e);d&&(n[0]=p.call(this,e,t.html())),t.domManip(n,r)});if(l&&(t=(e=C.buildFragment(n,this[0].ownerDocument,!1,this)).firstChild,1===e.childNodes.length&&(e=t),t)){for(o=(i=C.map(ve(e,"script"),de)).length;u<l;u++)s=e,u!==f&&(s=C.clone(s,!0,!0),o&&C.merge(i,ve(s,"script"))),r.call(this[u],s,u);if(o)for(a=i[i.length-1].ownerDocument,C.map(i,he),u=0;u<o;u++)s=i[u],ue.test(s.type||"")&&!M.access(s,"globalEval")&&C.contains(a,s)&&(s.src?C._evalUrl&&C._evalUrl(s.src):C.globalEval(s.textContent.replace(ce,"")))}return this}}),C.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,s){C.fn[e]=function(e){for(var t,n=[],r=C(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),C(r[o])[s](t),a.apply(n,t.get());return this.pushStack(n)}});var xe,be={};function we(e,t){var n,r=C(t.createElement(e)).appendTo(t.body),i=h.getDefaultComputedStyle&&(n=h.getDefaultComputedStyle(r[0]))?n.display:C.css(r[0],"display");return r.detach(),i}function Te(e){var t=y,n=be[e];return n||("none"!==(n=we(e,t))&&n||((t=(xe=(xe||C("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement))[0].contentDocument).write(),t.close(),n=we(e,t),xe.detach()),be[e]=n),n}var Ce=/^margin/,Ne=new RegExp("^("+I+")(?!px)[a-z%]+$","i"),ke=function(e){return e.ownerDocument.defaultView.getComputedStyle(e,null)};function Ee(e,t,n){var r,i,o,s,a=e.style;return(n=n||ke(e))&&(s=n.getPropertyValue(t)||n[t]),n&&(""!==s||C.contains(e.ownerDocument,e)||(s=C.style(e,t)),Ne.test(s)&&Ce.test(t)&&(r=a.width,i=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=r,a.minWidth=i,a.maxWidth=o)),void 0!==s?s+"":s}function Se(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}!function(){var t,n,r=y.documentElement,i=y.createElement("div"),o=y.createElement("div");if(o.style){function e(){o.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",o.innerHTML="",r.appendChild(i);var e=h.getComputedStyle(o,null);t="1%"!==e.top,n="4px"===e.width,r.removeChild(i)}o.style.backgroundClip="content-box",o.cloneNode(!0).style.backgroundClip="",v.clearCloneStyle="content-box"===o.style.backgroundClip,i.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",i.appendChild(o),h.getComputedStyle&&C.extend(v,{pixelPosition:function(){return e(),t},boxSizingReliable:function(){return null==n&&e(),n},reliableMarginRight:function(){var e,t=o.appendChild(y.createElement("div"));return t.style.cssText=o.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",o.style.width="1px",r.appendChild(i),e=!parseFloat(h.getComputedStyle(t,null).marginRight),r.removeChild(i),e}})}}(),C.swap=function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in i=n.apply(e,r||[]),t)e.style[o]=s[o];return i};var je=/^(none|table(?!-c[ea]).+)/,De=new RegExp("^("+I+")(.*)$","i"),Ae=new RegExp("^([+-])=("+I+")","i"),Le={position:"absolute",visibility:"hidden",display:"block"},qe={letterSpacing:"0",fontWeight:"400"},He=["Webkit","O","Moz","ms"];function Oe(e,t){if(t in e)return t;for(var n=t[0].toUpperCase()+t.slice(1),r=t,i=He.length;i--;)if((t=He[i]+n)in e)return t;return r}function Fe(e,t,n){var r=De.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Pe(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;o<4;o+=2)"margin"===n&&(s+=C.css(e,n+_[o],!0,i)),r?("content"===n&&(s-=C.css(e,"padding"+_[o],!0,i)),"margin"!==n&&(s-=C.css(e,"border"+_[o]+"Width",!0,i))):(s+=C.css(e,"padding"+_[o],!0,i),"padding"!==n&&(s+=C.css(e,"border"+_[o]+"Width",!0,i)));return s}function Me(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=ke(e),s="border-box"===C.css(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=Ee(e,t,o))<0||null==i)&&(i=e.style[t]),Ne.test(i))return i;r=s&&(v.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+Pe(e,t,n||(s?"border":"content"),r,o)+"px"}function Re(e,t){for(var n,r,i,o=[],s=0,a=e.length;s<a;s++)(r=e[s]).style&&(o[s]=M.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&z(r)&&(o[s]=M.access(r,"olddisplay",Te(r.nodeName)))):(i=z(r),"none"===n&&i||M.set(r,"olddisplay",i?n:C.css(r,"display"))));for(s=0;s<a;s++)(r=e[s]).style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}function We(e,t,n,r,i){return new We.prototype.init(e,t,n,r,i)}C.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ee(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=C.camelCase(t),u=e.style;return t=C.cssProps[a]||(C.cssProps[a]=Oe(u,a)),s=C.cssHooks[t]||C.cssHooks[a],void 0===n?s&&"get"in s&&void 0!==(i=s.get(e,!1,r))?i:u[t]:("string"===(o=typeof n)&&(i=Ae.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(C.css(e,t)),o="number"),void(null!=n&&n==n&&("number"!==o||C.cssNumber[a]||(n+="px"),v.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&void 0===(n=s.set(e,n,r))||(u[t]=n))))}},css:function(e,t,n,r){var i,o,s,a=C.camelCase(t);return t=C.cssProps[a]||(C.cssProps[a]=Oe(e.style,a)),(s=C.cssHooks[t]||C.cssHooks[a])&&"get"in s&&(i=s.get(e,!0,n)),void 0===i&&(i=Ee(e,t,r)),"normal"===i&&t in qe&&(i=qe[t]),""===n||n?(o=parseFloat(i),!0===n||C.isNumeric(o)?o||0:i):i}}),C.each(["height","width"],function(e,i){C.cssHooks[i]={get:function(e,t,n){return t?je.test(C.css(e,"display"))&&0===e.offsetWidth?C.swap(e,Le,function(){return Me(e,i,n)}):Me(e,i,n):void 0},set:function(e,t,n){var r=n&&ke(e);return Fe(e,t,n?Pe(e,i,n,"border-box"===C.css(e,"boxSizing",!1,r),r):0)}}}),C.cssHooks.marginRight=Se(v.reliableMarginRight,function(e,t){return t?C.swap(e,{display:"inline-block"},Ee,[e,"marginRight"]):void 0}),C.each({margin:"",padding:"",border:"Width"},function(i,o){C.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+_[t]+o]=r[t]||r[t-2]||r[0];return n}},Ce.test(i)||(C.cssHooks[i+o].set=Fe)}),C.fn.extend({css:function(e,t){return F(this,function(e,t,n){var r,i,o={},s=0;if(C.isArray(t)){for(r=ke(e),i=t.length;s<i;s++)o[t[s]]=C.css(e,t[s],!1,r);return o}return void 0!==n?C.style(e,t,n):C.css(e,t)},e,t,1<arguments.length)},show:function(){return Re(this,!0)},hide:function(){return Re(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){z(this)?C(this).show():C(this).hide()})}}),((C.Tween=We).prototype={constructor:We,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(C.cssNumber[n]?"":"px")},cur:function(){var e=We.propHooks[this.prop];return e&&e.get?e.get(this):We.propHooks._default.get(this)},run:function(e){var t,n=We.propHooks[this.prop];return this.pos=t=this.options.duration?C.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):We.propHooks._default.set(this),this}}).init.prototype=We.prototype,(We.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=C.css(e.elem,e.prop,""))&&"auto"!==t?t:0:e.elem[e.prop]},set:function(e){C.fx.step[e.prop]?C.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[C.cssProps[e.prop]]||C.cssHooks[e.prop])?C.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}}).scrollTop=We.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},C.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},C.fx=We.prototype.init,C.fx.step={};var $e,Be,Ie=/^(?:toggle|show|hide)$/,_e=new RegExp("^(?:([+-])=|)("+I+")([a-z%]*)$","i"),ze=/queueHooks$/,Xe=[Ze],Ue={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=_e.exec(t),o=i&&i[3]||(C.cssNumber[e]?"":"px"),s=(C.cssNumber[e]||"px"!==o&&+r)&&_e.exec(C.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o)for(o=o||s[3],i=i||[],s=+r||1;s/=a=a||".5",C.style(n.elem,e,s+o),a!==(a=n.cur()/r)&&1!==a&&--u;);return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]},Ve,Ye,Ge;function Qe(){return setTimeout(function(){$e=void 0}),$e=C.now()}function Je(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=_[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function Ke(e,t,n){for(var r,i=(Ue[t]||[]).concat(Ue["*"]),o=0,s=i.length;o<s;o++)if(r=i[o].call(n,t,e))return r}function Ze(t,e,n){var r,i,o,s,a,u,l,c,f=this,p={},d=t.style,h=t.nodeType&&z(t),g=M.get(t,"fxshow");for(r in n.queue||(null==(a=C._queueHooks(t,"fx")).unqueued&&(a.unqueued=0,u=a.empty.fire,a.empty.fire=function(){a.unqueued||u()}),a.unqueued++,f.always(function(){f.always(function(){a.unqueued--,C.queue(t,"fx").length||a.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===(c="none"===(l=C.css(t,"display"))?M.get(t,"olddisplay")||Te(t.nodeName):l)&&"none"===C.css(t,"float")&&(d.display="inline-block")),n.overflow&&(d.overflow="hidden",f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]})),e)if(i=e[r],Ie.exec(i)){if(delete e[r],o=o||"toggle"===i,i===(h?"hide":"show")){if("show"!==i||!g||void 0===g[r])continue;h=!0}p[r]=g&&g[r]||C.style(t,r)}else l=void 0;if(C.isEmptyObject(p))"inline"===("none"===l?Te(t.nodeName):l)&&(d.display=l);else for(r in g?"hidden"in g&&(h=g.hidden):g=M.access(t,"fxshow",{}),o&&(g.hidden=!h),h?C(t).show():f.done(function(){C(t).hide()}),f.done(function(){var e;for(e in M.remove(t,"fxshow"),p)C.style(t,e,p[e])}),p)s=Ke(h?g[r]:0,r,f),r in g||(g[r]=s.start,h&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}function et(e,t){var n,r,i,o,s;for(n in e)if(i=t[r=C.camelCase(n)],o=e[n],C.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(s=C.cssHooks[r])&&"expand"in s)for(n in o=s.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}function tt(s,e,t){var n,a,r=0,i=Xe.length,u=C.Deferred().always(function(){delete o.elem}),o=function(){if(a)return!1;for(var e=$e||Qe(),t=Math.max(0,l.startTime+l.duration-e),n,r=1-(t/l.duration||0),i=0,o=l.tweens.length;i<o;i++)l.tweens[i].run(r);return u.notifyWith(s,[l,r,t]),r<1&&o?t:(u.resolveWith(s,[l]),!1)},l=u.promise({elem:s,props:C.extend({},e),opts:C.extend(!0,{specialEasing:{}},t),originalProperties:e,originalOptions:t,startTime:$e||Qe(),duration:t.duration,tweens:[],createTween:function(e,t){var n=C.Tween(s,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?u.resolveWith(s,[l,e]):u.rejectWith(s,[l,e]),this}}),c=l.props;for(et(c,l.opts.specialEasing);r<i;r++)if(n=Xe[r].call(l,s,c,l.opts))return n;return C.map(c,Ke,l),C.isFunction(l.opts.start)&&l.opts.start.call(s,l),C.fx.timer(C.extend(o,{elem:s,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}C.Animation=C.extend(tt,{tweener:function(e,t){for(var n,r=0,i=(e=C.isFunction(e)?(t=e,["*"]):e.split(" ")).length;r<i;r++)n=e[r],Ue[n]=Ue[n]||[],Ue[n].unshift(t)},prefilter:function(e,t){t?Xe.unshift(e):Xe.push(e)}}),C.speed=function(e,t,n){var r=e&&"object"==typeof e?C.extend({},e):{complete:n||!n&&t||C.isFunction(e)&&e,duration:e,easing:n&&t||t&&!C.isFunction(t)&&t};return r.duration=C.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in C.fx.speeds?C.fx.speeds[r.duration]:C.fx.speeds._default,(null==r.queue||!0===r.queue)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){C.isFunction(r.old)&&r.old.call(this),r.queue&&C.dequeue(this,r.queue)},r},C.fn.extend({fadeTo:function(e,t,n,r){return this.filter(z).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=C.isEmptyObject(t),o=C.speed(e,n,r),s=function(){var e=tt(this,C.extend({},t),o);(i||M.get(this,"finish"))&&e.stop(!0)};return s.finish=s,i||!1===o.queue?this.each(s):this.queue(o.queue,s)},stop:function(i,e,o){var s=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&!1!==i&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=C.timers,r=M.get(this);if(t)r[t]&&r[t].stop&&s(r[t]);else for(t in r)r[t]&&r[t].stop&&ze.test(t)&&s(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));(e||!o)&&C.dequeue(this,i)})},finish:function(s){return!1!==s&&(s=s||"fx"),this.each(function(){var e,t=M.get(this),n=t[s+"queue"],r=t[s+"queueHooks"],i=C.timers,o=n?n.length:0;for(t.finish=!0,C.queue(this,s,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===s&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),C.each(["toggle","show","hide"],function(e,r){var i=C.fn[r];C.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(Je(r,!0),e,t,n)}}),C.each({slideDown:Je("show"),slideUp:Je("hide"),slideToggle:Je("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){C.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),C.timers=[],C.fx.tick=function(){var e,t=0,n=C.timers;for($e=C.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||C.fx.stop(),$e=void 0},C.fx.timer=function(e){C.timers.push(e),e()?C.fx.start():C.timers.pop()},C.fx.interval=13,C.fx.start=function(){Be||(Be=setInterval(C.fx.tick,C.fx.interval))},C.fx.stop=function(){clearInterval(Be),Be=null},C.fx.speeds={slow:600,fast:200,_default:400},C.fn.delay=function(r,e){return r=C.fx&&C.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=setTimeout(e,r);t.stop=function(){clearTimeout(n)}})},Ve=y.createElement("input"),Ye=y.createElement("select"),Ge=Ye.appendChild(y.createElement("option")),Ve.type="checkbox",v.checkOn=""!==Ve.value,v.optSelected=Ge.selected,Ye.disabled=!0,v.optDisabled=!Ge.disabled,(Ve=y.createElement("input")).value="t",Ve.type="radio",v.radioValue="t"===Ve.value;var nt,rt,it=C.expr.attrHandle;C.fn.extend({attr:function(e,t){return F(this,C.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){C.removeAttr(this,e)})}}),C.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===G?C.prop(e,t,n):(1===o&&C.isXMLDoc(e)||(t=t.toLowerCase(),r=C.attrHooks[t]||(C.expr.match.bool.test(t)?rt:nt)),void 0===n?r&&"get"in r&&null!==(i=r.get(e,t))?i:null==(i=C.find.attr(e,t))?void 0:i:null!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):void C.removeAttr(e,t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(A);if(o&&1===e.nodeType)for(;n=o[i++];)r=C.propFix[n]||n,C.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!v.radioValue&&"radio"===t&&C.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),rt={set:function(e,t,n){return!1===t?C.removeAttr(e,n):e.setAttribute(n,n),n}},C.each(C.expr.match.bool.source.match(/\w+/g),function(e,t){var o=it[t]||C.find.attr;it[t]=function(e,t,n){var r,i;return n||(i=it[t],it[t]=r,r=null!=o(e,t,n)?t.toLowerCase():null,it[t]=i),r}});var ot=/^(?:input|select|textarea|button)$/i;C.fn.extend({prop:function(e,t){return F(this,C.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[C.propFix[e]||e]})}}),C.extend({propFix:{for:"htmlFor",class:"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return(o=1!==s||!C.isXMLDoc(e))&&(t=C.propFix[t]||t,i=C.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||ot.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),v.optSelected||(C.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),C.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){C.propFix[this.toLowerCase()]=this});var st=/[\t\r\n\f]/g;C.fn.extend({addClass:function(t){var e,n,r,i,o,s,a="string"==typeof t&&t,u=0,l=this.length;if(C.isFunction(t))return this.each(function(e){C(this).addClass(t.call(this,e,this.className))});if(a)for(e=(t||"").match(A)||[];u<l;u++)if(r=1===(n=this[u]).nodeType&&(n.className?(" "+n.className+" ").replace(st," "):" ")){for(o=0;i=e[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");s=C.trim(r),n.className!==s&&(n.className=s)}return this},removeClass:function(t){var e,n,r,i,o,s,a=0===arguments.length||"string"==typeof t&&t,u=0,l=this.length;if(C.isFunction(t))return this.each(function(e){C(this).removeClass(t.call(this,e,this.className))});if(a)for(e=(t||"").match(A)||[];u<l;u++)if(r=1===(n=this[u]).nodeType&&(n.className?(" "+n.className+" ").replace(st," "):"")){for(o=0;i=e[o++];)for(;0<=r.indexOf(" "+i+" ");)r=r.replace(" "+i+" "," ");s=t?C.trim(r):"",n.className!==s&&(n.className=s)}return this},toggleClass:function(i,t){var o=typeof i;return"boolean"==typeof t&&"string"===o?t?this.addClass(i):this.removeClass(i):this.each(C.isFunction(i)?function(e){C(this).toggleClass(i.call(this,e,this.className,t),t)}:function(){if("string"===o)for(var e,t=0,n=C(this),r=i.match(A)||[];e=r[t++];)n.hasClass(e)?n.removeClass(e):n.addClass(e);else(o===G||"boolean"===o)&&(this.className&&M.set(this,"__className__",this.className),this.className=this.className||!1===i?"":M.get(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;n<r;n++)if(1===this[n].nodeType&&0<=(" "+this[n].className+" ").replace(st," ").indexOf(t))return!0;return!1}});var at=/\r/g;C.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=C.isFunction(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,C(this).val()):n)?t="":"number"==typeof t?t+="":C.isArray(t)&&(t=C.map(t,function(e){return null==e?"":e+""})),(r=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=C.valHooks[t.type]||C.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(at,""):null==e?"":e:void 0}}),C.extend({valHooks:{option:{get:function(e){var t=C.find.attr(e,"value");return null!=t?t:C.trim(C.text(e))}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,s=o?null:[],a=o?i+1:r.length,u=i<0?a:o?i:0;u<a;u++)if(!(!(n=r[u]).selected&&u!==i||(v.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&C.nodeName(n.parentNode,"optgroup"))){if(t=C(n).val(),o)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=C.makeArray(t),s=i.length;s--;)((r=i[s]).selected=0<=C.inArray(r.value,o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),C.each(["radio","checkbox"],function(){C.valHooks[this]={set:function(e,t){return C.isArray(t)?e.checked=0<=C.inArray(C(e).val(),t):void 0}},v.checkOn||(C.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),C.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,n){C.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}}),C.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var ut=C.now(),lt=/\?/;C.parseJSON=function(e){return JSON.parse(e+"")},C.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(n=new DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return(!t||t.getElementsByTagName("parsererror").length)&&C.error("Invalid XML: "+e),t};var ct,ft,pt=/#.*$/,dt=/([?&])_=[^&]*/,ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,gt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,mt=/^(?:GET|HEAD)$/,vt=/^\/\//,yt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,xt={},bt={},wt="*/".concat("*");try{ft=location.href}catch(e){(ft=y.createElement("a")).href="",ft=ft.href}function Tt(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(A)||[];if(C.isFunction(t))for(;n=i[r++];)"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Ct(t,i,o,s){var a={},u=t===bt;function l(e){var r;return a[e]=!0,C.each(t[e]||[],function(e,t){var n=t(i,o,s);return"string"!=typeof n||u||a[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!a["*"]&&l("*")}function Nt(e,t){var n,r,i=C.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&C.extend(!0,e,r),e}function kt(e,t,n){for(var r,i,o,s,a=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}s||(s=i)}o=o||s}return o?(o!==u[0]&&u.unshift(o),n[o]):void 0}function Et(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];for(o=c.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(s=l[u+" "+o]||l["* "+o]))for(i in l)if((a=i.split(" "))[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){!0===s?s=l[i]:!0!==l[i]&&(o=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}ct=yt.exec(ft.toLowerCase())||[],C.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ft,type:"GET",isLocal:gt.test(ct[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":wt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":C.parseJSON,"text xml":C.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Nt(Nt(e,C.ajaxSettings),t):Nt(C.ajaxSettings,e)},ajaxPrefilter:Tt(xt),ajaxTransport:Tt(bt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,i,g=C.ajaxSetup({},t),m=g.context||g,v=g.context&&(m.nodeType||m.jquery)?C(m):C.event,y=C.Deferred(),x=C.Callbacks("once memory"),b=g.statusCode||{},o={},s={},w=0,a="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===w){if(!n)for(n={};t=ht.exec(p);)n[t[1].toLowerCase()]=t[2];t=n[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===w?p:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return w||(e=s[n]=s[n]||e,o[e]=t),this},overrideMimeType:function(e){return w||(g.mimeType=e),this},statusCode:function(e){var t;if(e)if(w<2)for(t in e)b[t]=[b[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||a;return c&&c.abort(t),u(0,t),this}};if(y.promise(T).complete=x.add,T.success=T.done,T.error=T.fail,g.url=((e||g.url||ft)+"").replace(pt,"").replace(vt,ct[1]+"//"),g.type=t.method||t.type||g.method||g.type,g.dataTypes=C.trim(g.dataType||"*").toLowerCase().match(A)||[""],null==g.crossDomain&&(r=yt.exec(g.url.toLowerCase()),g.crossDomain=!(!r||r[1]===ct[1]&&r[2]===ct[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(ct[3]||("http:"===ct[1]?"80":"443")))),g.data&&g.processData&&"string"!=typeof g.data&&(g.data=C.param(g.data,g.traditional)),Ct(xt,g,t,T),2===w)return T;for(i in(h=g.global)&&0==C.active++&&C.event.trigger("ajaxStart"),g.type=g.type.toUpperCase(),g.hasContent=!mt.test(g.type),f=g.url,g.hasContent||(g.data&&(f=g.url+=(lt.test(f)?"&":"?")+g.data,delete g.data),!1===g.cache&&(g.url=dt.test(f)?f.replace(dt,"$1_="+ut++):f+(lt.test(f)?"&":"?")+"_="+ut++)),g.ifModified&&(C.lastModified[f]&&T.setRequestHeader("If-Modified-Since",C.lastModified[f]),C.etag[f]&&T.setRequestHeader("If-None-Match",C.etag[f])),(g.data&&g.hasContent&&!1!==g.contentType||t.contentType)&&T.setRequestHeader("Content-Type",g.contentType),T.setRequestHeader("Accept",g.dataTypes[0]&&g.accepts[g.dataTypes[0]]?g.accepts[g.dataTypes[0]]+("*"!==g.dataTypes[0]?", "+wt+"; q=0.01":""):g.accepts["*"]),g.headers)T.setRequestHeader(i,g.headers[i]);if(g.beforeSend&&(!1===g.beforeSend.call(m,T,g)||2===w))return T.abort();for(i in a="abort",{success:1,error:1,complete:1})T[i](g[i]);if(c=Ct(bt,g,t,T)){T.readyState=1,h&&v.trigger("ajaxSend",[T,g]),g.async&&0<g.timeout&&(d=setTimeout(function(){T.abort("timeout")},g.timeout));try{w=1,c.send(o,u)}catch(e){if(!(w<2))throw e;u(-1,e)}}else u(-1,"No Transport");function u(e,t,n,r){var i,o,s,a,u,l=t;2!==w&&(w=2,d&&clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(a=kt(g,T,n)),a=Et(g,a,T,i),i?(g.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(C.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(C.etag[f]=u)),204===e||"HEAD"===g.type?l="nocontent":304===e?l="notmodified":(l=a.state,o=a.data,i=!(s=a.error))):(s=l,(e||!l)&&(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?y.resolveWith(m,[o,l,T]):y.rejectWith(m,[T,l,s]),T.statusCode(b),b=void 0,h&&v.trigger(i?"ajaxSuccess":"ajaxError",[T,g,i?o:s]),x.fireWith(m,[T,l]),h&&(v.trigger("ajaxComplete",[T,g]),--C.active||C.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return C.get(e,t,n,"json")},getScript:function(e,t){return C.get(e,void 0,t,"script")}}),C.each(["get","post"],function(e,i){C[i]=function(e,t,n,r){return C.isFunction(t)&&(r=r||n,n=t,t=void 0),C.ajax({url:e,type:i,dataType:r,data:t,success:n})}}),C.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){C.fn[t]=function(e){return this.on(t,e)}}),C._evalUrl=function(e){return C.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},C.fn.extend({wrapAll:function(t){var e;return C.isFunction(t)?this.each(function(e){C(this).wrapAll(t.call(this,e))}):(this[0]&&(e=C(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(n){return this.each(C.isFunction(n)?function(e){C(this).wrapInner(n.call(this,e))}:function(){var e=C(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=C.isFunction(t);return this.each(function(e){C(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(){return this.parent().each(function(){C.nodeName(this,"body")||C(this).replaceWith(this.childNodes)}).end()}}),C.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},C.expr.filters.visible=function(e){return!C.expr.filters.hidden(e)};var St=/%20/g,jt=/\[\]$/,Dt=/\r?\n/g,At=/^(?:submit|button|image|reset|file)$/i,Lt=/^(?:input|select|textarea|keygen)/i;function qt(n,e,r,i){var t;if(C.isArray(e))C.each(e,function(e,t){r||jt.test(n)?i(n,t):qt(n+"["+("object"==typeof t?e:"")+"]",t,r,i)});else if(r||"object"!==C.type(e))i(n,e);else for(t in e)qt(n+"["+t+"]",e[t],r,i)}C.param=function(e,t){var n,r=[],i=function(e,t){t=C.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=C.ajaxSettings&&C.ajaxSettings.traditional),C.isArray(e)||e.jquery&&!C.isPlainObject(e))C.each(e,function(){i(this.name,this.value)});else for(n in e)qt(n,e[n],t,i);return r.join("&").replace(St,"+")},C.fn.extend({serialize:function(){return C.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=C.prop(this,"elements");return e?C.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!C(this).is(":disabled")&&Lt.test(this.nodeName)&&!At.test(e)&&(this.checked||!X.test(e))}).map(function(e,t){var n=C(this).val();return null==n?null:C.isArray(n)?C.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}}),C.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var Ht=0,Ot={},Ft={0:200,1223:204},Pt=C.ajaxSettings.xhr();h.ActiveXObject&&C(h).on("unload",function(){for(var e in Ot)Ot[e]()}),v.cors=!!Pt&&"withCredentials"in Pt,v.ajax=Pt=!!Pt,C.ajaxTransport(function(o){var s;return v.cors||Pt&&!o.crossDomain?{send:function(e,t){var n,r=o.xhr(),i=++Ht;if(r.open(o.type,o.url,o.async,o.username,o.password),o.xhrFields)for(n in o.xhrFields)r[n]=o.xhrFields[n];for(n in o.mimeType&&r.overrideMimeType&&r.overrideMimeType(o.mimeType),o.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);s=function(e){return function(){s&&(delete Ot[i],s=r.onload=r.onerror=null,"abort"===e?r.abort():"error"===e?t(r.status,r.statusText):t(Ft[r.status]||r.status,r.statusText,"string"==typeof r.responseText?{text:r.responseText}:void 0,r.getAllResponseHeaders()))}},r.onload=s(),r.onerror=s("error"),s=Ot[i]=s("abort");try{r.send(o.hasContent&&o.data||null)}catch(e){if(s)throw e}},abort:function(){s&&s()}}:void 0}),C.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return C.globalEval(e),e}}}),C.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),C.ajaxTransport("script",function(n){var r,i;if(n.crossDomain)return{send:function(e,t){r=C("<script>").prop({async:!0,charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),y.head.appendChild(r[0])},abort:function(){i&&i()}}});var Mt=[],Rt=/(=)\?(?=&|$)|\?\?/;C.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mt.pop()||C.expando+"_"+ut++;return this[e]=!0,e}}),C.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,s=!1!==e.jsonp&&(Rt.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rt.test(e.data)&&"data");return s||"jsonp"===e.dataTypes[0]?(r=e.jsonpCallback=C.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(Rt,"$1"+r):!1!==e.jsonp&&(e.url+=(lt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||C.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=h[r],h[r]=function(){o=arguments},n.always(function(){h[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Mt.push(r)),o&&C.isFunction(i)&&i(o[0]),o=i=void 0}),"script"):void 0}),C.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||y;var r=b.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=C.buildFragment([e],t,i),i&&i.length&&C(i).remove(),C.merge([],r.childNodes))};var Wt=C.fn.load;C.fn.load=function(e,t,n){if("string"!=typeof e&&Wt)return Wt.apply(this,arguments);var r,i,o,s=this,a=e.indexOf(" ");return 0<=a&&(r=C.trim(e.slice(a)),e=e.slice(0,a)),C.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<s.length&&C.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){o=arguments,s.html(r?C("<div>").append(C.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){s.each(n,o||[e.responseText,t,e])}),this},C.expr.filters.animated=function(t){return C.grep(C.timers,function(e){return t===e.elem}).length};var $t=h.document.documentElement;function Bt(e){return C.isWindow(e)?e:9===e.nodeType&&e.defaultView}C.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l,c=C.css(e,"position"),f=C(e),p={};"static"===c&&(e.style.position="relative"),a=f.offset(),o=C.css(e,"top"),u=C.css(e,"left"),i=(l=("absolute"===c||"fixed"===c)&&-1<(o+u).indexOf("auto"))?(s=(r=f.position()).top,r.left):(s=parseFloat(o)||0,parseFloat(u)||0),C.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(p.top=t.top-a.top+s),null!=t.left&&(p.left=t.left-a.left+i),"using"in t?t.using.call(e,p):f.css(p)}},C.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){C.offset.setOffset(this,t,e)});var e,n,r=this[0],i={top:0,left:0},o=r&&r.ownerDocument;return o?(e=o.documentElement,C.contains(e,r)?(typeof r.getBoundingClientRect!==G&&(i=r.getBoundingClientRect()),n=Bt(o),{top:i.top+n.pageYOffset-e.clientTop,left:i.left+n.pageXOffset-e.clientLeft}):i):void 0},position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===C.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),C.nodeName(e[0],"html")||(r=e.offset()),r.top+=C.css(e[0],"borderTopWidth",!0),r.left+=C.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-C.css(n,"marginTop",!0),left:t.left-r.left-C.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||$t;e&&!C.nodeName(e,"html")&&"static"===C.css(e,"position");)e=e.offsetParent;return e||$t})}}),C.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;C.fn[t]=function(e){return F(this,function(e,t,n){var r=Bt(e);return void 0===n?r?r[i]:e[t]:void(r?r.scrollTo(o?h.pageXOffset:n,o?n:h.pageYOffset):e[t]=n)},t,e,arguments.length,null)}}),C.each(["top","left"],function(e,n){C.cssHooks[n]=Se(v.pixelPosition,function(e,t){return t?(t=Ee(e,n),Ne.test(t)?C(e).position()[n]+"px":t):void 0})}),C.each({Height:"height",Width:"width"},function(o,s){C.each({padding:"inner"+o,content:s,"":"outer"+o},function(r,e){C.fn[e]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return F(this,function(e,t,n){var r;return C.isWindow(e)?e.document.documentElement["client"+o]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+o],r["scroll"+o],e.body["offset"+o],r["offset"+o],r["client"+o])):void 0===n?C.css(e,t,i):C.style(e,t,n,i)},s,n?e:void 0,n,null)}})}),C.fn.size=function(){return this.length},C.fn.andSelf=C.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return C});var It=h.jQuery,_t=h.$;return C.noConflict=function(e){return h.$===C&&(h.$=_t),e&&h.jQuery===C&&(h.jQuery=It),C},typeof e===G&&(h.jQuery=h.$=C),C});;
- "use strict";jQuery.each(["arraybuffer","blob"],function(e,y){jQuery.ajaxTransport(y,function(u){var a=0,d={},e,e=!!(e=jQuery.ajaxSettings.xhr())&&"withCredentials"in e;if(window.attachEvent&&window.attachEvent("onunload",function(){for(var e in d)d[+e](void 0,!0)}),!u.crossDomain||e){var c=null;return{send:function(e,o){var r,s=u.xhr(),i=++a;if(s.open(u.type+"",u.url+"",u.async,u.username,u.password),s.responseType=y,u.xhrFields)for(r in u.xhrFields)s[r]=u.xhrFields[r];for(r in u.mimeType&&s.overrideMimeType&&s.overrideMimeType(u.mimeType),u.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)void 0!==e[r]&&s.setRequestHeader(r,e[r]+"");s.send(u.hasContent&&u.data||null),c=function(e,r){var a,t,n;if(c&&(r||4===s.readyState))if(delete d[i],c=null,s.onreadystatechange=jQuery.noop,r)4!==s.readyState&&s.abort();else{n={},a=s.status;try{"arraybuffer"===y&&(n.arraybuffer=s.response),"blob"===y&&(n.blob=s.response)}catch(e){}try{t=s.statusText}catch(e){t=""}a||!u.isLocal||u.crossDomain||"arraybuffer"!==y?a||!u.isLocal||u.crossDomain||"blob"!==y?1223===a&&(a=204):a=n.blob?200:404:a=n.arraybuffer?200:404}n&&o(+a,t+"",n,s.getAllResponseHeaders())},u.async?4===s.readyState?window.setTimeout(c):s.onreadystatechange=d[i]=c:c()},abort:function(){c&&c(void 0,!0)}}}})});;
- !function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||g;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var n=this||g;if(e=parseFloat(e),n.ctx||l(),void 0!==e&&0<=e&&e<=1){if(n._volume=e,n._muted)return n;n.usingWebAudio&&n.masterGain.gain.setValueAtTime(e,g.ctx.currentTime);for(var t=0;t<n._howls.length;t++)if(!n._howls[t]._webAudio)for(var o=n._howls[t]._getSoundIds(),r=0;r<o.length;r++){var a=n._howls[t]._soundById(o[r]);a&&a._node&&(a._node.volume=a._volume*e)}return n}return n._volume},mute:function(e){var n=this||g;n.ctx||l(),n._muted=e,n.usingWebAudio&&n.masterGain.gain.setValueAtTime(e?0:n._volume,g.ctx.currentTime);for(var t=0;t<n._howls.length;t++)if(!n._howls[t]._webAudio)for(var o=n._howls[t]._getSoundIds(),r=0;r<o.length;r++){var a=n._howls[t]._soundById(o[r]);a&&a._node&&(a._node.muted=!!e||a._muted)}return n},unload:function(){for(var e=this||g,n=e._howls.length-1;0<=n;n--)e._howls[n].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,l()),e},codecs:function(e){return(this||g)._codecs[e.replace(/^x-/,"")]},_setup:function(){var n=this||g;if(n.state=n.ctx&&n.ctx.state||"suspended",n._autoSuspend(),!n.usingWebAudio)if("undefined"!=typeof Audio)try{var e;void 0===(e=new Audio).oncanplaythrough&&(n._canPlayEvent="canplay")}catch(e){n.noAudio=!0}else n.noAudio=!0;try{var e;(e=new Audio).muted&&(n.noAudio=!0)}catch(n){}return n.noAudio||n._setupCodecs(),n},_setupCodecs:function(){var n=this||g,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return n}if(!e||"function"!=typeof e.canPlayType)return n;var t=e.canPlayType("audio/mpeg;").replace(/^no$/,""),o=n._navigator&&n._navigator.userAgent.match(/OPR\/([0-6].)/g),r=o&&parseInt(o[0].split("/")[1],10)<33;return n._codecs={mp3:!(r||!t&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},n},_unlockAudio:function(){var u=this||g;if(!u._audioUnlocked&&u.ctx){u._audioUnlocked=!1,u.autoUnlock=!1,u._mobileUnloaded||44100===u.ctx.sampleRate||(u._mobileUnloaded=!0,u.unload()),u._scratchBuffer=u.ctx.createBuffer(1,1,22050);var d=function(e){for(var n=0;n<u.html5PoolSize;n++)try{var t=new Audio;t._unlocked=!0,u._releaseHtml5Audio(t)}catch(e){u.noAudio=!0}for(var n=0;n<u._howls.length;n++)if(!u._howls[n]._webAudio)for(var o=u._howls[n]._getSoundIds(),r=0;r<o.length;r++){var a=u._howls[n]._soundById(o[r]);a&&a._node&&!a._node._unlocked&&(a._node._unlocked=!0,a._node.load())}u._autoResume();var i=u.ctx.createBufferSource();i.buffer=u._scratchBuffer,i.connect(u.ctx.destination),void 0===i.start?i.noteOn(0):i.start(0),"function"==typeof u.ctx.resume&&u.ctx.resume(),i.onended=function(){i.disconnect(0),u._audioUnlocked=!0,document.removeEventListener("touchstart",d,!0),document.removeEventListener("touchend",d,!0),document.removeEventListener("click",d,!0);for(var e=0;e<u._howls.length;e++)u._howls[e]._emit("unlock")}};return document.addEventListener("touchstart",d,!0),document.addEventListener("touchend",d,!0),document.addEventListener("click",d,!0),u}},_obtainHtml5Audio:function(){var e=this||g;if(e._html5AudioPool.length)return e._html5AudioPool.pop();var n=(new Audio).play();return n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)&&n.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(e){var n=this||g;return e._unlocked&&n._html5AudioPool.push(e),n},_autoSuspend:function(){var e=this;if(e.autoSuspend&&e.ctx&&void 0!==e.ctx.suspend&&g.usingWebAudio){for(var n=0;n<e._howls.length;n++)if(e._howls[n]._webAudio)for(var t=0;t<e._howls[n]._sounds.length;t++)if(!e._howls[n]._sounds[t]._paused)return e;return e._suspendTimer&&clearTimeout(e._suspendTimer),e._suspendTimer=setTimeout(function(){e.autoSuspend&&(e._suspendTimer=null,e.state="suspending",e.ctx.suspend().then(function(){e.state="suspended",e._resumeAfterSuspend&&(delete e._resumeAfterSuspend,e._autoResume())}))},3e4),e}},_autoResume:function(){var n=this;if(n.ctx&&void 0!==n.ctx.resume&&g.usingWebAudio)return"running"===n.state&&n._suspendTimer?(clearTimeout(n._suspendTimer),n._suspendTimer=null):"suspended"===n.state?(n.ctx.resume().then(function(){n.state="running";for(var e=0;e<n._howls.length;e++)n._howls[e]._emit("resume")}),n._suspendTimer&&(clearTimeout(n._suspendTimer),n._suspendTimer=null)):"suspending"===n.state&&(n._resumeAfterSuspend=!0),n}};var g=new e,n=function(e){var n=this;e.src&&0!==e.src.length?n.init(e):console.error("An array of source files must be passed with any new Howl.")};n.prototype={init:function(e){var n=this;return g.ctx||l(),n._autoplay=e.autoplay||!1,n._format="string"!=typeof e.format?e.format:[e.format],n._html5=e.html5||!1,n._muted=e.mute||!1,n._loop=e.loop||!1,n._pool=e.pool||5,n._preload="boolean"!=typeof e.preload||e.preload,n._rate=e.rate||1,n._sprite=e.sprite||{},n._src="string"!=typeof e.src?e.src:[e.src],n._volume=void 0!==e.volume?e.volume:1,n._xhrWithCredentials=e.xhrWithCredentials||!1,n._duration=0,n._state="unloaded",n._sounds=[],n._endTimers={},n._queue=[],n._playLock=!1,n._onend=e.onend?[{fn:e.onend}]:[],n._onfade=e.onfade?[{fn:e.onfade}]:[],n._onload=e.onload?[{fn:e.onload}]:[],n._onloaderror=e.onloaderror?[{fn:e.onloaderror}]:[],n._onplayerror=e.onplayerror?[{fn:e.onplayerror}]:[],n._onpause=e.onpause?[{fn:e.onpause}]:[],n._onplay=e.onplay?[{fn:e.onplay}]:[],n._onstop=e.onstop?[{fn:e.onstop}]:[],n._onmute=e.onmute?[{fn:e.onmute}]:[],n._onvolume=e.onvolume?[{fn:e.onvolume}]:[],n._onrate=e.onrate?[{fn:e.onrate}]:[],n._onseek=e.onseek?[{fn:e.onseek}]:[],n._onunlock=e.onunlock?[{fn:e.onunlock}]:[],n._onresume=[],n._webAudio=g.usingWebAudio&&!n._html5,void 0!==g.ctx&&g.ctx&&g.autoUnlock&&g._unlockAudio(),g._howls.push(n),n._autoplay&&n._queue.push({event:"play",action:function(){n.play()}}),n._preload&&n.load(),n},load:function(){var e=this,n=null;if(!g.noAudio){"string"==typeof e._src&&(e._src=[e._src]);for(var t=0;t<e._src.length;t++){var o,r;if(e._format&&e._format[t])o=e._format[t];else{if("string"!=typeof(r=e._src[t])){e._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(o=/^data:audio\/([^;,]+);/i.exec(r))||(o=/\.([^.]+)$/.exec(r.split("?",1)[0])),o&&(o=o[1].toLowerCase())}if(o||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),o&&g.codecs(o)){n=e._src[t];break}}return n?(e._src=n,e._state="loading","https:"===window.location.protocol&&"http:"===n.slice(0,5)&&(e._html5=!0,e._webAudio=!1),new a(e),e._webAudio&&u(e),e):void e._emit("loaderror",null,"No codec support for selected audio sources.")}e._emit("loaderror",null,"No audio support.")},play:function(n,t){var o=this,e=null;if("number"==typeof n)e=n,n=null;else{if("string"==typeof n&&"loaded"===o._state&&!o._sprite[n])return null;if(void 0===n&&(n="__default",!o._playLock)){for(var r=0,a=0;a<o._sounds.length;a++)o._sounds[a]._paused&&!o._sounds[a]._ended&&(r++,e=o._sounds[a]._id);1===r?n=null:e=null}}var i=e?o._soundById(e):o._inactiveSound();if(!i)return null;if(e&&!n&&(n=i._sprite||"__default"),"loaded"!==o._state){i._sprite=n,i._ended=!1;var u=i._id;return o._queue.push({event:"play",action:function(){o.play(u)}}),u}if(e&&!i._paused)return t||o._loadQueue("play"),i._id;o._webAudio&&g._autoResume();var d=Math.max(0,0<i._seek?i._seek:o._sprite[n][0]/1e3),_=Math.max(0,(o._sprite[n][0]+o._sprite[n][1])/1e3-d),s=1e3*_/Math.abs(i._rate),l=o._sprite[n][0]/1e3,c=(o._sprite[n][0]+o._sprite[n][1])/1e3,p=!(!i._loop&&!o._sprite[n][2]);i._sprite=n,i._ended=!1;var f=function(){i._paused=!1,i._seek=d,i._start=l,i._stop=c,i._loop=p};if(!(c<=d)){var m=i._node;if(o._webAudio){var v=function(){o._playLock=!1,f(),o._refreshBuffer(i);var e=i._muted||o._muted?0:i._volume;m.gain.setValueAtTime(e,g.ctx.currentTime),i._playStart=g.ctx.currentTime,void 0===m.bufferSource.start?i._loop?m.bufferSource.noteGrainOn(0,d,86400):m.bufferSource.noteGrainOn(0,d,_):i._loop?m.bufferSource.start(0,d,86400):m.bufferSource.start(0,d,_),s!==1/0&&(o._endTimers[i._id]=setTimeout(o._ended.bind(o,i),s)),t||setTimeout(function(){o._emit("play",i._id),o._loadQueue()},0)};"running"===g.state?v():(o._playLock=!0,o.once("resume",v),o._clearTimer(i._id))}else{var h=function(){m.currentTime=d,m.muted=i._muted||o._muted||g._muted||m.muted,m.volume=i._volume*g.volume(),m.playbackRate=i._rate;try{var e=m.play();if(e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)?(o._playLock=!0,f(),e.then(function(){o._playLock=!1,m._unlocked=!0,t||(o._emit("play",i._id),o._loadQueue())}).catch(function(){o._playLock=!1,o._emit("playerror",i._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),i._ended=!0,i._paused=!0})):t||(o._playLock=!1,f(),o._emit("play",i._id),o._loadQueue()),m.playbackRate=i._rate,m.paused)return void o._emit("playerror",i._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==n||i._loop?o._endTimers[i._id]=setTimeout(o._ended.bind(o,i),s):(o._endTimers[i._id]=function(){o._ended(i),m.removeEventListener("ended",o._endTimers[i._id],!1)},m.addEventListener("ended",o._endTimers[i._id],!1))}catch(e){o._emit("playerror",i._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=o._src,m.load());var A=window&&window.ejecta||!m.readyState&&g._navigator.isCocoonJS;if(3<=m.readyState||A)h();else{o._playLock=!0;var y=function(){h(),m.removeEventListener(g._canPlayEvent,y,!1)};m.addEventListener(g._canPlayEvent,y,!1),o._clearTimer(i._id)}}return i._id}o._ended(i)},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var t=n._getSoundIds(e),o=0;o<t.length;o++){n._clearTimer(t[o]);var r=n._soundById(t[o]);if(r&&!r._paused&&(r._seek=n.seek(t[o]),r._rateSeek=0,r._paused=!0,n._stopFade(t[o]),r._node))if(n._webAudio){if(!r._node.bufferSource)continue;void 0===r._node.bufferSource.stop?r._node.bufferSource.noteOff(0):r._node.bufferSource.stop(0),n._cleanBuffer(r._node)}else isNaN(r._node.duration)&&r._node.duration!==1/0||r._node.pause();arguments[1]||n._emit("pause",r?r._id:null)}return n},stop:function(e,n){var t=this;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"stop",action:function(){t.stop(e)}}),t;for(var o=t._getSoundIds(e),r=0;r<o.length;r++){t._clearTimer(o[r]);var a=t._soundById(o[r]);a&&(a._seek=a._start||0,a._rateSeek=0,a._paused=!0,a._ended=!0,t._stopFade(o[r]),a._node&&(t._webAudio?a._node.bufferSource&&(void 0===a._node.bufferSource.stop?a._node.bufferSource.noteOff(0):a._node.bufferSource.stop(0),t._cleanBuffer(a._node)):isNaN(a._node.duration)&&a._node.duration!==1/0||(a._node.currentTime=a._start||0,a._node.pause(),a._node.duration===1/0&&t._clearSound(a._node))),n||t._emit("stop",a._id))}return t},mute:function(e,n){var t=this;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"mute",action:function(){t.mute(e,n)}}),t;if(void 0===n){if("boolean"!=typeof e)return t._muted;t._muted=e}for(var o=t._getSoundIds(n),r=0;r<o.length;r++){var a=t._soundById(o[r]);a&&(a._muted=e,a._interval&&t._stopFade(a._id),t._webAudio&&a._node?a._node.gain.setValueAtTime(e?0:a._volume,g.ctx.currentTime):a._node&&(a._node.muted=!!g._muted||e),t._emit("mute",a._id))}return t},volume:function(){var e,n,t=this,o=arguments,r;if(0===o.length)return t._volume;if(1===o.length||2===o.length&&void 0===o[1]?0<=t._getSoundIds().indexOf(o[0])?n=parseInt(o[0],10):e=parseFloat(o[0]):2<=o.length&&(e=parseFloat(o[0]),n=parseInt(o[1],10)),!(void 0!==e&&0<=e&&e<=1))return(r=n?t._soundById(n):t._sounds[0])?r._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,o)}}),t;void 0===n&&(t._volume=e),n=t._getSoundIds(n);for(var a=0;a<n.length;a++)(r=t._soundById(n[a]))&&(r._volume=e,o[2]||t._stopFade(n[a]),t._webAudio&&r._node&&!r._muted?r._node.gain.setValueAtTime(e,g.ctx.currentTime):r._node&&!r._muted&&(r._node.volume=e*g.volume()),t._emit("volume",r._id));return t},fade:function(e,n,t,o){var r=this;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"fade",action:function(){r.fade(e,n,t,o)}}),r;e=parseFloat(e),n=parseFloat(n),t=parseFloat(t),r.volume(e,o);for(var a=r._getSoundIds(o),i=0;i<a.length;i++){var u=r._soundById(a[i]);if(u){if(o||r._stopFade(a[i]),r._webAudio&&!u._muted){var d=g.ctx.currentTime,_=d+t/1e3;u._volume=e,u._node.gain.setValueAtTime(e,d),u._node.gain.linearRampToValueAtTime(n,_)}r._startFadeInterval(u,e,n,t,a[i],void 0===o)}}return r},_startFadeInterval:function(n,t,o,r,e,a){var i=this,u=t,d=o-t,_=Math.abs(d/.01),s=Math.max(4,0<_?r/_:r),l=Date.now();n._fadeTo=o,n._interval=setInterval(function(){var e=(Date.now()-l)/r;l=Date.now(),u+=d*e,u=Math.max(0,u),u=Math.min(1,u),u=Math.round(100*u)/100,i._webAudio?n._volume=u:i.volume(u,n._id,!0),a&&(i._volume=u),(o<t&&u<=o||t<o&&o<=u)&&(clearInterval(n._interval),n._interval=null,n._fadeTo=null,i.volume(o,n._id),i._emit("fade",n._id))},s)},_stopFade:function(e){var n=this,t=n._soundById(e);return t&&t._interval&&(n._webAudio&&t._node.gain.cancelScheduledValues(g.ctx.currentTime),clearInterval(t._interval),t._interval=null,n.volume(t._fadeTo,e),t._fadeTo=null,n._emit("fade",e)),n},loop:function(){var e,n,t,o=this,r=arguments;if(0===r.length)return o._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(t=o._soundById(parseInt(r[0],10)))&&t._loop;e=r[0],o._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=o._getSoundIds(n),i=0;i<a.length;i++)(t=o._soundById(a[i]))&&(t._loop=e,o._webAudio&&t._node&&t._node.bufferSource&&((t._node.bufferSource.loop=e)&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop)));return o},rate:function(){var e,n,t=this,o=arguments,r;if(0===o.length)n=t._sounds[0]._id;else if(1===o.length){var a,i;0<=t._getSoundIds().indexOf(o[0])?n=parseInt(o[0],10):e=parseFloat(o[0])}else 2===o.length&&(e=parseFloat(o[0]),n=parseInt(o[1],10));if("number"!=typeof e)return(r=t._soundById(n))?r._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,o)}}),t;void 0===n&&(t._rate=e),n=t._getSoundIds(n);for(var u=0;u<n.length;u++)if(r=t._soundById(n[u])){t.playing(n[u])&&(r._rateSeek=t.seek(n[u]),r._playStart=t._webAudio?g.ctx.currentTime:r._playStart),r._rate=e,t._webAudio&&r._node&&r._node.bufferSource?r._node.bufferSource.playbackRate.setValueAtTime(e,g.ctx.currentTime):r._node&&(r._node.playbackRate=e);var d=t.seek(n[u]),_,s=1e3*((t._sprite[r._sprite][0]+t._sprite[r._sprite][1])/1e3-d)/Math.abs(r._rate);!t._endTimers[n[u]]&&r._paused||(t._clearTimer(n[u]),t._endTimers[n[u]]=setTimeout(t._ended.bind(t,r),s)),t._emit("rate",r._id)}return t},seek:function(){var e,n,t=this,o=arguments;if(0===o.length)n=t._sounds[0]._id;else if(1===o.length){var r,a;0<=t._getSoundIds().indexOf(o[0])?n=parseInt(o[0],10):t._sounds.length&&(n=t._sounds[0]._id,e=parseFloat(o[0]))}else 2===o.length&&(e=parseFloat(o[0]),n=parseInt(o[1],10));if(void 0===n)return t;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"seek",action:function(){t.seek.apply(t,o)}}),t;var i=t._soundById(n);if(i){if(!("number"==typeof e&&0<=e)){if(t._webAudio){var u=t.playing(n)?g.ctx.currentTime-i._playStart:0,d=i._rateSeek?i._rateSeek-i._seek:0;return i._seek+(d+u*Math.abs(i._rate))}return i._node.currentTime}var _=t.playing(n);_&&t.pause(n,!0),i._seek=e,i._ended=!1,t._clearTimer(n),t._webAudio||!i._node||isNaN(i._node.duration)||(i._node.currentTime=e);var s=function(){t._emit("seek",n),_&&t.play(n,!0)};if(_&&!t._webAudio){var l=function(){t._playLock?setTimeout(l,0):s()};setTimeout(l,0)}else s()}return t},playing:function(e){var n=this;if("number"==typeof e){var t=n._soundById(e);return!!t&&!t._paused}for(var o=0;o<n._sounds.length;o++)if(!n._sounds[o]._paused)return!0;return!1},duration:function(e){var n=this,t=n._duration,o=n._soundById(e);return o&&(t=n._sprite[o._sprite][1]/1e3),t},state:function(){return this._state},unload:function(){for(var e=this,n=e._sounds,t=0;t<n.length;t++)n[t]._paused||e.stop(n[t]._id),e._webAudio||(e._clearSound(n[t]._node),n[t]._node.removeEventListener("error",n[t]._errorFn,!1),n[t]._node.removeEventListener(g._canPlayEvent,n[t]._loadFn,!1),g._releaseHtml5Audio(n[t]._node)),delete n[t]._node,e._clearTimer(n[t]._id);var o=g._howls.indexOf(e);0<=o&&g._howls.splice(o,1);var r=!0;for(t=0;t<g._howls.length;t++)if(g._howls[t]._src===e._src||0<=e._src.indexOf(g._howls[t]._src)){r=!1;break}return i&&r&&delete i[e._src],g.noAudio=!1,e._state="unloaded",e._sounds=[],e=null},on:function(e,n,t,o){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(o?{id:t,fn:n,once:o}:{id:t,fn:n}),r},off:function(e,n,t){var o=this,r=o["_on"+e],a=0;if("number"==typeof n&&(t=n,n=null),n||t)for(a=0;a<r.length;a++){var i=t===r[a].id;if(n===r[a].fn&&i||!n&&i){r.splice(a,1);break}}else if(e)o["_on"+e]=[];else{var u=Object.keys(o);for(a=0;a<u.length;a++)0===u[a].indexOf("_on")&&Array.isArray(o[u[a]])&&(o[u[a]]=[])}return o},once:function(e,n,t){var o=this;return o.on(e,n,t,1),o},_emit:function(e,n,t){for(var o=this,r=o["_on"+e],a=r.length-1;0<=a;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,t)}.bind(o,r[a].fn),0),r[a].once&&o.off(e,r[a].fn,r[a].id));return o._loadQueue(e),o},_loadQueue:function(e){var n=this;if(0<n._queue.length){var t=n._queue[0];t.event===e&&(n._queue.shift(),n._loadQueue()),e||t.action()}return n},_ended:function(e){var n=this,t=e._sprite;if(!n._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime<e._stop)return setTimeout(n._ended.bind(n,e),100),n;var o=!(!e._loop&&!n._sprite[t][2]);if(n._emit("end",e._id),!n._webAudio&&o&&n.stop(e._id,!0).play(e._id),n._webAudio&&o){n._emit("play",e._id),e._seek=e._start||0,e._rateSeek=0,e._playStart=g.ctx.currentTime;var r=1e3*(e._stop-e._start)/Math.abs(e._rate);n._endTimers[e._id]=setTimeout(n._ended.bind(n,e),r)}return n._webAudio&&!o&&(e._paused=!0,e._ended=!0,e._seek=e._start||0,e._rateSeek=0,n._clearTimer(e._id),n._cleanBuffer(e._node),g._autoSuspend()),n._webAudio||o||n.stop(e._id,!0),n},_clearTimer:function(e){var n=this;if(n._endTimers[e]){if("function"!=typeof n._endTimers[e])clearTimeout(n._endTimers[e]);else{var t=n._soundById(e);t&&t._node&&t._node.removeEventListener("ended",n._endTimers[e],!1)}delete n._endTimers[e]}return n},_soundById:function(e){for(var n=this,t=0;t<n._sounds.length;t++)if(e===n._sounds[t]._id)return n._sounds[t];return null},_inactiveSound:function(){var e=this;e._drain();for(var n=0;n<e._sounds.length;n++)if(e._sounds[n]._ended)return e._sounds[n].reset();return new a(e)},_drain:function(){var e=this,n=e._pool,t=0,o=0;if(!(e._sounds.length<n)){for(o=0;o<e._sounds.length;o++)e._sounds[o]._ended&&t++;for(o=e._sounds.length-1;0<=o;o--){if(t<=n)return;e._sounds[o]._ended&&(e._webAudio&&e._sounds[o]._node&&e._sounds[o]._node.disconnect(0),e._sounds.splice(o,1),t--)}}},_getSoundIds:function(e){var n=this;if(void 0!==e)return[e];for(var t=[],o=0;o<n._sounds.length;o++)t.push(n._sounds[o]._id);return t},_refreshBuffer:function(e){var n=this;return e._node.bufferSource=g.ctx.createBufferSource(),e._node.bufferSource.buffer=i[n._src],e._panner?e._node.bufferSource.connect(e._panner):e._node.bufferSource.connect(e._node),e._node.bufferSource.loop=e._loop,e._loop&&(e._node.bufferSource.loopStart=e._start||0,e._node.bufferSource.loopEnd=e._stop||0),e._node.bufferSource.playbackRate.setValueAtTime(e._rate,g.ctx.currentTime),n},_cleanBuffer:function(e){var n=this,t=g._navigator&&0<=g._navigator.vendor.indexOf("Apple");if(g._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=g._scratchBuffer}catch(e){}return e.bufferSource=null,n},_clearSound:function(e){/MSIE |Trident\//.test(g._navigator&&g._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var a=function(e){this._parent=e,this.init()};a.prototype={init:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._rate=n._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++g._counter,n._sounds.push(e),e.create(),e},create:function(){var e=this,n=e._parent,t=g._muted||e._muted||e._parent._muted?0:e._volume;return n._webAudio?(e._node=void 0===g.ctx.createGain?g.ctx.createGainNode():g.ctx.createGain(),e._node.gain.setValueAtTime(t,g.ctx.currentTime),e._node.paused=!0,e._node.connect(g.masterGain)):(e._node=g._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(g._canPlayEvent,e._loadFn,!1),e._node.src=n._src,e._node.preload="auto",e._node.volume=t*g.volume(),e._node.load()),e},reset:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._rate=n._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++g._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,n=e._parent;n._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(n._sprite).length&&(n._sprite={__default:[0,1e3*n._duration]}),"loaded"!==n._state&&(n._state="loaded",n._emit("load"),n._loadQueue()),e._node.removeEventListener(g._canPlayEvent,e._loadFn,!1)}};var i={},u=function(n){var e=n._src;if(i[e])return n._duration=i[e].duration,void s(n);if(/^data:[^;]+;base64,/.test(e)){for(var t=atob(e.split(",")[1]),o=new Uint8Array(t.length),r=0;r<t.length;++r)o[r]=t.charCodeAt(r);_(o.buffer,n)}else{var a=new XMLHttpRequest;a.open("GET",e,!0),a.withCredentials=n._xhrWithCredentials,a.responseType="arraybuffer",a.onload=function(){var e=(a.status+"")[0];"0"===e||"2"===e||"3"===e?_(a.response,n):n._emit("loaderror",null,"Failed loading audio file with status: "+a.status+".")},a.onerror=function(){n._webAudio&&(n._html5=!0,n._webAudio=!1,n._sounds=[],delete i[e],n.load())},d(a)}},d=function(n){try{n.send()}catch(e){n.onerror()}},_=function(e,n){var t=function(){n._emit("loaderror",null,"Decoding audio data failed.")},o=function(e){e&&0<n._sounds.length?(i[n._src]=e,s(n,e)):t()};"undefined"!=typeof Promise&&1===g.ctx.decodeAudioData.length?g.ctx.decodeAudioData(e).then(o).catch(t):g.ctx.decodeAudioData(e,o,t)},s=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},l=function(){if(g.usingWebAudio){try{"undefined"!=typeof AudioContext?g.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?g.ctx=new webkitAudioContext:g.usingWebAudio=!1}catch(e){g.usingWebAudio=!1}g.ctx||(g.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(g._navigator&&g._navigator.platform),n=g._navigator&&g._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=n?parseInt(n[1],10):null;if(e&&t&&t<9){var o=/safari/.test(g._navigator&&g._navigator.userAgent.toLowerCase());(g._navigator&&g._navigator.standalone&&!o||g._navigator&&!g._navigator.standalone&&!o)&&(g.usingWebAudio=!1)}g.usingWebAudio&&(g.masterGain=void 0===g.ctx.createGain?g.ctx.createGainNode():g.ctx.createGain(),g.masterGain.gain.setValueAtTime(g._muted?0:1,g.ctx.currentTime),g.masterGain.connect(g.ctx.destination)),g._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:g,Howl:n}}),"undefined"!=typeof exports&&(exports.Howler=g,exports.Howl=n),"undefined"!=typeof window?(window.HowlerGlobal=e,window.Howler=g,window.Howl=n,window.Sound=a):"undefined"!=typeof global&&(global.HowlerGlobal=e,global.Howler=g,global.Howl=n,global.Sound=a)}(),function(){"use strict";var t,o,r;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;0<=t;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var o=this;return o.ctx&&o.ctx.listener?(n="number"!=typeof n?o._pos[1]:n,t="number"!=typeof t?o._pos[2]:t,"number"!=typeof e?o._pos:(o._pos=[e,n,t],void 0!==o.ctx.listener.positionX?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]),o)):o},HowlerGlobal.prototype.orientation=function(e,n,t,o,r,a){var i=this;if(!i.ctx||!i.ctx.listener)return i;var u=i._orientation;return n="number"!=typeof n?u[1]:n,t="number"!=typeof t?u[2]:t,o="number"!=typeof o?u[3]:o,r="number"!=typeof r?u[4]:r,a="number"!=typeof a?u[5]:a,"number"!=typeof e?u:(i._orientation=[e,n,t,o,r,a],void 0!==i.ctx.listener.forwardX?(i.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),i.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),i.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),i.ctx.listener.upX.setTargetAtTime(e,Howler.ctx.currentTime,.1),i.ctx.listener.upY.setTargetAtTime(n,Howler.ctx.currentTime,.1),i.ctx.listener.upZ.setTargetAtTime(t,Howler.ctx.currentTime,.1)):i.ctx.listener.setOrientation(e,n,t,o,r,a),i)},Howl.prototype.init=(r=Howl.prototype.init,function(e){var n=this;return n._orientation=e.orientation||[1,0,0],n._stereo=e.stereo||null,n._pos=e.pos||null,n._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},n._onstereo=e.onstereo?[{fn:e.onstereo}]:[],n._onpos=e.onpos?[{fn:e.onpos}]:[],n._onorientation=e.onorientation?[{fn:e.onorientation}]:[],r.call(this,e)}),Howl.prototype.stereo=function(e,n){var t=this;if(!t._webAudio)return t;if("loaded"!==t._state)return t._queue.push({event:"stereo",action:function(){t.stereo(e,n)}}),t;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof e)return t._stereo;t._stereo=e,t._pos=[e,0,0]}for(var r=t._getSoundIds(n),a=0;a<r.length;a++){var i=t._soundById(r[a]);if(i){if("number"!=typeof e)return i._stereo;i._stereo=e,i._pos=[e,0,0],i._node&&(i._pannerAttr.panningModel="equalpower",i._panner&&i._panner.pan||_(i,o),"spatial"===o?void 0!==i._panner.positionX?(i._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),i._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),i._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):i._panner.setPosition(e,0,0):i._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),t._emit("stereo",i._id)}}return t},Howl.prototype.pos=function(e,n,t,o){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"pos",action:function(){r.pos(e,n,t,o)}}),r;if(n="number"!=typeof n?0:n,t="number"!=typeof t?-.5:t,void 0===o){if("number"!=typeof e)return r._pos;r._pos=[e,n,t]}for(var a=r._getSoundIds(o),i=0;i<a.length;i++){var u=r._soundById(a[i]);if(u){if("number"!=typeof e)return u._pos;u._pos=[e,n,t],u._node&&(u._panner&&!u._panner.pan||_(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(t,Howler.ctx.currentTime)):u._panner.setPosition(e,n,t)),r._emit("pos",u._id)}}return r},Howl.prototype.orientation=function(e,n,t,o){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"orientation",action:function(){r.orientation(e,n,t,o)}}),r;if(n="number"!=typeof n?r._orientation[1]:n,t="number"!=typeof t?r._orientation[2]:t,void 0===o){if("number"!=typeof e)return r._orientation;r._orientation=[e,n,t]}for(var a=r._getSoundIds(o),i=0;i<a.length;i++){var u=r._soundById(a[i]);if(u){if("number"!=typeof e)return u._orientation;u._orientation=[e,n,t],u._node&&(u._panner||(u._pos||(u._pos=r._pos||[0,0,-.5]),_(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(t,Howler.ctx.currentTime)):u._panner.setOrientation(e,n,t)),r._emit("orientation",u._id)}}return r},Howl.prototype.pannerAttr=function(){var e,n,t,o=this,r=arguments;if(!o._webAudio)return o;if(0===r.length)return o._pannerAttr;if(1===r.length){if("object"!=typeof r[0])return(t=o._soundById(parseInt(r[0],10)))?t._pannerAttr:o._pannerAttr;e=r[0],void 0===n&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),o._pannerAttr={coneInnerAngle:void 0!==e.pannerAttr.coneInnerAngle?e.pannerAttr.coneInnerAngle:o._coneInnerAngle,coneOuterAngle:void 0!==e.pannerAttr.coneOuterAngle?e.pannerAttr.coneOuterAngle:o._coneOuterAngle,coneOuterGain:void 0!==e.pannerAttr.coneOuterGain?e.pannerAttr.coneOuterGain:o._coneOuterGain,distanceModel:void 0!==e.pannerAttr.distanceModel?e.pannerAttr.distanceModel:o._distanceModel,maxDistance:void 0!==e.pannerAttr.maxDistance?e.pannerAttr.maxDistance:o._maxDistance,refDistance:void 0!==e.pannerAttr.refDistance?e.pannerAttr.refDistance:o._refDistance,rolloffFactor:void 0!==e.pannerAttr.rolloffFactor?e.pannerAttr.rolloffFactor:o._rolloffFactor,panningModel:void 0!==e.pannerAttr.panningModel?e.pannerAttr.panningModel:o._panningModel})}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=o._getSoundIds(n),i=0;i<a.length;i++)if(t=o._soundById(a[i])){var u=t._pannerAttr;u={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==e.distanceModel?e.distanceModel:u.distanceModel,maxDistance:void 0!==e.maxDistance?e.maxDistance:u.maxDistance,refDistance:void 0!==e.refDistance?e.refDistance:u.refDistance,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:u.rolloffFactor,panningModel:void 0!==e.panningModel?e.panningModel:u.panningModel};var d=t._panner;d?(d.coneInnerAngle=u.coneInnerAngle,d.coneOuterAngle=u.coneOuterAngle,d.coneOuterGain=u.coneOuterGain,d.distanceModel=u.distanceModel,d.maxDistance=u.maxDistance,d.refDistance=u.refDistance,d.rolloffFactor=u.rolloffFactor,d.panningModel=u.panningModel):(t._pos||(t._pos=o._pos||[0,0,-.5]),_(t,"spatial"))}return o},Sound.prototype.init=(o=Sound.prototype.init,function(){var e=this,n=e._parent;e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,o.call(this),e._stereo?n.stereo(e._stereo):e._pos&&n.pos(e._pos[0],e._pos[1],e._pos[2],e._id)}),Sound.prototype.reset=(t=Sound.prototype.reset,function(){var e=this,n=e._parent;return e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,e._stereo?n.stereo(e._stereo):e._pos?n.pos(e._pos[0],e._pos[1],e._pos[2],e._id):e._panner&&(e._panner.disconnect(0),e._panner=void 0,n._refreshBuffer(e)),t.call(this)});var _=function(e,n){"spatial"===(n=n||"spatial")?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}();;
- function u(h){function g(t,e,r){if(void 0===t&&(t=g.DEFAULT_CAPACITY),void 0===e&&(e=g.DEFAULT_ENDIAN),void 0===r&&(r=g.DEFAULT_NOASSERT),!r){if((t|=0)<0)throw RangeError("Illegal capacity");e=!!e,r=!!r}this.buffer=0===t?s:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e,this.noAssert=r}function o(t){var e=0;return function(){return e<t.length?t.charCodeAt(e++):null}}function a(){var t=[],e=[];return function(){if(0===arguments.length)return e.join("")+i.apply(String,t);1024<t.length+arguments.length&&(e.push(i.apply(String,t)),t.length=0),Array.prototype.push.apply(t,arguments)}}function r(t,e,r,i,n){var f,s=(1<<(f=8*n-i-1))-1,o=s>>1,h=-7,a=r?-1:1,l=t[e+(n=r?n-1:0)];for(n+=a,r=l&(1<<-h)-1,l>>=-h,h+=f;0<h;r=256*r+t[e+n],n+=a,h-=8);for(f=r&(1<<-h)-1,r>>=-h,h+=i;0<h;f=256*f+t[e+n],n+=a,h-=8);if(0===r)r=1-o;else{if(r===s)return f?NaN:1/0*(l?-1:1);f+=Math.pow(2,i),r-=o}return(l?-1:1)*f*Math.pow(2,r-i)}function n(t,e,r,i,n,f){var s,o=8*f-n-1,h=(1<<o)-1,a=h>>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0;f=i?0:f-1;var u=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(e=isNaN(e)?1:0,i=h):(i=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-i))<1&&(i--,s*=2),2<=(e=1<=i+a?e+l/s:e+l*Math.pow(2,1-a))*s&&(i++,s/=2),h<=i+a?(e=0,i=h):1<=i+a?(e=(e*s-1)*Math.pow(2,n),i+=a):(e=e*Math.pow(2,a-1)*Math.pow(2,n),i=0));8<=n;t[r+f]=255&e,f+=u,e/=256,n-=8);for(i=i<<n|e,o+=n;0<o;t[r+f]=255&i,f+=u,i/=256,o-=8);t[r+f-u]|=128*g}g.VERSION="5.0.0",g.LITTLE_ENDIAN=!0,g.BIG_ENDIAN=!1,g.DEFAULT_CAPACITY=16,g.DEFAULT_ENDIAN=g.BIG_ENDIAN,g.DEFAULT_NOASSERT=!1,g.Long=h||null;var f=g.prototype;Object.defineProperty(f,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var s=new ArrayBuffer(0),i=String.fromCharCode;g.accessor=function(){return Uint8Array},g.allocate=function(t,e,r){return new g(t,e,r)},g.concat=function(t,e,r,i){"boolean"!=typeof e&&"string"==typeof e||(i=r,r=e,e=void 0);for(var n=0,f=0,s=t.length,o;f<s;++f)g.isByteBuffer(t[f])||(t[f]=g.wrap(t[f],e)),0<(o=t[f].limit-t[f].offset)&&(n+=o);if(0===n)return new g(0,r,i);for(e=new g(n,r,i),f=0;f<s;)(o=(r=t[f++]).limit-r.offset)<=0||(e.view.set(r.view.subarray(r.offset,r.limit),e.offset),e.offset+=o);return e.limit=e.offset,e.offset=0,e},g.isByteBuffer=function(t){return!0===(t&&t.__isByteBuffer__)},g.type=function(){return ArrayBuffer},g.wrap=function(t,e,r,i){if("string"!=typeof e&&(i=r,r=e,e=void 0),"string"==typeof t)switch(void 0===e&&(e="utf8"),e){case"base64":return g.fromBase64(t,r);case"hex":return g.fromHex(t,r);case"binary":return g.fromBinary(t,r);case"utf8":return g.fromUTF8(t,r);case"debug":return g.fromDebug(t,r);default:throw Error("Unsupported encoding: "+e)}if(null===t||"object"!=typeof t)throw TypeError("Illegal buffer");if(g.isByteBuffer(t))return(e=f.clone.call(t)).markedOffset=-1,e;if(t instanceof Uint8Array)e=new g(0,r,i),0<t.length&&(e.buffer=t.buffer,e.offset=t.byteOffset,e.limit=t.byteOffset+t.byteLength,e.view=new Uint8Array(t.buffer));else if(t instanceof ArrayBuffer)e=new g(0,r,i),0<t.byteLength&&(e.buffer=t,e.offset=0,e.limit=t.byteLength,e.view=0<t.byteLength?new Uint8Array(t):null);else{if("[object Array]"!==Object.prototype.toString.call(t))throw TypeError("Illegal buffer");for((e=new g(t.length,r,i)).limit=t.length,r=0;r<t.length;++r)e.view[r]=t[r]}return e},f.readBytes=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+"+t+") <= "+this.buffer.byteLength)}var i=this.slice(e,e+t);return r&&(this.offset+=t),i},f.writeBytes=f.append,f.writeInt8=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=1;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),this.view[e-1]=t,r&&(this.offset+=1),this},f.writeByte=f.writeInt8,f.readInt8=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[t]))&&(t=-(255-t+1)),e&&(this.offset+=1),t},f.readByte=f.readInt8,f.writeUint8=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=1;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),this.view[e-1]=t,r&&(this.offset+=1),this},f.writeUInt8=f.writeUint8,f.readUint8=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return t=this.view[t],e&&(this.offset+=1),t},f.readUInt8=f.readUint8,f.writeInt16=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=2;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),r&&(this.offset+=2),this},f.writeShort=f.writeInt16,f.readInt16=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[t],r|=this.view[t+1]<<8):(r=this.view[t]<<8,r|=this.view[t+1]),32768==(32768&r)&&(r=-(65535-r+1)),e&&(this.offset+=2),r},f.readShort=f.readInt16,f.writeUint16=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=2;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),r&&(this.offset+=2),this},f.writeUInt16=f.writeUint16,f.readUint16=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[t],r|=this.view[t+1]<<8):(r=this.view[t]<<8,r|=this.view[t+1]),e&&(this.offset+=2),r},f.readUInt16=f.readUint16,f.writeInt32=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=4;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),e-=4,this.littleEndian?(this.view[e+3]=t>>>24&255,this.view[e+2]=t>>>16&255,this.view[e+1]=t>>>8&255,this.view[e]=255&t):(this.view[e]=t>>>24&255,this.view[e+1]=t>>>16&255,this.view[e+2]=t>>>8&255,this.view[e+3]=255&t),r&&(this.offset+=4),this},f.writeInt=f.writeInt32,f.readInt32=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0),e&&(this.offset+=4),0|r},f.readInt=f.readInt32,f.writeUint32=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=4;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),e-=4,this.littleEndian?(this.view[e+3]=t>>>24&255,this.view[e+2]=t>>>16&255,this.view[e+1]=t>>>8&255,this.view[e]=255&t):(this.view[e]=t>>>24&255,this.view[e+1]=t>>>16&255,this.view[e+2]=t>>>8&255,this.view[e+3]=255&t),r&&(this.offset+=4),this},f.writeUInt32=f.writeUint32,f.readUint32=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0),e&&(this.offset+=4),r},f.readUInt32=f.readUint32,h&&(f.writeInt64=function(t,e){var r=void 0===e,i;if(r&&(e=this.offset),!this.noAssert){if("number"==typeof t)t=h.fromNumber(t);else if("string"==typeof t)t=h.fromString(t);else if(!(t&&t instanceof h))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=h.fromNumber(t):"string"==typeof t&&(t=h.fromString(t)),e+=8,(i=this.buffer.byteLength)<e&&this.resize((i*=2)>e?i:e),e-=8;var i=t.low,n=t.high;return this.littleEndian?(this.view[e+3]=i>>>24&255,this.view[e+2]=i>>>16&255,this.view[e+1]=i>>>8&255,this.view[e]=255&i,e+=4,this.view[e+3]=n>>>24&255,this.view[e+2]=n>>>16&255,this.view[e+1]=n>>>8&255,this.view[e]=255&n):(this.view[e]=n>>>24&255,this.view[e+1]=n>>>16&255,this.view[e+2]=n>>>8&255,this.view[e+3]=255&n,e+=4,this.view[e]=i>>>24&255,this.view[e+1]=i>>>16&255,this.view[e+2]=i>>>8&255,this.view[e+3]=255&i),r&&(this.offset+=8),this},f.writeLong=f.writeInt64,f.readInt64=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=0,i=0;return this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0),t=new h(r,i,!1),e&&(this.offset+=8),t},f.readLong=f.readInt64,f.writeUint64=function(t,e){var r=void 0===e,i;if(r&&(e=this.offset),!this.noAssert){if("number"==typeof t)t=h.fromNumber(t);else if("string"==typeof t)t=h.fromString(t);else if(!(t&&t instanceof h))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=h.fromNumber(t):"string"==typeof t&&(t=h.fromString(t)),e+=8,(i=this.buffer.byteLength)<e&&this.resize((i*=2)>e?i:e),e-=8;var i=t.low,n=t.high;return this.littleEndian?(this.view[e+3]=i>>>24&255,this.view[e+2]=i>>>16&255,this.view[e+1]=i>>>8&255,this.view[e]=255&i,e+=4,this.view[e+3]=n>>>24&255,this.view[e+2]=n>>>16&255,this.view[e+1]=n>>>8&255,this.view[e]=255&n):(this.view[e]=n>>>24&255,this.view[e+1]=n>>>16&255,this.view[e+2]=n>>>8&255,this.view[e+3]=255&n,e+=4,this.view[e]=i>>>24&255,this.view[e+1]=i>>>16&255,this.view[e+2]=i>>>8&255,this.view[e+3]=255&i),r&&(this.offset+=8),this},f.writeUInt64=f.writeUint64,f.readUint64=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=0,i=0;return this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0),t=new h(r,i,!0),e&&(this.offset+=8),t},f.readUInt64=f.readUint64),f.writeFloat32=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=4;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),n(this.view,t,e-4,this.littleEndian,23,4),r&&(this.offset+=4),this},f.writeFloat=f.writeFloat32,f.readFloat32=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,t,this.littleEndian,23,4),e&&(this.offset+=4),t},f.readFloat=f.readFloat32,f.writeFloat64=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}e+=8;var i=this.buffer.byteLength;return i<e&&this.resize((i*=2)>e?i:e),n(this.view,t,e-8,this.littleEndian,52,8),r&&(this.offset+=8),this},f.writeDouble=f.writeFloat64,f.readFloat64=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,t,this.littleEndian,52,8),e&&(this.offset+=8),t},f.readDouble=f.readFloat64,g.MAX_VARINT32_BYTES=5,g.calculateVarint32=function(t){return(t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5},g.zigZagEncode32=function(t){return((t|=0)<<1^t>>31)>>>0},g.zigZagDecode32=function(t){return t>>>1^-(1&t)|0},f.writeVarint32=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}var i=g.calculateVarint32(t),n;for(e+=i,(n=this.buffer.byteLength)<e&&this.resize((n*=2)>e?n:e),e-=i,t>>>=0;128<=t;)n=127&t|128,this.view[e++]=n,t>>>=7;return this.view[e++]=t,r?(this.offset=e,this):i},f.writeVarint32ZigZag=function(t,e){return this.writeVarint32(g.zigZagEncode32(t),e)},f.readVarint32=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var r=0,i=0,n;do{if(!this.noAssert&&t>this.limit)throw(t=Error("Truncated")).truncated=!0,t;n=this.view[t++],r<5&&(i|=(127&n)<<7*r),++r}while(0!=(128&n));return i|=0,e?(this.offset=t,i):{value:i,length:r}},f.readVarint32ZigZag=function(t){return"object"==typeof(t=this.readVarint32(t))?t.value=g.zigZagDecode32(t.value):t=g.zigZagDecode32(t),t},h&&(g.MAX_VARINT64_BYTES=10,g.calculateVarint64=function(t){"number"==typeof t?t=h.fromNumber(t):"string"==typeof t&&(t=h.fromString(t));var e=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0;return 0==(t=t.shiftRightUnsigned(56).toInt()>>>0)?0==r?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:t<128?9:10},g.zigZagEncode64=function(t){return"number"==typeof t?t=h.fromNumber(t,!1):"string"==typeof t?t=h.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},g.zigZagDecode64=function(t){return"number"==typeof t?t=h.fromNumber(t,!1):"string"==typeof t?t=h.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(h.ONE).toSigned().negate()).toSigned()},f.writeVarint64=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"==typeof t)t=h.fromNumber(t);else if("string"==typeof t)t=h.fromString(t);else if(!(t&&t instanceof h))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=h.fromNumber(t,!1):"string"==typeof t?t=h.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned());var i=g.calculateVarint64(t),n=t.toInt()>>>0,f=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0;e+=i;var o=this.buffer.byteLength;switch(o<e&&this.resize((o*=2)>e?o:e),e-=i,i){case 10:this.view[e+9]=s>>>7&1;case 9:this.view[e+8]=9!==i?128|s:127&s;case 8:this.view[e+7]=8!==i?f>>>21|128:f>>>21&127;case 7:this.view[e+6]=7!==i?f>>>14|128:f>>>14&127;case 6:this.view[e+5]=6!==i?f>>>7|128:f>>>7&127;case 5:this.view[e+4]=5!==i?128|f:127&f;case 4:this.view[e+3]=4!==i?n>>>21|128:n>>>21&127;case 3:this.view[e+2]=3!==i?n>>>14|128:n>>>14&127;case 2:this.view[e+1]=2!==i?n>>>7|128:n>>>7&127;case 1:this.view[e]=1!==i?128|n:127&n}return r?(this.offset+=i,this):i},f.writeVarint64ZigZag=function(t,e){return this.writeVarint64(g.zigZagEncode64(t),e)},f.readVarint64=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var r=t,i=0,n=0,f=0,s=0,s,i=127&(s=this.view[t++]);if(128&s&&(i|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,128&s||this.noAssert&&void 0===s)&&(n=127&(s=this.view[t++]),128&s||this.noAssert&&void 0===s)&&(n|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s)&&(n|=(127&(s=this.view[t++]))<<14,128&s||this.noAssert&&void 0===s)&&(n|=(127&(s=this.view[t++]))<<21,128&s||this.noAssert&&void 0===s)&&(f=127&(s=this.view[t++]),128&s||this.noAssert&&void 0===s)&&(f|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))throw Error("Buffer overrun");return i=h.fromBits(i|n<<28,n>>>4|f<<24,!1),e?(this.offset=t,i):{value:i,length:t-r}},f.readVarint64ZigZag=function(t){return(t=this.readVarint64(t))&&t.value instanceof h?t.value=g.zigZagDecode64(t.value):t=g.zigZagDecode64(t),t}),f.writeCString=function(t,e){var r=void 0===e;r&&(e=this.offset);var i,n=t.length;if(!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");for(i=0;i<n;++i)if(0===t.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return n=u.a(o(t))[1],e+=n+1,(i=this.buffer.byteLength)<e&&this.resize((i*=2)>e?i:e),e-=n+1,u.b(o(t),function(t){this.view[e++]=t}.bind(this)),this.view[e++]=0,r?(this.offset=e,this):n},f.readCString=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var r=t,i,n=-1;return u.c(function(){if(0===n)return null;if(t>=this.limit)throw RangeError("Illegal range: Truncated data, "+t+" < "+this.limit);return 0===(n=this.view[t++])?null:n}.bind(this),i=a(),!0),e?(this.offset=t,i()):{string:i(),length:t-r}},f.writeIString=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}var i=e,n;n=u.a(o(t),this.noAssert)[1],e+=4+n;var f=this.buffer.byteLength;if(f<e&&this.resize((f*=2)>e?f:e),e-=4+n,this.littleEndian?(this.view[e+3]=n>>>24&255,this.view[e+2]=n>>>16&255,this.view[e+1]=n>>>8&255,this.view[e]=255&n):(this.view[e]=n>>>24&255,this.view[e+1]=n>>>16&255,this.view[e+2]=n>>>8&255,this.view[e+3]=255&n),e+=4,u.b(o(t),function(t){this.view[e++]=t}.bind(this)),e!==i+4+n)throw RangeError("Illegal range: Truncated data, "+e+" == "+(e+4+n));return r?(this.offset=e,this):e-i},f.readIString=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}var r=t,i=this.readUint32(t),i=this.readUTF8String(i,g.METRICS_BYTES,t+=4);return t+=i.length,e?(this.offset=t,i.string):{string:i.string,length:t-r}},g.METRICS_CHARS="c",g.METRICS_BYTES="b",f.writeUTF8String=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}var i,n=e;i=u.a(o(t))[1],e+=i;var f=this.buffer.byteLength;return f<e&&this.resize((f*=2)>e?f:e),e-=i,u.b(o(t),function(t){this.view[e++]=t}.bind(this)),r?(this.offset=e,this):e-n},f.writeString=f.writeUTF8String,g.calculateUTF8Chars=function(t){return u.a(o(t))[0]},g.calculateString=g.calculateUTF8Bytes=function(t){return u.a(o(t))[1]},f.readUTF8String=function(t,e,r){"number"==typeof e&&(r=e,e=void 0);var i=void 0===r;if(i&&(r=this.offset),void 0===e&&(e=g.METRICS_CHARS),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal length: "+t+" (not an integer)");if(t|=0,"number"!=typeof r||0!=r%1)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n=0,f=r,s;if(e===g.METRICS_CHARS){if(s=a(),u.f(function(){return n<t&&r<this.limit?this.view[r++]:null}.bind(this),function(t){++n,u.e(t,s)}),n!==t)throw RangeError("Illegal range: Truncated data, "+n+" == "+t);return i?(this.offset=r,s()):{string:s(),length:r-f}}if(e!==g.METRICS_BYTES)throw TypeError("Unsupported metrics: "+e);if(!this.noAssert){if("number"!=typeof r||0!=r%1)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+t+") <= "+this.buffer.byteLength)}var o=r+t;if(u.c(function(){return r<o?this.view[r++]:null}.bind(this),s=a(),this.noAssert),r!==o)throw RangeError("Illegal range: Truncated data, "+r+" == "+o);return i?(this.offset=r,s()):{string:s(),length:r-f}},f.readString=f.readUTF8String,f.writeVString=function(t,e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}var i=e,n,f;n=u.a(o(t),this.noAssert)[1],f=g.calculateVarint32(n),e+=f+n;var s=this.buffer.byteLength;if(s<e&&this.resize((s*=2)>e?s:e),e-=f+n,e+=this.writeVarint32(n,e),u.b(o(t),function(t){this.view[e++]=t}.bind(this)),e!==i+n+f)throw RangeError("Illegal range: Truncated data, "+e+" == "+(e+n+f));return r?(this.offset=e,this):e-i},f.readVString=function(t){var e=void 0===t;if(e&&(t=this.offset),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var r=t,i=this.readVarint32(t),i=this.readUTF8String(i.value,g.METRICS_BYTES,t+=i.length);return t+=i.length,e?(this.offset=t,i.string):{string:i.string,length:t-r}},f.append=function(t,e,r){"number"!=typeof e&&"string"==typeof e||(r=e,e=void 0);var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"!=typeof r||0!=r%1)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(t instanceof g||(t=g.wrap(t,e)),(e=t.limit-t.offset)<=0)return this;r+=e;var n=this.buffer.byteLength;return n<r&&this.resize((n*=2)>r?n:r),this.view.set(t.view.subarray(t.offset,t.limit),r-e),t.offset+=e,i&&(this.offset+=e),this},f.appendTo=function(t,e){return t.append(this,e),this},f.assert=function(t){return this.noAssert=!t,this},f.capacity=function(){return this.buffer.byteLength},f.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},f.clone=function(t){var e=new g(0,this.littleEndian,this.noAssert);return t?(e.buffer=new ArrayBuffer(this.buffer.byteLength),e.view=new Uint8Array(e.buffer)):(e.buffer=this.buffer,e.view=this.view),e.offset=this.offset,e.markedOffset=this.markedOffset,e.limit=this.limit,e},f.compact=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||e<t||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}if(0===t&&e===this.buffer.byteLength)return this;var r=e-t;if(0===r)return this.buffer=s,this.view=null,0<=this.markedOffset&&(this.markedOffset-=t),this.limit=this.offset=0,this;var i=new ArrayBuffer(r),n=new Uint8Array(i);return n.set(this.view.subarray(t,e)),this.buffer=i,this.view=n,0<=this.markedOffset&&(this.markedOffset-=t),this.offset=0,this.limit=r,this},f.copy=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||e<t||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}if(t===e)return new g(0,this.littleEndian,this.noAssert);var r=e-t,i=new g(r,this.littleEndian,this.noAssert);return i.offset=0,i.limit=r,0<=i.markedOffset&&(i.markedOffset-=t),this.copyTo(i,0,t,e),i},f.copyTo=function(t,e,r,i){var n,f;if(!this.noAssert&&!g.isByteBuffer(t))throw TypeError("Illegal target: Not a ByteBuffer");if(e=(f=void 0===e)?t.offset:0|e,r=(n=void 0===r)?this.offset:0|r,i=void 0===i?this.limit:0|i,e<0||e>t.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+e+" <= "+t.buffer.byteLength);if(r<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+r+" <= "+this.buffer.byteLength);var s=i-r;return 0===s?t:(t.ensureCapacity(e+s),t.view.set(this.view.subarray(r,i),e),n&&(this.offset+=s),f&&(t.offset+=s),this)},f.ensureCapacity=function(t){var e=this.buffer.byteLength;return e<t?this.resize((e*=2)>t?e:t):this},f.fill=function(t,e,r){var i=void 0===e;if(i&&(e=this.offset),"string"==typeof t&&0<t.length&&(t=t.charCodeAt(0)),void 0===e&&(e=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof r||0!=r%1)throw TypeError("Illegal end: Not an integer");if(r>>>=0,e<0||r<e||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+r+" <= "+this.buffer.byteLength)}if(r<=e)return this;for(;e<r;)this.view[e++]=t;return i&&(this.offset=e),this},f.flip=function(){return this.limit=this.offset,this.offset=0,this},f.mark=function(t){if(t=void 0===t?this.offset:t,!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=t,this},f.order=function(t){if(!this.noAssert&&"boolean"!=typeof t)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!t,this},f.LE=function(t){return this.littleEndian=void 0===t||!!t,this},f.BE=function(t){return this.littleEndian=void 0!==t&&!t,this},f.prepend=function(t,e,r){"number"!=typeof e&&"string"==typeof e||(r=e,e=void 0);var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"!=typeof r||0!=r%1)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(t instanceof g||(t=g.wrap(t,e)),(e=t.limit-t.offset)<=0)return this;var n=e-r;if(0<n){var f=new ArrayBuffer(this.buffer.byteLength+n),s=new Uint8Array(f);s.set(this.view.subarray(r,this.buffer.byteLength),e),this.buffer=f,this.view=s,this.offset+=n,0<=this.markedOffset&&(this.markedOffset+=n),this.limit+=n,r+=n}else new Uint8Array(this.buffer);return this.view.set(t.view.subarray(t.offset,t.limit),r-e),t.offset=t.limit,i&&(this.offset-=e),this},f.prependTo=function(t,e){return t.prepend(this,e),this},f.printDebug=function(t){"function"!=typeof t&&(t=console.log.bind(console)),t(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},f.remaining=function(){return this.limit-this.offset},f.reset=function(){return 0<=this.markedOffset?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},f.resize=function(t){if(!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal capacity: "+t+" (not an integer)");if((t|=0)<0)throw RangeError("Illegal capacity: 0 <= "+t)}if(this.buffer.byteLength<t){t=new ArrayBuffer(t);var e=new Uint8Array(t);e.set(this.view),this.buffer=t,this.view=e}return this},f.reverse=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||e<t||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}return t===e||Array.prototype.reverse.call(this.view.subarray(t,e)),this},f.skip=function(t){if(!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal length: "+t+" (not an integer)");t|=0}var e=this.offset+t;if(!this.noAssert&&(e<0||e>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+t+" <= "+this.buffer.byteLength);return this.offset=e,this},f.slice=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||e<t||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}var r=this.clone();return r.offset=t,r.limit=e,r},f.toBuffer=function(t){var e=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof e||0!=e%1)throw TypeError("Illegal offset: Not an integer");if(e>>>=0,"number"!=typeof r||0!=r%1)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,e<0||r<e||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+r+" <= "+this.buffer.byteLength)}return t||0!==e||r!==this.buffer.byteLength?e===r?s:(t=new ArrayBuffer(r-e),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(e,r),0),t):this.buffer},f.toArrayBuffer=f.toBuffer,f.toString=function(t,e,r){if(void 0===t)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof t&&(r=e=t="utf8"),t){case"utf8":return this.toUTF8(e,r);case"base64":return this.toBase64(e,r);case"hex":return this.toHex(e,r);case"binary":return this.toBinary(e,r);case"debug":return this.toDebug();case"columns":return this.m();default:throw Error("Unsupported encoding: "+t)}};var l=function(){for(var t={},n=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],s=[],e=0,r=n.length;e<r;++e)s[n[e]]=e;return t.h=function(t,e){for(var r,i;null!==(r=t());)e(n[r>>2&63]),i=(3&r)<<4,null!==(r=t())?(e(n[63&((i|=r>>4&15)|r>>4&15)]),i=(15&r)<<2,null!==(r=t())?(e(n[63&(i|r>>6&3)]),e(n[63&r])):(e(n[63&i]),e(61))):(e(n[63&i]),e(61),e(61))},t.g=function(t,e){function r(t){throw Error("Illegal character code: "+t)}for(var i,n,f;null!==(i=t());)if(void 0===(n=s[i])&&r(i),null!==(i=t())&&(void 0===(f=s[i])&&r(i),e(n<<2>>>0|(48&f)>>4),null!==(i=t()))){if(void 0===(n=s[i])){if(61===i)break;r(i)}if(e((15&f)<<4>>>0|(60&n)>>2),null!==(i=t())){if(void 0===(f=s[i])){if(61===i)break;r(i)}e((3&n)<<6>>>0|f)}}},t.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)},t}();f.toBase64=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity||e<t)throw RangeError("begin, end");var r;return l.h(function(){return t<e?this.view[t++]:null}.bind(this),r=a()),r()},g.fromBase64=function(t,e){if("string"!=typeof t)throw TypeError("str");var r=new g(t.length/4*3,e),i=0;return l.g(o(t),function(t){r.view[i++]=t}),r.limit=i,r},g.btoa=function(t){return g.fromBinary(t).toBase64()},g.atob=function(t){return g.fromBase64(t).toBinary()},f.toBinary=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity()||e<t)throw RangeError("begin, end");if(t===e)return"";for(var r=[],i=[];t<e;)r.push(this.view[t++]),1024<=r.length&&(i.push(String.fromCharCode.apply(String,r)),r=[]);return i.join("")+String.fromCharCode.apply(String,r)},g.fromBinary=function(t,e){if("string"!=typeof t)throw TypeError("str");for(var r=0,i=t.length,n,f=new g(i,e);r<i;){if(255<(n=t.charCodeAt(r)))throw RangeError("illegal char code: "+n);f.view[r++]=n}return f.limit=i,f},f.toDebug=function(t){for(var e=-1,r=this.buffer.byteLength,i,n="",f="",s="";e<r;){if(-1!==e&&(n=(i=this.view[e])<16?n+"0"+i.toString(16).toUpperCase():n+i.toString(16).toUpperCase(),t&&(f+=32<i&&i<127?String.fromCharCode(i):".")),++e,t&&0<e&&0==e%16&&e!==r){for(;n.length<51;)n+=" ";s+=n+f+"\n",n=f=""}n=e===this.offset&&e===this.limit?n+(e===this.markedOffset?"!":"|"):e===this.offset?n+(e===this.markedOffset?"[":"<"):e===this.limit?n+(e===this.markedOffset?"]":">"):n+(e===this.markedOffset?"'":t||0!==e&&e!==r?" ":"")}if(t&&" "!==n){for(;n.length<51;)n+=" ";s+=n+f+"\n"}return t?s:n},g.fromDebug=function(t,e,r){var i=t.length;e=new g((i+1)/3|0,e,r);for(var n=0,f=0,s,o=!1,h=!1,a=!1,l=!1,u=!1;n<i;){switch(s=t.charAt(n++)){case"!":if(!r){if(h||a||l){u=!0;break}h=a=l=!0}e.offset=e.markedOffset=e.limit=f,o=!1;break;case"|":if(!r){if(h||l){u=!0;break}h=l=!0}e.offset=e.limit=f,o=!1;break;case"[":if(!r){if(h||a){u=!0;break}h=a=!0}e.offset=e.markedOffset=f,o=!1;break;case"<":if(!r){if(h){u=!0;break}h=!0}e.offset=f,o=!1;break;case"]":if(!r){if(l||a){u=!0;break}l=a=!0}e.limit=e.markedOffset=f,o=!1;break;case">":if(!r){if(l){u=!0;break}l=!0}e.limit=f,o=!1;break;case"'":if(!r){if(a){u=!0;break}a=!0}e.markedOffset=f,o=!1;break;case" ":o=!1;break;default:if(!r&&o){u=!0;break}if(s=parseInt(s+t.charAt(n++),16),!r&&(isNaN(s)||s<0||255<s))throw TypeError("Illegal str: Not a debug encoded string");e.view[f++]=s,o=!0}if(u)throw TypeError("Illegal str: Invalid symbol at "+n)}if(!r){if(!h||!l)throw TypeError("Illegal str: Missing offset or limit");if(f<e.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+f+" < "+i)}return e},f.toHex=function(t,e){if(t=void 0===t?this.offset:t,e=void 0===e?this.limit:e,!this.noAssert){if("number"!=typeof t||0!=t%1)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||0!=e%1)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||e<t||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}for(var r=Array(e-t),i;t<e;)(i=this.view[t++])<16?r.push("0",i.toString(16)):r.push(i.toString(16));return r.join("")},g.fromHex=function(t,e,r){if(!r){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if(0!=t.length%2)throw TypeError("Illegal str: Length not a multiple of 2")}var i=t.length;e=new g(i/2|0,e);for(var n,f=0,s=0;f<i;f+=2){if(n=parseInt(t.substring(f,f+2),16),!r&&(!isFinite(n)||n<0||255<n))throw TypeError("Illegal str: Contains non-hex characters");e.view[s++]=n}return e.limit=s,e};var u=b={j:1114111,i:function(t,e){var r=null;for("number"==typeof t&&(r=t,t=function(){return null});null!==r||null!==(r=t());)r<128?e(127&r):(r<2048?e(r>>6&31|192):(r<65536?e(r>>12&15|224):(e(r>>18&7|240),e(r>>12&63|128)),e(r>>6&63|128)),e(63&r|128)),r=null},f:function(t,e){function r(t){t=t.slice(0,t.indexOf(null));var e=Error(t.toString());throw e.name="TruncatedError",e.bytes=t,e}for(var i,n,f,s;null!==(i=t());)if(0==(128&i))e(i);else if(192==(224&i))null===(n=t())&&r([i,n]),e((31&i)<<6|63&n);else if(224==(240&i))null!==(n=t())&&null!==(f=t())||r([i,n,f]),e((15&i)<<12|(63&n)<<6|63&f);else{if(240!=(248&i))throw RangeError("Illegal starting byte: "+i);null!==(n=t())&&null!==(f=t())&&null!==(s=t())||r([i,n,f,s]),e((7&i)<<18|(63&n)<<12|(63&f)<<6|63&s)}},d:function(t,e){for(var r,i=null;null!==(r=null!==i?i:t());)55296<=r&&r<=57343&&null!==(i=t())&&56320<=i&&i<=57343?(e(1024*(r-55296)+i-56320+65536),i=null):e(r);null!==i&&e(i)},e:function(t,e){var r=null;for("number"==typeof t&&(r=t,t=function(){return null});null!==r||null!==(r=t());)r<=65535?e(r):(e(55296+((r-=65536)>>10)),e(r%1024+56320)),r=null},b:function(t,e){b.d(t,function(t){b.i(t,e)})},c:function(t,e){b.f(t,function(t){b.e(t,e)})},k:function(t){return t<128?1:t<2048?2:t<65536?3:4},l:function(t){for(var e,r=0;null!==(e=t());)r+=e<128?1:e<2048?2:e<65536?3:4;return r},a:function(t){var e=0,r=0;return b.d(t,function(t){++e,r+=t<128?1:t<2048?2:t<65536?3:4}),[e,r]}},b;return f.toUTF8=function(e,r){if(void 0===e&&(e=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||0!=e%1)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof r||0!=r%1)throw TypeError("Illegal end: Not an integer");if(r>>>=0,e<0||r<e||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+r+" <= "+this.buffer.byteLength)}var t;try{u.c(function(){return e<r?this.view[e++]:null}.bind(this),t=a())}catch(t){if(e!==r)throw RangeError("Illegal range: Truncated data, "+e+" != "+r)}return t()},g.fromUTF8=function(t,e,r){if(!r&&"string"!=typeof t)throw TypeError("Illegal str: Not a string");var i=new g(u.a(o(t),!0)[1],e,r),n=0;return u.b(o(t),function(t){i.view[n++]=t}),i.limit=n,i},g}if("function"==typeof define&&define.amd)define(["long"],u);else if("function"==typeof require&&"object"==typeof module&&module&&module.exports){var B=module,C,D;try{D=require("long")}catch(t){}C=u(D),B.exports=C}else(this.dcodeIO=this.dcodeIO||{}).ByteBuffer=u(this.dcodeIO.Long);;
- !function(e,t){"function"==typeof define&&define.amd?define(["bytebuffer"],t):"function"==typeof require&&"object"==typeof module&&module&&module.exports?module.exports=t(require("bytebuffer"),!0):(e.dcodeIO=e.dcodeIO||{}).ProtoBuf=t(e.dcodeIO.ByteBuffer)}(this,function(g,e){var n={},s;return n.ByteBuffer=g,n.Long=g.Long||null,n.VERSION="5.0.1",n.WIRE_TYPES={},n.WIRE_TYPES.VARINT=0,n.WIRE_TYPES.BITS64=1,n.WIRE_TYPES.LDELIM=2,n.WIRE_TYPES.STARTGROUP=3,n.WIRE_TYPES.ENDGROUP=4,n.WIRE_TYPES.BITS32=5,n.PACKABLE_WIRE_TYPES=[n.WIRE_TYPES.VARINT,n.WIRE_TYPES.BITS64,n.WIRE_TYPES.BITS32],n.TYPES={int32:{name:"int32",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:n.WIRE_TYPES.VARINT,defaultValue:n.Long?n.Long.ZERO:void 0},uint64:{name:"uint64",wireType:n.WIRE_TYPES.VARINT,defaultValue:n.Long?n.Long.UZERO:void 0},sint64:{name:"sint64",wireType:n.WIRE_TYPES.VARINT,defaultValue:n.Long?n.Long.ZERO:void 0},bool:{name:"bool",wireType:n.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:n.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:n.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:n.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:n.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:n.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:n.WIRE_TYPES.BITS64,defaultValue:n.Long?n.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:n.WIRE_TYPES.BITS64,defaultValue:n.Long?n.Long.ZERO:void 0},float:{name:"float",wireType:n.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:n.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:n.WIRE_TYPES.STARTGROUP,defaultValue:null}},n.MAP_KEY_TYPES=[n.TYPES.int32,n.TYPES.sint32,n.TYPES.sfixed32,n.TYPES.uint32,n.TYPES.fixed32,n.TYPES.int64,n.TYPES.sint64,n.TYPES.sfixed64,n.TYPES.uint64,n.TYPES.fixed64,n.TYPES.bool,n.TYPES.string,n.TYPES.bytes],n.ID_MIN=1,n.ID_MAX=536870911,n.convertFieldsToCamelCase=!1,n.populateAccessors=!0,n.populateDefaults=!0,n.Util=((s={}).IS_NODE=!("object"!=typeof process||"[object process]"!=process+""||process.browser),s.XHR=function(){for(var e=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],t=null,i=0;i<e.length;i++){try{t=e[i]()}catch(e){continue}break}if(!t)throw Error("XMLHttpRequest is not supported");return t},s.fetch=function(e,i){if(i&&"function"!=typeof i&&(i=null),s.IS_NODE){var t=require("fs");if(i)t.readFile(e,function(e,t){i(e?null:""+t)});else try{return t.readFileSync(e)}catch(e){return null}}else{var r=s.XHR();if(r.open("GET",e,!!i),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!i)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?i(r.responseText):i(null))},4!=r.readyState&&r.send(null)}},s.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,function(e,t){return t.toUpperCase()})},s),n.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},n.DotProto=function(r,s){function o(e,t){var i=-1,r=1;if("-"==e.charAt(0)&&(r=-1,e=e.substring(1)),s.NUMBER_DEC.test(e))i=parseInt(e);else if(s.NUMBER_HEX.test(e))i=parseInt(e.substring(2),16);else{if(!s.NUMBER_OCT.test(e))throw Error("illegal id value: "+(r<0?"-":"")+e);i=parseInt(e.substring(1),8)}if(i=r*i|0,!t&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+e);return i}function n(e){var t=1;if("-"==e.charAt(0)&&(t=-1,e=e.substring(1)),s.NUMBER_DEC.test(e))return t*parseInt(e,10);if(s.NUMBER_HEX.test(e))return t*parseInt(e.substring(2),16);if(s.NUMBER_OCT.test(e))return t*parseInt(e.substring(1),8);if("inf"===e)return 1/0*t;if("nan"===e)return NaN;if(s.NUMBER_FLT.test(e))return t*parseFloat(e);throw Error("illegal number value: "+(t<0?"-":"")+e)}function a(e,t,i){void 0===e[t]?e[t]=i:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(i))}var e={},t=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},i;(i=t.prototype)._readString=function(){var e='"'===this._stringOpen?s.STRING_DQ:s.STRING_SQ;e.lastIndex=this.index-1;var t=e.exec(this.source);if(!t)throw Error("unterminated string");return this.index=e.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,t[1]},i.next=function(){if(0<this.stack.length)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();var e,t;do{for(e=!1;s.WHITESPACE.test(t=this.source.charAt(this.index));)if("\n"===t&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(t=this.source.charAt(this.index)))return"/";do{if("\n"===t&&++this.line,++this.index===this.source.length)return null;e=t,t=this.source.charAt(this.index)}while("*"!==e||"/"!==t);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(t=this.index,s.DELIM.lastIndex=0,!s.DELIM.test(this.source.charAt(t++)))for(;t<this.source.length&&!s.DELIM.test(this.source.charAt(t));)++t;return'"'!==(t=this.source.substring(this.index,this.index=t))&&"'"!==t||(this._stringOpen=t),t},i.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},i.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},i.omit=function(e){return this.peek()===e&&(this.next(),!0)},i.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},e.Tokenizer=t;var l=function(e){this.tn=new t(e),this.proto3=!1},i;return(i=l.prototype).parse=function(){var e={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},t,i=!0,r;try{for(;t=this.tn.next();)switch(t){case"package":if(!i||null!==e.package)throw Error("unexpected 'package'");if(t=this.tn.next(),!s.TYPEREF.test(t))throw Error("illegal package name: "+t);this.tn.skip(";"),e.package=t;break;case"import":if(!i)throw Error("unexpected 'import'");("public"===(t=this.tn.peek())||(r="weak"===t))&&this.tn.next(),t=this._readString(),this.tn.skip(";"),r||e.imports.push(t);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(e.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(e,null),i=!1;break;case"enum":this._parseEnum(e),i=!1;break;case"option":this._parseOption(e);break;case"service":this._parseService(e);break;case"extend":this._parseExtend(e);break;default:throw Error("unexpected '"+t+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete e.name,e},l.parse=function(e){return new l(e).parse()},i._readString=function(){var e="",t;do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);e+=this.tn.next(),this.tn.skip(t),t=this.tn.peek()}while('"'===t||'"'===t);return e},i._readValue=function(e){var t=this.tn.peek();if('"'===t||"'"===t)return this._readString();if(this.tn.next(),s.NUMBER.test(t))return n(t);if(s.BOOL.test(t))return"true"===t.toLowerCase();if(e&&s.TYPEREF.test(t))return t;throw Error("illegal value: "+t)},i._parseOption=function(e,t){var i=this.tn.next(),r=!1;if("("===i&&(r=!0,i=this.tn.next()),!s.TYPEREF.test(i))throw Error("illegal option name: "+i);var n=i;r&&(this.tn.skip(")"),n="("+n+")",i=this.tn.peek(),s.FQTYPEREF.test(i)&&(n+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,n),t||this.tn.skip(";")},i._parseOptionValue=function(e,t){var i=this.tn.peek();if("{"!==i)a(e.options,t,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!s.NAME.test(i))throw Error("illegal option name: "+t+"."+i);this.tn.omit(":")?a(e.options,t+"."+i,this._readValue(!0)):this._parseOptionValue(e,t+"."+i)}},i._parseService=function(e){var t=this.tn.next();if(!s.NAME.test(t))throw Error("illegal service name at line "+this.tn.line+": "+t);var i={name:t,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(t=this.tn.next());)if("option"===t)this._parseOption(i);else{if("rpc"!==t)throw Error("illegal service token: "+t);this._parseServiceRPC(i)}this.tn.omit(";"),e.services.push(i)},i._parseServiceRPC=function(e){var t=this.tn.next();if(!s.NAME.test(t))throw Error("illegal rpc service method name: "+t);var i=t,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};if(this.tn.skip("("),"stream"===(t=this.tn.next()).toLowerCase()&&(r.request_stream=!0,t=this.tn.next()),!s.TYPEREF.test(t))throw Error("illegal rpc service request type: "+t);if(r.request=t,this.tn.skip(")"),"returns"!==(t=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+t);if(this.tn.skip("("),"stream"===(t=this.tn.next()).toLowerCase()&&(r.response_stream=!0,t=this.tn.next()),r.response=t,this.tn.skip(")"),"{"===(t=this.tn.peek())){for(this.tn.next();"}"!==(t=this.tn.next());){if("option"!==t)throw Error("illegal rpc service token: "+t);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e.rpc&&(e.rpc={}),e.rpc[i]=r},i._parseMessage=function(e,t){var i=!!t,r=this.tn.next(),n={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!s.NAME.test(r))throw Error("illegal "+(i?"group":"message")+" name: "+r);for(n.name=r,i&&(this.tn.skip("="),t.id=o(this.tn.next()),n.isGroup=!0),"["===(r=this.tn.peek())&&t&&this._parseFieldOptions(t),this.tn.skip("{");"}"!==(r=this.tn.next());)if(s.RULE.test(r))this._parseMessageField(n,r);else if("oneof"===r)this._parseMessageOneOf(n);else if("enum"===r)this._parseEnum(n);else if("message"===r)this._parseMessage(n);else if("option"===r)this._parseOption(n);else if("service"===r)this._parseService(n);else if("extensions"===r)n.extensions=this._parseExtensionRanges();else if("reserved"===r)this._parseIgnored();else if("extend"===r)this._parseExtend(n);else{if(!s.TYPEREF.test(r))throw Error("illegal message token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},i._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},i._parseMessageField=function(e,t,i){if(!s.RULE.test(t))throw Error("illegal message field rule: "+t);var r={rule:t,type:"",name:"",options:{},id:0};if("map"===t){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),t=this.tn.next(),!s.TYPE.test(t)&&!s.TYPEREF.test(t))throw Error("illegal message field type: "+t);if(r.keytype=t,this.tn.skip(","),t=this.tn.next(),!s.TYPE.test(t)&&!s.TYPEREF.test(t))throw Error("illegal message field: "+t);if(r.type=t,this.tn.skip(">"),t=this.tn.next(),!s.NAME.test(t))throw Error("illegal message field name: "+t);r.name=t,this.tn.skip("="),r.id=o(this.tn.next()),"["===(t=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(t=this._parseMessage(e,r),!/^[A-Z]/.test(t.name))throw Error("illegal group name: "+t.name);r.type=t.name,r.name=t.name.toLowerCase(),this.tn.omit(";")}else{if(!s.TYPE.test(i)&&!s.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(r.type=i,t=this.tn.next(),!s.NAME.test(t))throw Error("illegal message field name: "+t);r.name=t,this.tn.skip("="),r.id=o(this.tn.next()),"["===(t=this.tn.peek())&&this._parseFieldOptions(r),this.tn.skip(";")}return e.fields.push(r),r},i._parseMessageOneOf=function(e){var t=this.tn.next();if(!s.NAME.test(t))throw Error("illegal oneof name: "+t);var i=t,r=[];for(this.tn.skip("{");"}"!==(t=this.tn.next());)(t=this._parseMessageField(e,"optional",t)).oneof=i,r.push(t.id);this.tn.omit(";"),e.oneofs[i]=r},i._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},i._parseEnum=function(e){var t={name:"",values:[],options:{}},i=this.tn.next();if(!s.NAME.test(i))throw Error("illegal name: "+i);for(t.name=i,this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(t);else{if(!s.NAME.test(i))throw Error("illegal name: "+i);this.tn.skip("=");var r={name:i,id:o(this.tn.next(),!0)},i;"["===(i=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),t.values.push(r)}this.tn.omit(";"),e.enums.push(t)},i._parseExtensionRanges=function(){var e=[],t,i;do{for(i=[];;){switch(t=this.tn.next()){case"min":t=r.ID_MIN;break;case"max":t=r.ID_MAX;break;default:t=n(t)}if(i.push(t),2===i.length)break;if("to"!==this.tn.peek()){i.push(t);break}this.tn.next()}e.push(i)}while(this.tn.omit(","));return this.tn.skip(";"),e},i._parseExtend=function(e){var t=this.tn.next();if(!s.TYPEREF.test(t))throw Error("illegal extend reference: "+t);var i={ref:t,fields:[]};for(this.tn.skip("{");"}"!==(t=this.tn.next());)if(s.RULE.test(t))this._parseMessageField(i,t);else{if(!s.TYPEREF.test(t))throw Error("illegal extend token: "+t);if(!this.proto3)throw Error("illegal field rule: "+t);this._parseMessageField(i,"optional",t)}return this.tn.omit(";"),e.messages.push(i),i},i.toString=function(){return"Parser at line "+this.tn.line},e.Parser=l,e}(n,n.Lang),n.Reflect=function(f){function s(e,t){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new f.Long(e.low,e.high,void 0===t?e.unsigned:t);if("string"==typeof e)return f.Long.fromString(e,t||!1,10);if("number"==typeof e)return f.Long.fromNumber(e,t||!1);throw Error("not convertible to Long")}function l(e,t){var i,r=7&(i=t.readVarint32()),i=i>>>3;switch(r){case f.WIRE_TYPES.VARINT:for(;128==(128&(i=t.readUint8())););break;case f.WIRE_TYPES.BITS64:t.offset+=8;break;case f.WIRE_TYPES.LDELIM:i=t.readVarint32(),t.offset+=i;break;case f.WIRE_TYPES.STARTGROUP:l(i,t);break;case f.WIRE_TYPES.ENDGROUP:if(i===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+i+" ("+e+" expected)");case f.WIRE_TYPES.BITS32:t.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+r)}return!0}var o={},h=function(e,t,i){this.builder=e,this.parent=t,this.name=i},e;(e=h.prototype).fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},e.toString=function(e){return(e?this.className+" ":"")+this.fqn()},e.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},o.T=h;var a=function(e,t,i,r,n){h.call(this,e,t,i),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=n||"proto2"},e;(e=a.prototype=Object.create(h.prototype)).getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],i=0,r=this.children.length;i<r;++i)this.children[i]instanceof e&&t.push(this.children[i]);return t},e.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},e.getChild=function(e){for(var t="number"==typeof e?"id":"name",i=0,r=this.children.length;i<r;++i)if(this.children[i][t]===e)return this.children[i];return null},e.resolve=function(e,t){var i="string"==typeof e?e.split("."):e,r=this,n=0;if(""===i[n]){for(;null!==r.parent;)r=r.parent;n++}do{do{if(!(r instanceof o.Namespace)){r=null;break}if(!((r=r.getChild(i[n]))&&r instanceof o.T)||t&&!(r instanceof o.Namespace)){r=null;break}n++}while(n<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},e.qn=function(e){for(var t=[],i=e;t.unshift(i.name),null!==(i=i.parent););for(i=1;i<=t.length;i++){var r=t.slice(t.length-i);if(e===this.resolve(r,e instanceof o.Namespace))return r.join(".")}return e.fqn()},e.build=function(){for(var e={},t=this.children,i=0,r=t.length,n;i<r;++i)(n=t[i])instanceof a&&(e[n.name]=n.build());return Object.defineProperty&&Object.defineProperty(e,"$options",{value:this.buildOpt()}),e},e.buildOpt=function(){for(var e={},t=Object.keys(this.options),i=0,r=t.length;i<r;++i)e[t[i]]=this.options[t[i]];return e},e.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},o.Namespace=a;var u=function(e,t,i,r){if(this.type=e,this.resolvedType=t,this.isMapKey=i,this.syntax=r,i&&f.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},t=u.prototype;u.defaultFieldValue=function(e){if("string"==typeof e&&(e=f.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==f.TYPES.bytes?new g(0):e.defaultValue},t.verifyValue=function(t){function i(e,t){throw Error("Illegal value for "+r.toString(!0)+" of type "+r.type.name+": "+e+" ("+t+")")}var r=this;switch(this.type){case f.TYPES.int32:case f.TYPES.sint32:case f.TYPES.sfixed32:return("number"!=typeof t||t==t&&0!=t%1)&&i(typeof t,"not an integer"),4294967295<t?0|t:t;case f.TYPES.uint32:case f.TYPES.fixed32:return("number"!=typeof t||t==t&&0!=t%1)&&i(typeof t,"not an integer"),t<0?t>>>0:t;case f.TYPES.int64:case f.TYPES.sint64:case f.TYPES.sfixed64:if(f.Long)try{return s(t,!1)}catch(e){i(typeof t,e.message)}else i(typeof t,"requires Long.js");case f.TYPES.uint64:case f.TYPES.fixed64:if(f.Long)try{return s(t,!0)}catch(e){i(typeof t,e.message)}else i(typeof t,"requires Long.js");case f.TYPES.bool:return"boolean"!=typeof t&&i(typeof t,"not a boolean"),t;case f.TYPES.float:case f.TYPES.double:return"number"!=typeof t&&i(typeof t,"not a number"),t;case f.TYPES.string:return"string"==typeof t||t&&t instanceof String||i(typeof t,"not a string"),""+t;case f.TYPES.bytes:return g.isByteBuffer(t)?t:g.wrap(t,"base64");case f.TYPES.enum:for(var e=this.resolvedType.getChildren(f.Reflect.Enum.Value),n=0;n<e.length;n++)if(e[n].name==t||e[n].id==t)return e[n].id;if("proto3"===this.syntax)return("number"!=typeof t||t==t&&0!=t%1)&&i(typeof t,"not an integer"),(4294967295<t||t<0)&&i(typeof t,"not in range for uint32"),t;i(t,"not a valid enum value");case f.TYPES.group:case f.TYPES.message:if(t&&"object"==typeof t||i(typeof t,"object expected"),t instanceof this.resolvedType.clazz)return t;if(t instanceof f.Builder.Message){var e={},n;for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=e}return new this.resolvedType.clazz(t)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+t+" (undefined type "+this.type+")")},t.calculateLength=function(e,t){if(null===t)return 0;var i;switch(this.type){case f.TYPES.int32:return t<0?g.calculateVarint64(t):g.calculateVarint32(t);case f.TYPES.uint32:return g.calculateVarint32(t);case f.TYPES.sint32:return g.calculateVarint32(g.zigZagEncode32(t));case f.TYPES.fixed32:case f.TYPES.sfixed32:case f.TYPES.float:return 4;case f.TYPES.int64:case f.TYPES.uint64:return g.calculateVarint64(t);case f.TYPES.sint64:return g.calculateVarint64(g.zigZagEncode64(t));case f.TYPES.fixed64:case f.TYPES.sfixed64:return 8;case f.TYPES.bool:return 1;case f.TYPES.enum:return g.calculateVarint32(t);case f.TYPES.double:return 8;case f.TYPES.string:return i=g.calculateUTF8Bytes(t),g.calculateVarint32(i)+i;case f.TYPES.bytes:if(t.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+t.remaining()+" bytes remaining");return g.calculateVarint32(t.remaining())+t.remaining();case f.TYPES.message:return i=this.resolvedType.calculate(t),g.calculateVarint32(i)+i;case f.TYPES.group:return(i=this.resolvedType.calculate(t))+g.calculateVarint32(e<<3|f.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+t+" (unknown type)")},t.encodeValue=function(e,t,i){if(null===t)return i;switch(this.type){case f.TYPES.int32:t<0?i.writeVarint64(t):i.writeVarint32(t);break;case f.TYPES.uint32:i.writeVarint32(t);break;case f.TYPES.sint32:i.writeVarint32ZigZag(t);break;case f.TYPES.fixed32:i.writeUint32(t);break;case f.TYPES.sfixed32:i.writeInt32(t);break;case f.TYPES.int64:case f.TYPES.uint64:i.writeVarint64(t);break;case f.TYPES.sint64:i.writeVarint64ZigZag(t);break;case f.TYPES.fixed64:i.writeUint64(t);break;case f.TYPES.sfixed64:i.writeInt64(t);break;case f.TYPES.bool:"string"==typeof t?i.writeVarint32("false"===t.toLowerCase()?0:!!t):i.writeVarint32(t?1:0);break;case f.TYPES.enum:i.writeVarint32(t);break;case f.TYPES.float:i.writeFloat32(t);break;case f.TYPES.double:i.writeFloat64(t);break;case f.TYPES.string:i.writeVString(t);break;case f.TYPES.bytes:if(t.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+t.remaining()+" bytes remaining");e=t.offset,i.writeVarint32(t.remaining()),i.append(t),t.offset=e;break;case f.TYPES.message:e=(new g).LE(),this.resolvedType.encode(t,e),i.writeVarint32(e.offset),i.append(e.flip());break;case f.TYPES.group:this.resolvedType.encode(t,i),i.writeVarint32(e<<3|f.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+t+" (unknown type)")}return i},t.decode=function(e,t,i){if(t!=this.type.wireType)throw Error("Unexpected wire type for element");switch(this.type){case f.TYPES.int32:return 0|e.readVarint32();case f.TYPES.uint32:return e.readVarint32()>>>0;case f.TYPES.sint32:return 0|e.readVarint32ZigZag();case f.TYPES.fixed32:return e.readUint32()>>>0;case f.TYPES.sfixed32:return 0|e.readInt32();case f.TYPES.int64:return e.readVarint64();case f.TYPES.uint64:return e.readVarint64().toUnsigned();case f.TYPES.sint64:return e.readVarint64ZigZag();case f.TYPES.fixed64:return e.readUint64();case f.TYPES.sfixed64:return e.readInt64();case f.TYPES.bool:return!!e.readVarint32();case f.TYPES.enum:return e.readVarint32();case f.TYPES.float:return e.readFloat();case f.TYPES.double:return e.readDouble();case f.TYPES.string:return e.readVString();case f.TYPES.bytes:if(i=e.readVarint32(),e.remaining()<i)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+i+" required but got only "+e.remaining());return(t=e.clone()).limit=t.offset+i,e.offset+=i,t;case f.TYPES.message:return i=e.readVarint32(),this.resolvedType.decode(e,i);case f.TYPES.group:return this.resolvedType.decode(e,-1,i)}throw Error("[INTERNAL] Illegal decode type")},t.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case f.TYPES.int32:case f.TYPES.sint32:case f.TYPES.sfixed32:case f.TYPES.uint32:case f.TYPES.fixed32:return this.verifyValue(parseInt(e));case f.TYPES.int64:case f.TYPES.sint64:case f.TYPES.sfixed64:case f.TYPES.uint64:case f.TYPES.fixed64:return this.verifyValue(e);case f.TYPES.bool:return"true"===e;case f.TYPES.string:return this.verifyValue(e);case f.TYPES.bytes:return g.fromBinary(e)}},t.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===f.TYPES.bytes?e.toString("binary"):e.toString()},o.Element=u;var c=function(e,t,i,r,n,s){a.call(this,e,t,i,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!n,this._fieldsByName=this._fieldsById=this._fields=null},t;(t=c.prototype=Object.create(a.prototype)).build=function(e){if(this.clazz&&!e)return this.clazz;e=function(l,s){function u(e,i,r,n){if(null===e||"object"!=typeof e){var t;if(n&&n instanceof l.Reflect.Enum)if(null!==(t=l.Reflect.Enum.getName(n.object,e)))return t;return e}if(g.isByteBuffer(e))return i?e.toBase64():e.toBuffer();if(l.Long.isLong(e))return r?e.toString():l.Long.fromValue(e);var s;if(Array.isArray(e))return s=[],e.forEach(function(e,t){s[t]=u(e,i,r,n)}),s;if(s={},e instanceof l.Map){for(var t,o=(t=e.entries()).next();!o.done;o=t.next())s[e.keyElem.valueToString(o.value[0])]=u(o.value[1],i,r,e.valueElem.resolvedType);return s}var t=e.$type,o=void 0,a;for(a in e)e.hasOwnProperty(a)&&(t&&(o=t.getChild(a))?s[a]=u(e[a],i,r,o.resolvedType):s[a]=u(e[a],i,r));return s}var o=s.getChildren(l.Reflect.Message.Field),a=s.getChildren(l.Reflect.Message.OneOf),f=function(e,t){l.Builder.Message.call(this);for(var i=0,r=a.length;i<r;++i)this[a[i].name]=null;for(i=0,r=o.length;i<r;++i){var n=o[i];this[n.name]=n.repeated?[]:n.map?new l.Map(n):null,!n.required&&"proto3"!==s.syntax||null===n.defaultValue||(this[n.name]=n.defaultValue)}if(0<arguments.length)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof f)||Array.isArray(e)||e instanceof l.Map||g.isByteBuffer(e)||e instanceof ArrayBuffer||l.Long&&e instanceof l.Long)for(i=0,r=arguments.length;i<r;++i)void 0!==(n=arguments[i])&&this.$set(o[i].name,n);else this.$set(e)},h=f.prototype=Object.create(l.Builder.Message.prototype);h.add=function(e,t,i){var r=s._fieldsByName[e];if(!i){if(!r)throw Error(this+"#"+e+" is undefined");if(!(r instanceof l.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));if(!r.repeated)throw Error(this+"#"+e+" is not a repeated field");t=r.verifyValue(t,!0)}return null===this[e]&&(this[e]=[]),this[e].push(t),this},h.$add=h.add,h.set=function(e,t,i){if(e&&"object"==typeof e){for(var r in i=t,e)e.hasOwnProperty(r)&&void 0!==(t=e[r])&&this.$set(r,t,i);return this}if(r=s._fieldsByName[e],i)this[e]=t;else{if(!r)throw Error(this+"#"+e+" is not a field: undefined");if(!(r instanceof l.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));this[r.name]=t=r.verifyValue(t)}return r&&r.oneof&&(i=this[r.oneof.name],null!==t?(null!==i&&i!==r.name&&(this[i]=null),this[r.oneof.name]=r.name):i===e&&(this[r.oneof.name]=null)),this},h.$set=h.set,h.get=function(e,t){if(t)return this[e];var i=s._fieldsByName[e];if(!(i&&i instanceof l.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof l.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},h.$get=h.get;for(var e=0;e<o.length;e++){var t=o[e];t instanceof l.Reflect.Message.ExtensionField||s.builder.options.populateAccessors&&function(i){var e,e=(e=i.originalName.replace(/(_[a-zA-Z])/g,function(e){return e.toUpperCase().replace("_","")})).substring(0,1).toUpperCase()+e.substring(1),t=i.originalName.replace(/([A-Z])/g,function(e){return"_"+e}),r=function(e,t){return this[i.name]=t?e:i.verifyValue(e),this},n=function(){return this[i.name]};null===s.getChild("set"+e)&&(h["set"+e]=r),null===s.getChild("set_"+t)&&(h["set_"+t]=r),null===s.getChild("get"+e)&&(h["get"+e]=n),null===s.getChild("get_"+t)&&(h["get_"+t]=n)}(t)}return h.encode=function(t,e){"boolean"==typeof t&&(e=t,t=void 0);var i=!1;t||(t=new g,i=!0);var r=t.littleEndian;try{return s.encode(this,t.LE(),e),(i?t.flip():t).LE(r)}catch(e){throw t.LE(r),e}},f.encode=function(e,t,i){return new f(e).encode(t,i)},h.calculate=function(){return s.calculate(this)},h.encodeDelimited=function(e,t){var i=!1;e||(e=new g,i=!0);var r=(new g).LE();return s.encode(this,r,t).flip(),e.writeVarint32(r.remaining()),e.append(r),i?e.flip():e},h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},h.toArrayBuffer=h.encodeAB,h.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},h.toBuffer=h.encodeNB,h.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},h.toBase64=h.encode64,h.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},h.toHex=h.encodeHex,h.toRaw=function(e,t){return u(this,!!e,!!t,this.$type)},h.encodeJSON=function(){return JSON.stringify(u(this,!0,!0,this.$type))},f.decode=function(t,i,e){"string"==typeof i&&(e=i),"string"==typeof t&&(t=g.wrap(t,e||"base64")),i=(t=g.isByteBuffer(t)?t:g.wrap(t)).littleEndian;try{var r=s.decode(t.LE());return t.LE(i),r}catch(e){throw t.LE(i),e}},f.decodeDelimited=function(t,e){if("string"==typeof t&&(t=g.wrap(t,e||"base64")),(t=g.isByteBuffer(t)?t:g.wrap(t)).remaining()<1)return null;var i=t.offset,r=t.readVarint32();if(t.remaining()<r)return t.offset=i,null;try{var n=s.decode(t.slice(t.offset,t.offset+r).LE());return t.offset+=r,n}catch(e){throw t.offset+=r,e}},f.decode64=function(e){return f.decode(e,"base64")},f.decodeHex=function(e){return f.decode(e,"hex")},f.decodeJSON=function(e){return new f(JSON.parse(e))},h.toString=function(){return s.toString()},Object.defineProperty&&(Object.defineProperty(f,"$options",{value:s.buildOpt()}),Object.defineProperty(h,"$options",{value:f.$options}),Object.defineProperty(f,"$type",{value:s}),Object.defineProperty(h,"$type",{value:s})),f}(f,this),this._fields=[],this._fieldsById={},this._fieldsByName={};for(var t=0,i=this.children.length,r;t<i;t++)if((r=this.children[t])instanceof n||r instanceof c||r instanceof E){if(e.hasOwnProperty(r.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+r.toString(!0)+" cannot override static property '"+r.name+"'");e[r.name]=r.build()}else if(r instanceof c.Field)r.build(),this._fields.push(r),this._fieldsById[r.id]=r,this._fieldsByName[r.name]=r;else if(!(r instanceof c.OneOf||r instanceof d))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[t].toString(!0));return this.clazz=e},t.encode=function(e,t,i){for(var r=null,n,s=0,o=this._fields.length,a;s<o;++s)a=e[(n=this._fields[s]).name],n.required&&null===a?null===r&&(r=n):n.encode(i?a:n.verifyValue(a),t,e);if(null!==r)throw(e=Error("Missing at least one required field for "+this.toString(!0)+": "+r)).encoded=t,e;return t},t.calculate=function(e){for(var t=0,i=0,r=this._fields.length,n,s;i<r;++i){if(s=e[(n=this._fields[i]).name],n.required&&null===s)throw Error("Missing at least one required field for "+this.toString(!0)+": "+n);t+=n.calculate(s,e)}return t},t.decode=function(e,t,i){t="number"==typeof t?t:-1;for(var r=e.offset,n=new this.clazz,s,o,a;e.offset<r+t||-1===t&&0<e.remaining();){if(a=(s=e.readVarint32())>>>3,(o=7&s)===f.WIRE_TYPES.ENDGROUP){if(a!==i)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(i?i+" expected":"not a group")+")");break}if(s=this._fieldsById[a])s.repeated&&!s.options.packed?n[s.name].push(s.decode(o,e)):s.map?(o=s.decode(o,e),n[s.name].set(o[0],o[1])):(n[s.name]=s.decode(o,e),s.oneof&&(null!==(o=n[s.oneof.name])&&o!==s.name&&(n[o]=null),n[s.oneof.name]=s.name));else switch(o){case f.WIRE_TYPES.VARINT:e.readVarint32();break;case f.WIRE_TYPES.BITS32:e.offset+=4;break;case f.WIRE_TYPES.BITS64:e.offset+=8;break;case f.WIRE_TYPES.LDELIM:s=e.readVarint32(),e.offset+=s;break;case f.WIRE_TYPES.STARTGROUP:for(;l(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}for(e=0,t=this._fields.length;e<t;++e)if(null===n[(s=this._fields[e]).name])if("proto3"===this.syntax)n[s.name]=s.defaultValue;else{if(s.required)throw(e=Error("Missing at least one required field for "+this.toString(!0)+": "+s.name)).decoded=n,e;f.populateDefaults&&null!==s.defaultValue&&(n[s.name]=s.defaultValue)}return n},o.Message=c;var p=function(e,t,i,r,n,s,o,a,l,u){h.call(this,e,t,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=n,this.resolvedType=null,this.id=o,this.options=a||{},this.defaultValue=null,this.oneof=l||null,this.syntax=u||"proto2",this.originalName=this.name,this.keyElement=this.element=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=f.Util.toCamelCase(this.name))},t;(t=p.prototype=Object.create(h.prototype)).build=function(){this.element=new u(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new u(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=u.defaultFieldValue(this.type)},t.verifyValue=function(e,t){function i(e,t){throw Error("Illegal value for "+r.toString(!0)+" of type "+r.type.name+": "+e+" ("+t+")")}t=t||!1;var r=this,n;if(null===e)return this.required&&i(typeof e,"required"),"proto3"===this.syntax&&this.type!==f.TYPES.message&&i(typeof e,"proto3 field without field presence cannot be null"),null;if(!this.repeated||t)return this.map&&!t?e instanceof f.Map?e:(e instanceof Object||i(typeof e,"expected ProtoBuf.Map or raw object for map field"),new f.Map(this,e)):(!this.repeated&&Array.isArray(e)&&i(typeof e,"no array expected"),this.element.verifyValue(e));Array.isArray(e)||(e=[e]);var s=[];for(n=0;n<e.length;n++)s.push(this.element.verifyValue(e[n]));return s},t.hasWirePresence=function(e,t){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&t[this.oneof.name]===this.name)return!0;switch(this.type){case f.TYPES.int32:case f.TYPES.sint32:case f.TYPES.sfixed32:case f.TYPES.uint32:case f.TYPES.fixed32:return 0!==e;case f.TYPES.int64:case f.TYPES.sint64:case f.TYPES.sfixed64:case f.TYPES.uint64:case f.TYPES.fixed64:return 0!==e.low||0!==e.high;case f.TYPES.bool:return e;case f.TYPES.float:case f.TYPES.double:return 0!==e;case f.TYPES.string:return 0<e.length;case f.TYPES.bytes:return 0<e.remaining();case f.TYPES.enum:return 0!==e;case f.TYPES.message:return null!==e;default:return!0}},t.encode=function(t,r,e){if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return r;try{var i;if(this.repeated)if(this.options.packed&&0<=f.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){r.writeVarint32(this.id<<3|f.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1);var n=r.offset;for(i=0;i<t.length;i++)this.element.encodeValue(this.id,t[i],r);var s=r.offset-n,o=g.calculateVarint32(s);if(1<o){var a=r.slice(n,r.offset),n=n+(o-1);r.offset=n,r.append(a)}r.writeVarint32(s,n-o)}else for(i=0;i<t.length;i++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[i],r);else this.map?t.forEach(function(e,t,i){i=g.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,t)+g.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e),r.writeVarint32(this.id<<3|f.WIRE_TYPES.LDELIM),r.writeVarint32(i),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,t,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,r)},this):this.hasWirePresence(t,e)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,r))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return r},t.calculate=function(t,e){if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;var r=0;try{var i,n;if(this.repeated)if(this.options.packed&&0<=f.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){for(r+=g.calculateVarint32(this.id<<3|f.WIRE_TYPES.LDELIM),i=n=0;i<t.length;i++)n+=this.element.calculateLength(this.id,t[i]);r+=g.calculateVarint32(n),r+=n}else for(i=0;i<t.length;i++)r+=g.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t[i]);else this.map?t.forEach(function(e,t,i){e=g.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,t)+g.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e),r+=g.calculateVarint32(this.id<<3|f.WIRE_TYPES.LDELIM),r+=g.calculateVarint32(e),r+=e},this):this.hasWirePresence(t,e)&&(r+=g.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return r},t.decode=function(e,t,i){if(!(!this.map&&e==this.type.wireType||!i&&this.repeated&&this.options.packed&&e==f.WIRE_TYPES.LDELIM||this.map&&e==f.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==f.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&0<=f.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)&&!i){for(e=t.readVarint32(),e=t.offset+e,i=[];t.offset<e;)i.push(this.decode(this.type.wireType,t,!0));return i}if(this.map){var r=u.defaultFieldValue(this.keyType);if(i=u.defaultFieldValue(this.type),e=t.readVarint32(),t.remaining()<e)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+e+" required but got only "+t.remaining());var n=t.clone();for(n.limit=n.offset+e,t.offset+=e;0<n.remaining();)if(e=7&(t=n.readVarint32()),1===(t>>>=3))r=this.keyElement.decode(n,e,t);else{if(2!==t)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(n,e,t)}return[r,i]}return this.element.decode(t,e,this.id)},o.Message.Field=p,(t=function(e,t,i,r,n,s,o){p.call(this,e,t,i,null,r,n,s,o)}).prototype=Object.create(p.prototype),o.Message.ExtensionField=t,o.Message.OneOf=function(e,t,i){h.call(this,e,t,i),this.fields=[]};var n=function(e,t,i,r,n){a.call(this,e,t,i,r,n),this.className="Enum",this.object=null};n.getName=function(e,t){for(var i=Object.keys(e),r=0,n;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(n.prototype=Object.create(a.prototype)).build=function(e){if(this.object&&!e)return this.object;e=new f.Builder.Enum;for(var t=this.getChildren(n.Value),i=0,r=t.length;i<r;++i)e[t[i].name]=t[i].id;return Object.defineProperty&&Object.defineProperty(e,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=e},o.Enum=n,(t=function(e,t,i,r){h.call(this,e,t,i),this.className="Enum.Value",this.id=r}).prototype=Object.create(h.prototype),o.Enum.Value=t;var d=function(e,t,i,r){h.call(this,e,t,i),this.field=r};d.prototype=Object.create(h.prototype),o.Extension=d;var E=function(e,t,i,r){a.call(this,e,t,i,r),this.className="Service",this.clazz=null};(E.prototype=Object.create(a.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(t,n){for(var s=function(e){t.Builder.Service.call(this),this.rpcImpl=e||function(e,t,i){setTimeout(i.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},e=s.prototype=Object.create(t.Builder.Service.prototype),i=n.getChildren(t.Reflect.Service.RPCMethod),r=0;r<i.length;r++)!function(r){e[r.name]=function(e,i){try{try{e=r.resolvedRequestType.clazz.decode(g.wrap(e))}catch(e){if(!(e instanceof TypeError))throw e}if(null===e||"object"!=typeof e)throw Error("Illegal arguments");e instanceof r.resolvedRequestType.clazz||(e=new r.resolvedRequestType.clazz(e)),this.rpcImpl(r.fqn(),e,function(e,t){if(e)i(e);else{null===t&&(t="");try{t=r.resolvedResponseType.clazz.decode(t)}catch(e){}t&&t instanceof r.resolvedResponseType.clazz?i(null,t):i(Error("Illegal response type received in service method "+n.name+"#"+r.name))}})}catch(e){setTimeout(i.bind(this,e),0)}},s[r.name]=function(e,t,i){new s(e)[r.name](t,i)},Object.defineProperty&&(Object.defineProperty(s[r.name],"$options",{value:r.buildOpt()}),Object.defineProperty(e[r.name],"$options",{value:s[r.name].$options}))}(i[r]);return Object.defineProperty&&(Object.defineProperty(s,"$options",{value:n.buildOpt()}),Object.defineProperty(e,"$options",{value:s.$options}),Object.defineProperty(s,"$type",{value:n}),Object.defineProperty(e,"$type",{value:n})),s}(f,this)},o.Service=E;var y=function(e,t,i,r){h.call(this,e,t,i),this.className="Service.Method",this.options=r||{}};return(y.prototype=Object.create(h.prototype)).buildOpt=e.buildOpt,o.Service.Method=y,(e=function(e,t,i,r,n,s,o,a){y.call(this,e,t,i,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=n,this.requestStream=s,this.responseStream=o,this.resolvedResponseType=this.resolvedRequestType=null}).prototype=Object.create(y.prototype),o.Service.RPCMethod=e,o}(n),n.Builder=function(u,t,o){function f(t){t.messages&&t.messages.forEach(function(e){e.syntax=t.syntax,f(e)}),t.enums&&t.enums.forEach(function(e){e.syntax=t.syntax})}var a=function(e){this.ptr=this.ns=new o.Namespace(this,null,""),this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},e=a.prototype;return a.isMessage=function(e){return"string"==typeof e.name&&void 0===e.values&&void 0===e.rpc},a.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},a.isEnum=function(e){return!("string"!=typeof e.name||void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},a.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},a.isExtend=function(e){return"string"==typeof e.ref},e.reset=function(){return this.ptr=this.ns,this},e.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach(function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new o.Namespace(this,this.ptr,e)),this.ptr=t},this),this},e.create=function(e){if(!e)return this;if(Array.isArray(e)){if(0===e.length)return this;e=e.slice()}else e=[e];for(var t=[e];0<t.length;){if(e=t.pop(),!Array.isArray(e))throw Error("not a valid namespace: "+JSON.stringify(e));for(;0<e.length;){var i=e.shift();if(a.isMessage(i)){var n=new o.Message(this,this.ptr,i.name,i.options,i.isGroup,i.syntax),r={};i.oneofs&&Object.keys(i.oneofs).forEach(function(e){n.addChild(r[e]=new o.Message.OneOf(this,n,e))},this),i.fields&&i.fields.forEach(function(e){if(null!==n.getChild(0|e.id))throw Error("duplicate or invalid field id in "+n.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+n.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=r[e.oneof]))throw Error("illegal oneof in "+n.name+"#"+e.name+": "+e.oneof);e=new o.Message.Field(this,n,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,i.syntax),t&&t.fields.push(e),n.addChild(e)},this);var s=[];if(i.enums&&i.enums.forEach(function(e){s.push(e)}),i.messages&&i.messages.forEach(function(e){s.push(e)}),i.services&&i.services.forEach(function(e){s.push(e)}),i.extensions&&(n.extensions="number"==typeof i.extensions[0]?[i.extensions]:i.extensions),this.ptr.addChild(n),0<s.length){t.push(e),e=s,s=null,this.ptr=n,n=null;continue}s=null}else if(a.isEnum(i))n=new o.Enum(this,this.ptr,i.name,i.options,i.syntax),i.values.forEach(function(e){n.addChild(new o.Enum.Value(this,n,e.name,e.id))},this),this.ptr.addChild(n);else if(a.isService(i))n=new o.Service(this,this.ptr,i.name,i.options),Object.keys(i.rpc).forEach(function(e){var t=i.rpc[e];n.addChild(new o.Service.RPCMethod(this,n,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))},this),this.ptr.addChild(n);else{if(!a.isExtend(i))throw Error("not a valid definition: "+JSON.stringify(i));if(n=this.ptr.resolve(i.ref,!0))i.fields.forEach(function(t){if(null!==n.getChild(0|t.id))throw Error("duplicate extended field id in "+n.name+": "+t.id);if(n.extensions){var i=!1;if(n.extensions.forEach(function(e){t.id>=e[0]&&t.id<=e[1]&&(i=!0)}),!i)throw Error("illegal extended field id in "+n.name+": "+t.id+" (not within valid ranges)")}var e=t.name;this.options.convertFieldsToCamelCase&&(e=u.Util.toCamelCase(e));var e=new o.Message.ExtensionField(this,n,t.rule,t.type,this.ptr.fqn()+"."+e,t.id,t.options),r=new o.Extension(this,this.ptr,t.name,e);e.extension=r,this.ptr.addChild(r),n.addChild(e)},this);else if(!/\.?google\.protobuf\./.test(i.ref))throw Error("extended message "+i.ref+" is not defined")}n=i=null}e=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},e.import=function(t,e){var i="/";if("string"==typeof e){if(u.Util.IS_NODE&&(e=require("path").resolve(e)),!0===this.files[e])return this.reset();this.files[e]=!0}else if("object"==typeof e){var r=e.root;if(u.Util.IS_NODE&&(r=require("path").resolve(r)),(0<=r.indexOf("\\")||0<=e.file.indexOf("\\"))&&(i="\\"),r=r+i+e.file,!0===this.files[r])return this.reset();this.files[r]=!0}if(t.imports&&0<t.imports.length){var n=!1;"object"==typeof e?(this.importRoot=e.root,n=!0,r=this.importRoot,e=e.file,(0<=r.indexOf("\\")||0<=e.indexOf("\\"))&&(i="\\")):"string"==typeof e?this.importRoot?r=this.importRoot:0<=e.indexOf("/")?""===(r=e.replace(/\/[^\/]*$/,""))&&(r="/"):0<=e.indexOf("\\")?(r=e.replace(/\\[^\\]*$/,""),i="\\"):r=".":r=null;for(var s=0;s<t.imports.length;s++)if("string"==typeof t.imports[s]){if(!r)throw Error("cannot determine import root");var o=t.imports[s];if("google/protobuf/descriptor.proto"!==o&&(o=r+i+o,!0!==this.files[o])){/\.proto$/i.test(o)&&!u.DotProto&&(o=o.replace(/\.proto$/,".json"));var a=u.Util.fetch(o);if(null===a)throw Error("failed to import '"+o+"' in '"+e+"': file not found");/\.json$/i.test(o)?this.import(JSON.parse(a+""),o):this.import(u.DotProto.Parser.parse(a),o)}}else e?/\.(\w+)$/.test(e)?this.import(t.imports[s],e.replace(/^(.+)\.(\w+)$/,function(e,t,i){return t+"_import"+s+"."+i})):this.import(t.imports[s],e+"_import"+s):this.import(t.imports[s]);n&&(this.importRoot=null)}t.package&&this.define(t.package),t.syntax&&f(t);var l=this.ptr;return t.options&&Object.keys(t.options).forEach(function(e){l.options[e]=t.options[e]}),t.messages&&(this.create(t.messages),this.ptr=l),t.enums&&(this.create(t.enums),this.ptr=l),t.services&&(this.create(t.services),this.ptr=l),t.extends&&this.create(t.extends),this.reset()},e.resolveAll=function(){var e;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof o.Namespace)this.ptr.children.forEach(function(e){this.ptr=e,this.resolveAll()},this);else if(this.ptr instanceof o.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=u.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(e=(this.ptr instanceof o.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if((this.ptr.resolvedType=e)instanceof o.Enum){if(this.ptr.type=u.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==e.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(e instanceof o.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=e.isGroup?u.TYPES.group:u.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=u.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof u.Reflect.Service.Method){if(!(this.ptr instanceof u.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((e=this.ptr.parent.resolve(this.ptr.requestName,!0))&&e instanceof u.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=e,!((e=this.ptr.parent.resolve(this.ptr.responseName,!0))&&e instanceof u.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=e}else if(!(this.ptr instanceof u.Reflect.Message.OneOf||this.ptr instanceof u.Reflect.Extension||this.ptr instanceof u.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},e.build=function(e){if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;e="string"==typeof e?e.split("."):e;for(var t=this.result,i=0;i<e.length;i++){if(!t[e[i]]){t=null;break}t=t[e[i]]}return t},e.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},e.toString=function(){return"Builder"},a.Message=function(){},a.Enum=function(){},a.Service=function(){},a}(n,n.Lang,n.Reflect),n.Map=function(e,o){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var t=function(e,t){if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new o.Element(e.keyType,null,!0,e.syntax),this.valueElem=new o.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),t)for(var i=Object.keys(t),r=0;r<i.length;r++){var n=this.keyElem.valueFromString(i[r]),s=this.valueElem.verifyValue(t[i[r]]);this.map[this.keyElem.valueToString(n)]={key:n,value:s}}},i=t.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=(e=this.keyElem.valueToString(this.keyElem.verifyValue(e)))in this.map;return delete this.map[e],t},i.entries=function(){for(var e=[],t=Object.keys(this.map),i=0,r;i<t.length;i++)e.push([(r=this.map[t[i]]).key,r.value]);return n(e)},i.keys=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].key);return n(e)},i.values=function(){for(var e=[],t=Object.keys(this.map),i=0;i<t.length;i++)e.push(this.map[t[i]].value);return n(e)},i.forEach=function(e,t){for(var i=Object.keys(this.map),r=0,n;r<i.length;r++)e.call(t,(n=this.map[i[r]]).value,n.key,this)},i.set=function(e,t){var i=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(i)]={key:i,value:r},this},i.get=function(e){return(e=this.keyElem.valueToString(this.keyElem.verifyValue(e)))in this.map?this.map[e].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},t}(n,n.Reflect),n.loadProto=function(e,t,i){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(i=t,t=void 0),n.loadJson(n.DotProto.Parser.parse(e),t,i)},n.protoFromString=n.loadProto,n.loadProtoFile=function(t,i,r){if(i&&"object"==typeof i?(r=i,i=null):i&&"function"==typeof i||(i=null),i)return n.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,function(e){if(null===e)i(Error("Failed to fetch file"));else try{i(null,n.loadProto(e,r,t))}catch(e){i(e)}});var e=n.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===e?null:n.loadProto(e,r,t)},n.protoFromFile=n.loadProtoFile,n.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=n.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=n.populateAccessors),new n.Builder(e)},n.loadJson=function(e,t,i){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(i=t,t=null),t&&"object"==typeof t||(t=n.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,i),t.resolveAll(),t},n.loadJsonFile=function(t,i,r){if(i&&"object"==typeof i?(r=i,i=null):i&&"function"==typeof i||(i=null),i)return n.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,function(e){if(null===e)i(Error("Failed to fetch file"));else try{i(null,n.loadJson(JSON.parse(e),r,t))}catch(e){i(e)}});var e=n.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===e?null:n.loadJson(JSON.parse(e),r,t)},n});;
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Stats=t()}(this,function(){var c=function(){function e(e){return l.appendChild(e.dom),e}function t(e){for(var t=0;t<l.children.length;t++)l.children[t].style.display=t===e?"block":"none";n=e}var n=0,l=document.createElement("div");l.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",l.addEventListener("click",function(e){e.preventDefault(),t(++n%l.children.length)},!1);var i=(performance||Date).now(),a=i,o=0,f=e(new c.Panel("FPS","#0ff","#002")),r=e(new c.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=e(new c.Panel("MB","#f08","#201"));return t(0),{REVISION:16,dom:l,addPanel:e,showPanel:t,begin:function(){i=(performance||Date).now()},end:function(){o++;var e=(performance||Date).now();if(r.update(e-i,200),a+1e3<=e&&(f.update(1e3*o/(e-a),100),a=e,o=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){i=this.end()},domElement:l,setMode:t}};return c.Panel=function(n,l,i){var a=1/0,o=0,f=Math.round,r=f(window.devicePixelRatio||1),d=80*r,e=48*r,c=3*r,p=2*r,u=3*r,s=15*r,m=74*r,h=30*r,y=document.createElement("canvas");y.width=d,y.height=e,y.style.cssText="width:80px;height:48px";var v=y.getContext("2d");return v.font="bold "+9*r+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=i,v.fillRect(0,0,d,e),v.fillStyle=l,v.fillText(n,c,p),v.fillRect(u,s,m,h),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(u,s,m,h),{dom:y,update:function(e,t){a=Math.min(a,e),o=Math.max(o,e),v.fillStyle=i,v.globalAlpha=1,v.fillRect(0,0,d,s),v.fillStyle=l,v.fillText(f(e)+" "+n+" ("+f(a)+"-"+f(o)+")",c,p),v.drawImage(y,u+r,s,m-r,h,u,s,m-r,h),v.fillRect(u+m-r,s,r,h),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(u+m-r,s,r,f((1-e/t)*h))}}},c});;
- !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(e):"function"==typeof define&&define.amd?define(r):r(e)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this,function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.1",buffer;if("undefined"!=typeof module&&module.exports)try{buffer=eval("require('buffer').Buffer")}catch(e){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var r={},o=0,t=e.length;o<t;o++)r[e.charAt(o)]=o;return r}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(e){var r;if(e.length<2)return(r=e.charCodeAt(0))<128?e:r<2048?fromCharCode(192|r>>>6)+fromCharCode(128|63&r):fromCharCode(224|r>>>12&15)+fromCharCode(128|r>>>6&63)+fromCharCode(128|63&r);var r=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|r>>>18&7)+fromCharCode(128|r>>>12&63)+fromCharCode(128|r>>>6&63)+fromCharCode(128|63&r)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var r=[0,2,1][e.length%3],o=e.charCodeAt(0)<<16|(1<e.length?e.charCodeAt(1):0)<<8|(2<e.length?e.charCodeAt(2):0),t;return[b64chars.charAt(o>>>18),b64chars.charAt(o>>>12&63),2<=r?"=":b64chars.charAt(o>>>6&63),1<=r?"=":b64chars.charAt(63&o)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e)).toString("base64")}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e)).toString("base64")}:function(e){return btoa(utob(e))},encode=function(e,r){return r?_encode(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):_encode(String(e))},encodeURI=function(e){return encode(e,!0)},re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),cb_btou=function(e){switch(e.length){case 4:var r,o=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return fromCharCode(55296+(o>>>10))+fromCharCode(56320+(1023&o));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var r=e.length,o=r%4,t=(0<r?b64tab[e.charAt(0)]<<18:0)|(1<r?b64tab[e.charAt(1)]<<12:0)|(2<r?b64tab[e.charAt(2)]<<6:0)|(3<r?b64tab[e.charAt(3)]:0),n=[fromCharCode(t>>>16),fromCharCode(t>>>8&255),fromCharCode(255&t)];return n.length-=[0,0,2,1][o],n.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(e){return encode(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),"undefined"!=typeof module&&module.exports?module.exports.Base64=global.Base64:"function"==typeof define&&define.amd&&define([],function(){return global.Base64}),{Base64:global.Base64}});;
- void 0===Date.now&&(Date.now=function(){return(new Date).valueOf()});var TWEEN=TWEEN||function(){var r=[];return{REVISION:"14",getAll:function(){return r},removeAll:function(){r=[]},add:function(n){r.push(n)},remove:function(n){var t=r.indexOf(n);-1!==t&&r.splice(t,1)},update:function(n){if(0===r.length)return!1;var t=0;for(n=void 0!==n?n:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();t<r.length;)r[t].update(n)?t++:r.splice(t,1);return!0}}}();TWEEN.Tween=function(n){var c=n,s={},h={},l={},p=1e3,E=0,I=!1,r=!1,v=!1,w=0,M=null,d=TWEEN.Easing.Linear.None,O=TWEEN.Interpolation.Linear,N=[],T=null,g=!1,m=null,W=null,t=null;for(var i in n)s[i]=parseFloat(n[i],10);this.to=function(n,t){return void 0!==t&&(p=t),h=n,this},this.start=function(n){for(var t in TWEEN.add(this),g=!(r=!0),M=void 0!==n?n:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now(),M+=w,h){if(h[t]instanceof Array){if(0===h[t].length)continue;h[t]=[c[t]].concat(h[t])}s[t]=c[t],s[t]instanceof Array==!1&&(s[t]*=1),l[t]=s[t]||0}return this},this.stop=function(){return r&&(TWEEN.remove(this),r=!1,null!==t&&t.call(c),this.stopChainedTweens()),this},this.stopChainedTweens=function(){for(var n=0,t=N.length;n<t;n++)N[n].stop()},this.delay=function(n){return w=n,this},this.repeat=function(n){return E=n,this},this.yoyo=function(n){return I=n,this},this.easing=function(n){return d=n,this},this.interpolation=function(n){return O=n,this},this.chain=function(){return N=arguments,this},this.onStart=function(n){return T=n,this},this.onUpdate=function(n){return m=n,this},this.onComplete=function(n){return W=n,this},this.onStop=function(n){return t=n,this},this.update=function(n){var t;if(n<M)return!0;!1===g&&(null!==T&&T.call(c),g=!0);var r=(n-M)/p,i=d(r=1<r?1:r);for(t in h){var u=s[t]||0,o=h[t];o instanceof Array?c[t]=O(o,i):("string"==typeof o&&(o=u+parseFloat(o,10)),"number"==typeof o&&(c[t]=u+(o-u)*i))}if(null!==m&&m.call(c,i),1!=r)return!0;if(0<E){for(t in isFinite(E)&&E--,l){if("string"==typeof h[t]&&(l[t]=l[t]+parseFloat(h[t],10)),I){var e=l[t];l[t]=h[t],h[t]=e}s[t]=l[t]}return I&&(v=!v),M=n+w,!0}null!==W&&W.call(c);for(var a=0,f=N.length;a<f;a++)N[a].start(n);return!1}},TWEEN.Easing={Linear:{None:function(n){return n}},Quadratic:{In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}},Cubic:{In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}},Quartic:{In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}},Quintic:{In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}},Sinusoidal:{In:function(n){return 1-Math.cos(n*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return.5*(1-Math.cos(Math.PI*n))}},Exponential:{In:function(n){return 0===n?0:Math.pow(1024,n-1)},Out:function(n){return 1===n?1:1-Math.pow(2,-10*n)},InOut:function(n){return 0===n?0:1===n?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(2-Math.pow(2,-10*(n-1)))}},Circular:{In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}},Elastic:{In:function(n){var t,r=.1,i=.4;return 0===n?0:1===n?1:(t=!r||r<1?(r=1,.1):.4*Math.asin(1/r)/(2*Math.PI),-r*Math.pow(2,10*(n-=1))*Math.sin((n-t)*(2*Math.PI)/.4))},Out:function(n){var t,r=.1,i=.4;return 0===n?0:1===n?1:(t=!r||r<1?(r=1,.1):.4*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*n)*Math.sin((n-t)*(2*Math.PI)/.4)+1)},InOut:function(n){var t,r=.1,i=.4;return 0===n?0:1===n?1:(t=!r||r<1?(r=1,.1):.4*Math.asin(1/r)/(2*Math.PI),(n*=2)<1?r*Math.pow(2,10*(n-=1))*Math.sin((n-t)*(2*Math.PI)/.4)*-.5:r*Math.pow(2,-10*(n-=1))*Math.sin((n-t)*(2*Math.PI)/.4)*.5+1)}},Back:{In:function(n){var t=1.70158;return n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?n*n*((t+1)*n-t)*.5:.5*((n-=2)*n*((t+1)*n+t)+2)}},Bounce:{In:function(n){return 1-TWEEN.Easing.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?.5*TWEEN.Easing.Bounce.In(2*n):.5*TWEEN.Easing.Bounce.Out(2*n-1)+.5}}},TWEEN.Interpolation={Linear:function(n,t){var r=n.length-1,i=r*t,u=Math.floor(i),o=TWEEN.Interpolation.Utils.Linear;return t<0?o(n[0],n[1],i):1<t?o(n[r],n[r-1],r-i):o(n[u],n[r<u+1?r:u+1],i-u)},Bezier:function(n,t){var r=0,i=n.length-1,u=Math.pow,o=TWEEN.Interpolation.Utils.Bernstein,e;for(e=0;e<=i;e++)r+=u(1-t,i-e)*u(t,e)*n[e]*o(i,e);return r},CatmullRom:function(n,t){var r=n.length-1,i=r*t,u=Math.floor(i),o=TWEEN.Interpolation.Utils.CatmullRom;return n[0]===n[r]?(t<0&&(u=Math.floor(i=r*(1+t))),o(n[(u-1+r)%r],n[u],n[(u+1)%r],n[(u+2)%r],i-u)):t<0?n[0]-(o(n[0],n[0],n[1],n[1],-i)-n[0]):1<t?n[r]-(o(n[r],n[r],n[r-1],n[r-1],i-r)-n[r]):o(n[u?u-1:0],n[u],n[r<u+1?r:u+1],n[r<u+2?r:u+2],i-u)},Utils:{Linear:function(n,t,r){return(t-n)*r+n},Bernstein:function(n,t){var r=TWEEN.Interpolation.Utils.Factorial;return r(n)/r(t)/r(n-t)},Factorial:function(){var i=[1];return function(n){var t=1,r;if(i[n])return i[n];for(r=n;1<r;r--)t*=r;return i[n]=t}}(),CatmullRom:function(n,t,r,i,u){var o=.5*(r-n),e=.5*(i-t),a=u*u,f;return(2*t-2*r+o+e)*(u*a)+(-3*t+3*r-2*o-e)*a+o*u+t}}};;
- !function(e){"use strict";function t(){}function s(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}function o(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&o(e.listener)}var r=t.prototype,i=e.EventEmitter;r.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp)for(n in t={},r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n]);else t=r[e]||(r[e]=[]);return t},r.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},r.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},r.addListener=function(e,t){if(!o(t))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(e),i="object"==typeof t;for(n in r)r.hasOwnProperty(n)&&-1===s(r[n],t)&&r[n].push(i?t:{listener:t,once:!1});return this},r.on=n("addListener"),r.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},r.once=n("addOnceListener"),r.defineEvent=function(e){return this.getListeners(e),this},r.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},r.removeListener=function(e,t){var n,r,i=this.getListenersAsObject(e);for(r in i)i.hasOwnProperty(r)&&-1!==(n=s(i[r],t))&&i[r].splice(n,1);return this},r.off=n("removeListener"),r.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},r.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},r.manipulateListeners=function(e,t,n){var r,i,s=e?this.removeListener:this.addListener,o=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)s.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?s.call(this,r,i):o.call(this,r,i));return this},r.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},r.removeAllListeners=n("removeEvent"),r.emitEvent=function(e,t){var n,r,i,s,o=this.getListenersAsObject(e);for(s in o)if(o.hasOwnProperty(s))for(n=o[s].slice(0),i=0;i<n.length;i++)!0===(r=n[i]).once&&this.removeListener(e,r.listener),r.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},r.trigger=n("emitEvent"),r.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},r.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return e.EventEmitter=i,t},"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:e.EventEmitter=t}("undefined"!=typeof window?window:this||{});;
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.THREE={})}(this,function(t){"use strict";function e(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}),Object.assign(e.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var i,n=this._listeners[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e,i=this._listeners[t.type];if(void 0!==i){t.target=this;for(var n=i.slice(0),r=0,a=n.length;r<a;r++)n[r].call(this,t)}}}});var Gt="95",i={LEFT:0,MIDDLE:1,RIGHT:2},ct=0,ht=1,lt=2,n=3,r=0,a=1,o=0,U=1,N=2,s=0,Ht=1,ut=2,c=1,h=2,l=0,u=1,v=2,pt=0,dt=1,ft=2,mt=3,gt=4,vt=5,p=100,d=101,f=102,m=103,g=104,y=200,x=201,b=202,_=203,w=204,M=205,E=206,T=207,S=208,A=209,L=210,yt=0,xt=1,bt=2,_t=3,wt=4,Mt=5,Et=6,Tt=7,D=0,B=1,F=2,z=0,Vt=1,R=2,C=3,P=4,O=300,G=301,H=302,V=303,k=304,j=305,W=306,X=307,I=1e3,q=1001,Y=1002,J=1003,Z=1004,Q=1005,K=1006,$=1007,tt=1008,kt=1009,et=1010,it=1011,nt=1012,rt=1013,at=1014,jt=1015,Wt=1016,ot=1017,st=1018,St=1019,At=1020,Lt=1021,Rt=1022,Xt=1023,Ct=1024,Pt=1025,Ot=Xt,It=1026,Nt=1027,Dt=33776,Ut=33777,Bt=33778,Ft=33779,zt=35840,qt=35841,Yt=35842,Jt=35843,Zt=36196,Qt=37808,Kt=37809,$t=37810,te=37811,ee=37812,ie=37813,ne=37814,re=37815,ae=37816,oe=37817,se=37818,ce=37819,he=37820,le=37821,ue=2200,pe=2201,de=2202,fe=2300,me=2301,ge=2302,ve=2400,ye=2401,xe=2402,be=0,_e=1,we=2,Me=3e3,Ee=3001,Te=3007,Se=3002,Ae=3003,Le=3004,Re=3005,Ce=3006,Pe=3200,Oe=3201,Ie=0,Ne=1,De={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var o=[],t=0;t<256;t++)o[t]=(t<16?"0":"")+t.toString(16);return function t(){var e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0,a;return(o[255&e]+o[e>>8&255]+o[e>>16&255]+o[e>>24&255]+"-"+o[255&i]+o[i>>8&255]+"-"+o[i>>16&15|64]+o[i>>24&255]+"-"+o[63&n|128]+o[n>>8&255]+"-"+o[n>>16&255]+o[n>>24&255]+o[255&r]+o[r>>8&255]+o[r>>16&255]+o[r>>24&255]).toUpperCase()}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:i<=t?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())},degToRad:function(t){return t*De.DEG2RAD},radToDeg:function(t){return t*De.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}},Ue,Be,Fe,ze,Ge,He,Ve,ke,je,We,Xe,qe,Ye,Je,Ze,Qe,Ke,$e,ti,ei,ii,ni,ri;function ai(t,e){this.x=t||0,this.y=e||0}function oi(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function si(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function ci(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function hi(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(ai.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(ai.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(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:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var 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:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(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:(Ue=new ai,Be=new ai,function t(e,i){return Ue.set(e,e),Be.set(i,i),this.clamp(Ue,Be)}),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){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:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}}),Object.assign(oi.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,c,h,l,u,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=h,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new oi).fromArray(this.elements)},copy:function(t){var 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:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(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:(Xe=new ci,function t(e){var i=this.elements,n=e.elements,r=1/Xe.setFromMatrixColumn(e,0).length(),a=1/Xe.setFromMatrixColumn(e,1).length(),o=1/Xe.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[3]=0,i[4]=n[4]*a,i[5]=n[5]*a,i[6]=n[6]*a,i[7]=0,i[8]=n[8]*o,i[9]=n[9]*o,i[10]=n[10]*o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),c=Math.sin(n),h=Math.cos(r),l=Math.sin(r);if("XYZ"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=u-f*c,e[9]=-o*s,e[2]=f-u*c,e[6]=d+p*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*h,g=s*l,v=c*h,y=c*l;e[0]=m+y*o,e[4]=v*o-g,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-o,e[2]=g*o-v,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*h,g=s*l,v=c*h,y=c*l;e[0]=m-y*o,e[4]=-a*l,e[8]=v+g*o,e[1]=g+v*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=d*c-p,e[8]=u*c+f,e[1]=s*l,e[5]=f*c+u,e[9]=p*c-d,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*h,e[4]=w-x*l,e[8]=_*l+b,e[1]=l,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=b*l+_,e[10]=x-w*l}else if("XZY"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*h,e[4]=-l,e[8]=c*h,e[1]=x*l+w,e[5]=a*h,e[9]=b*l-_,e[2]=_*l-b,e[6]=o*h,e[10]=w*l+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:(je=new ci(0,0,0),We=new ci(1,1,1),function t(e){return this.compose(je,e,We)}),lookAt:(He=new ci,Ve=new ci,ke=new ci,function t(e,i,n){var r=this.elements;return ke.subVectors(e,i),0===ke.lengthSq()&&(ke.z=1),ke.normalize(),He.crossVectors(n,ke),0===He.lengthSq()&&(1===Math.abs(n.z)?ke.x+=1e-4:ke.z+=1e-4,ke.normalize(),He.crossVectors(n,ke)),He.normalize(),Ve.crossVectors(ke,He),r[0]=He.x,r[4]=Ve.x,r[8]=ke.x,r[1]=He.y,r[5]=Ve.y,r[9]=ke.y,r[2]=He.z,r[6]=Ve.z,r[10]=ke.z,this}),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],_=n[0],w=n[4],M=n[8],E=n[12],T=n[1],S=n[5],A=n[9],L=n[13],R=n[2],C=n[6],P=n[10],O=n[14],I=n[3],N=n[7],D=n[11],U=n[15];return r[0]=a*_+o*T+s*R+c*I,r[4]=a*w+o*S+s*C+c*N,r[8]=a*M+o*A+s*P+c*D,r[12]=a*E+o*L+s*O+c*U,r[1]=h*_+l*T+u*R+p*I,r[5]=h*w+l*S+u*C+p*N,r[9]=h*M+l*A+u*P+p*D,r[13]=h*E+l*L+u*O+p*U,r[2]=d*_+f*T+m*R+g*I,r[6]=d*w+f*S+m*C+g*N,r[10]=d*M+f*A+m*P+g*D,r[14]=d*E+f*L+m*O+g*U,r[3]=v*_+y*T+x*R+b*I,r[7]=v*w+y*S+x*C+b*N,r[11]=v*M+y*A+x*P+b*D,r[15]=v*E+y*L+x*O+b*U,this},multiplyScalar:function(t){var 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},applyToBufferAttribute:(Ge=new ci,function t(e){for(var i=0,n=e.count;i<n;i++)Ge.x=e.getX(i),Ge.y=e.getY(i),Ge.z=e.getZ(i),Ge.applyMatrix4(this),e.setXYZ(i,Ge.x,Ge.y,Ge.z);return e}),determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],p=t[14],d,f,m,g;return t[3]*(+r*s*l-n*c*l-r*o*u+i*c*u+n*o*p-i*s*p)+t[7]*(+e*s*p-e*c*u+r*a*u-n*a*p+n*c*h-r*s*h)+t[11]*(+e*c*l-e*o*p-r*a*l+i*a*p+r*o*h-i*c*h)+t[15]*(-n*o*h-e*s*l+e*o*u+n*a*l-i*a*u+i*s*h)},transpose:function(){var t=this.elements,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:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],g=n[12],v=n[13],y=n[14],x=n[15],b=d*y*u-v*f*u+v*l*m-h*y*m-d*l*x+h*f*x,_=g*f*u-p*y*u-g*l*m+c*y*m+p*l*x-c*f*x,w=p*v*u-g*d*u+g*h*m-c*v*m-p*h*x+c*d*x,M=g*d*l-p*v*l-g*h*f+c*v*f+p*h*y-c*d*y,E=r*b+a*_+o*w+s*M;if(0===E){var T;if(!0===e)throw new Error("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var S=1/E;return i[0]=b*S,i[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*S,i[2]=(h*y*s-v*l*s+v*o*u-a*y*u-h*o*x+a*l*x)*S,i[3]=(d*l*s-h*f*s-d*o*u+a*f*u+h*o*m-a*l*m)*S,i[4]=_*S,i[5]=(p*y*s-g*f*s+g*o*m-r*y*m-p*o*x+r*f*x)*S,i[6]=(g*l*s-c*y*s-g*o*u+r*y*u+c*o*x-r*l*x)*S,i[7]=(c*f*s-p*l*s+p*o*u-r*f*u-c*o*m+r*l*m)*S,i[8]=w*S,i[9]=(g*d*s-p*v*s-g*a*m+r*v*m+p*a*x-r*d*x)*S,i[10]=(c*v*s-g*h*s+g*a*u-r*v*u-c*a*x+r*h*x)*S,i[11]=(p*h*s-c*d*s-p*a*u+r*d*u+c*a*m-r*h*m)*S,i[12]=M*S,i[13]=(p*v*o-g*d*o+g*a*f-r*v*f-p*a*y+r*d*y)*S,i[14]=(g*h*o-c*v*o-g*a*l+r*v*l+c*a*y-r*h*y)*S,i[15]=(c*d*o-p*h*o+p*a*l-r*d*l-c*a*f+r*h*f)*S,this},scale:function(t){var 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:function(){var 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:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var 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:function(t){var 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:function(t){var 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:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,c=r*a,h=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+i,h*s-n*a,0,c*s-n*o,h*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){var n=this.elements,r=e._x,a=e._y,o=e._z,s=e._w,c=r+r,h=a+a,l=o+o,u=r*c,p=r*h,d=r*l,f=a*h,m=a*l,g=o*l,v=s*c,y=s*h,x=s*l,b=i.x,_=i.y,w=i.z;return n[0]=(1-(f+g))*b,n[1]=(p+x)*b,n[2]=(d-y)*b,n[3]=0,n[4]=(p-x)*_,n[5]=(1-(u+g))*_,n[6]=(m+v)*_,n[7]=0,n[8]=(d+y)*w,n[9]=(m-v)*w,n[10]=(1-(u+f))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},decompose:(Fe=new ci,ze=new oi,function t(e,i,n){var r=this.elements,a=Fe.set(r[0],r[1],r[2]).length(),o=Fe.set(r[4],r[5],r[6]).length(),s=Fe.set(r[8],r[9],r[10]).length(),c;this.determinant()<0&&(a=-a),e.x=r[12],e.y=r[13],e.z=r[14],ze.copy(this);var h=1/a,l=1/o,u=1/s;return ze.elements[0]*=h,ze.elements[1]*=h,ze.elements[2]*=h,ze.elements[4]*=l,ze.elements[5]*=l,ze.elements[6]*=l,ze.elements[8]*=u,ze.elements[9]*=u,ze.elements[10]*=u,i.setFromRotationMatrix(ze),n.x=a,n.y=o,n.z=s,this}),makePerspective:function(t,e,i,n,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(e-t),c=2*r/(i-n),h=(e+t)/(e-t),l=(i+n)/(i-n),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,i,n,r,a){var o=this.elements,s=1/(e-t),c=1/(i-n),h=1/(a-r),l=(e+t)*s,u=(i+n)*c,p=(a+r)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var 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}}),Object.assign(si,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,a,o){var s=i[n+0],c=i[n+1],h=i[n+2],l=i[n+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,g=s*u+c*p+h*d+l*f,v=0<=g?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var _=o*v;if(s=s*m+u*_,c=c*m+p*_,h=h*m+d*_,l=l*m+f*_,m===1-o){var w=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=w,c*=w,h*=w,l*=w}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),Object.defineProperties(si.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(si.prototype,{set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(i/2),h=o(n/2),l=o(r/2),u=s(i/2),p=s(n/2),d=s(r/2);return"XYZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"YXZ"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"ZXY"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"ZYX"===a?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"YZX"===a?(this._x=u*h*l+c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l-u*p*d):"XZY"===a&&(this._x=u*h*l-c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l+u*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var 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:function(t){var e=t.elements,i=e[0],n=e[4],r=e[8],a=e[1],o=e[5],s=e[9],c=e[2],h=e[6],l=e[10],u=i+o+l,p;return 0<u?(p=.5/Math.sqrt(u+1),this._w=.25/p,this._x=(h-s)*p,this._y=(r-c)*p,this._z=(a-n)*p):o<i&&l<i?(p=2*Math.sqrt(1+i-o-l),this._w=(h-s)/p,this._x=.25*p,this._y=(n+a)/p,this._z=(r+c)/p):l<o?(p=2*Math.sqrt(1+o-i-l),this._w=(r-c)/p,this._x=(n+a)/p,this._y=.25*p,this._z=(s+h)/p):(p=2*Math.sqrt(1+l-i-o),this._w=(a-n)/p,this._x=(r+c)/p,this._y=(s+h)/p,this._z=.25*p),this.onChangeCallback(),this},setFromUnitVectors:(qe=new ci,Je=1e-6,function t(e,i){return void 0===qe&&(qe=new ci),(Ye=e.dot(i)+1)<Je?(Ye=0,Math.abs(e.x)>Math.abs(e.z)?qe.set(-e.y,e.x,0):qe.set(0,-e.z,e.y)):qe.crossVectors(e,i),this._x=qe.x,this._y=qe.y,this._z=qe.z,this._w=Ye,this.normalize()}),angleTo:function(t){return 2*Math.acos(Math.abs(De.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var n=Math.min(1,e/i);return this.slerp(t,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var 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:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+n*c-r*s,this._y=n*h+a*s+r*o-i*c,this._z=r*h+a*c+i*s-n*o,this._w=a*h-i*o-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),1<=o)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-e;return this._w=c*a+e*this._w,this._x=c*i+e*this._x,this._y=c*n+e*this._y,this._z=c*r+e*this._z,this.normalize()}var h=Math.sqrt(s),l=Math.atan2(h,o),u=Math.sin((1-e)*l)/h,p=Math.sin(e*l)/h;return this._w=a*u+this._w*p,this._x=i*u+this._x*p,this._y=n*u+this._y*p,this._z=r*u+this._z*p,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(ci.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(ni=new si,function t(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(ni.setFromEuler(e))}),applyAxisAngle:(ii=new si,function t(e,i){return this.applyQuaternion(ii.setFromAxisAngle(e,i))}),applyMatrix3:function(t){var 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},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,a=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])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*i,h=s*i+o*e-r*n,l=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=c*s+u*-r+h*-o-l*-a,this.y=h*s+u*-a+l*-r-c*-o,this.z=l*s+u*-o+c*-a-h*-r,this},project:(ei=new oi,function t(e){return ei.multiplyMatrices(e.projectionMatrix,ei.getInverse(e.matrixWorld)),this.applyMatrix4(ei)}),unproject:(ti=new oi,function t(e){return ti.multiplyMatrices(e.matrixWorld,ti.getInverse(e.projectionMatrix)),this.applyMatrix4(ti)}),transformDirection:function(t){var 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:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(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:function(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:function(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:(Ke=new ci,$e=new ci,function t(e,i){return Ke.set(e,e,e),$e.set(i,i,i),this.clamp(Ke,$e)}),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){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:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(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:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(Qe=new ci,function t(e){return Qe.copy(this).projectOnVector(e),this.sub(Qe)}),reflect:(Ze=new ci,function t(e){return this.sub(Ze.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(De.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var 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:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(hi.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=o,h[3]=e,h[4]=r,h[5]=s,h[6]=i,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var 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},setFromMatrix4:function(t){var 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},applyToBufferAttribute:(ri=new ci,function t(e){for(var i=0,n=e.count;i<n;i++)ri.x=e.getX(i),ri.y=e.getY(i),ri.z=e.getZ(i),ri.applyMatrix3(this),e.setXYZ(i,ri.x,ri.y,ri.z);return e}),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],c=i[1],h=i[4],l=i[7],u=i[2],p=i[5],d=i[8],f=n[0],m=n[3],g=n[6],v=n[1],y=n[4],x=n[7],b=n[2],_=n[5],w=n[8];return r[0]=a*f+o*v+s*b,r[3]=a*m+o*y+s*_,r[6]=a*g+o*x+s*w,r[1]=c*f+h*v+l*b,r[4]=c*m+h*y+l*_,r[7]=c*g+h*x+l*w,r[2]=u*f+p*v+d*b,r[5]=u*m+p*y+d*_,r[8]=u*g+p*x+d*w,this},multiplyScalar:function(t){var 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:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-i*r*h+i*o*s+n*r*c-n*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var i=t.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=p*c-h*u,f=h*l-p*s,m=u*s-c*l,g=r*d+a*f+o*m;if(0===g){var v;if(!0===e)throw new Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var y=1/g;return n[0]=d*y,n[1]=(o*u-p*a)*y,n[2]=(h*a-o*c)*y,n[3]=f*y,n[4]=(p*r-o*l)*y,n[5]=(o*s-h*r)*y,n[6]=m*y,n[7]=(a*l-u*r)*y,n[8]=(c*r-a*s)*y,this},transpose:function(){var t,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:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var 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:function(t,e,i,n,r,a,o){var s=Math.cos(r),c=Math.sin(r);this.set(i*s,i*c,-i*(s*a+c*o)+a+t,-n*c,n*s,-n*(-c*a+s*o)+o+e,0,0,1)},scale:function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],a=n[3],o=n[6],s=n[1],c=n[4],h=n[7];return n[0]=e*r+i*s,n[3]=e*a+i*c,n[6]=e*o+i*h,n[1]=-i*r+e*s,n[4]=-i*a+e*c,n[7]=-i*o+e*h,this},translate:function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var 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}});var li={getDataURL:function(t){var e;if(t instanceof HTMLCanvasElement)e=t;else{"undefined"!=typeof OffscreenCanvas?e=new OffscreenCanvas(t.width,t.height):((e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=t.width,e.height=t.height);var i=e.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height)}return 2048<e.width||2048<e.height?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},ui=0,pi,di,fi,mi,gi,vi,yi,xi,bi,_i,wi,Mi,Ei,Ti,Si;function Ai(t,e,i,n,r,a,o,s,c,h){Object.defineProperty(this,"id",{value:ui++}),this.uuid=De.generateUUID(),this.name="",this.image=void 0!==t?t:Ai.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Ai.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:q,this.wrapT=void 0!==n?n:q,this.magFilter=void 0!==r?r:K,this.minFilter=void 0!==a?a:tt,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Xt,this.type=void 0!==s?s:kt,this.offset=new ai(0,0),this.repeat=new ai(1,1),this.center=new ai(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new hi,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:Me,this.version=0,this.onUpdate=null}function Li(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function Ri(t,e,i){this.width=t,this.height=e,this.scissor=new Li(0,0,t,e),this.scissorTest=!1,this.viewport=new Li(0,0,t,e),void 0===(i=i||{}).minFilter&&(i.minFilter=K),this.texture=new Ai(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.generateMipmaps=void 0===i.generateMipmaps||i.generateMipmaps,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}function Ci(t,e,i){Ri.call(this,t,e,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function Pi(t,e,i,n,r,a,o,s,c,h,l,u){Ai.call(this,null,a,o,s,c,h,n,r,l,u),this.image={data:t,width:e,height:i},this.magFilter=void 0!==c?c:J,this.minFilter=void 0!==h?h:J,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function Oi(t,e){this.min=void 0!==t?t:new ci(1/0,1/0,1/0),this.max=void 0!==e?e:new ci(-1/0,-1/0,-1/0)}function Ii(t,e){this.center=void 0!==t?t:new ci,this.radius=void 0!==e?e:0}function Ni(t,e){this.normal=void 0!==t?t:new ci(1,0,0),this.constant=void 0!==e?e:0}function Di(t,e,i,n,r,a){this.planes=[void 0!==t?t:new Ni,void 0!==e?e:new Ni,void 0!==i?i:new Ni,void 0!==n?n:new Ni,void 0!==r?r:new Ni,void 0!==a?a:new Ni]}Ai.DEFAULT_IMAGE=void 0,Ai.DEFAULT_MAPPING=O,Ai.prototype=Object.assign(Object.create(e.prototype),{constructor:Ai,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,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.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},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=De.generateUUID()),!e&&void 0===t.images[n.uuid]){var r;if(Array.isArray(n)){r=[];for(var a=0,o=n.length;a<o;a++)r.push(li.getDataURL(n[a]))}else r=li.getDataURL(n);t.images[n.uuid]={uuid:n.uuid,url:r}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===O){if(t.applyMatrix3(this.matrix),t.x<0||1<t.x)switch(this.wrapS){case I:t.x=t.x-Math.floor(t.x);break;case q:t.x=t.x<0?0:1;break;case Y: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||1<t.y)switch(this.wrapT){case I:t.y=t.y-Math.floor(t.y);break;case q:t.y=t.y<0?0:1;break;case Y:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.defineProperty(Ai.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Li.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(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:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(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:function(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:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(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},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var 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:function(t){var e,i,n,r,a=.01,o=.1,s=t.elements,c=s[0],h=s[4],l=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(h-u)<a&&Math.abs(l-f)<a&&Math.abs(d-m)<a){if(Math.abs(h+u)<.1&&Math.abs(l+f)<.1&&Math.abs(d+m)<.1&&Math.abs(c+p+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var v=(c+1)/2,y=(p+1)/2,x=(g+1)/2,b=(h+u)/4,_=(l+f)/4,w=(d+m)/4;return y<v&&x<v?r=v<a?(i=0,n=.707106781):(n=b/(i=Math.sqrt(v)),_/i):x<y?r=y<a?(n=0,i=.707106781):(i=b/(n=Math.sqrt(y)),w/n):x<a?(n=i=.707106781,r=0):(i=_/(r=Math.sqrt(x)),n=w/r),this.set(i,n,r,e),this}var M=Math.sqrt((m-d)*(m-d)+(l-f)*(l-f)+(u-h)*(u-h));return Math.abs(M)<.001&&(M=1),this.x=(m-d)/M,this.y=(l-f)/M,this.z=(u-h)/M,this.w=Math.acos((c+p+g-1)/2),this},min:function(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:function(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:function(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:function t(e,i){return void 0===pi&&(pi=new Li,di=new Li),pi.set(e,e,e,e),di.set(i,i,i,i),this.clamp(pi,di)},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){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:function(){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:function(){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:function(){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:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(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:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Ri.prototype=Object.assign(Object.create(e.prototype),{constructor:Ri,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((Ci.prototype=Object.create(Ri.prototype)).constructor=Ci).prototype.isWebGLRenderTargetCube=!0,((Pi.prototype=Object.create(Ai.prototype)).constructor=Pi).prototype.isDataTexture=!0,Object.assign(Oi.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),r<h&&(r=h),a<l&&(a=l),o<u&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var h=t.getX(s),l=t.getY(s),u=t.getZ(s);h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),r<h&&(r=h),a<l&&(a=l),o<u&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:(vi=new ci,function t(e,i){var n=vi.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){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:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(t=new ci),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(t=new ci),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var r,a,o,s=new ci;function i(t){var e=t.geometry;if(void 0!==e)if(e.isGeometry){var i=e.vertices;for(a=0,o=i.length;a<o;a++)s.copy(i[a]),s.applyMatrix4(t.matrixWorld),r.expandByPoint(s)}else if(e.isBufferGeometry){var n=e.attributes.position;if(void 0!==n)for(a=0,o=n.count;a<o;a++)s.fromBufferAttribute(n,a).applyMatrix4(t.matrixWorld),r.expandByPoint(s)}}return function t(e){return r=this,e.updateMatrixWorld(!0),e.traverse(i),this}}(),containsPoint:function(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:function(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:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new ci),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:function(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:(gi=new ci,function t(e){return this.clampPoint(e.center,gi),gi.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(t){var e,i;return i=0<t.normal.x?(e=t.normal.x*this.min.x,t.normal.x*this.max.x):(e=t.normal.x*this.max.x,t.normal.x*this.min.x),0<t.normal.y?(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),0<t.normal.z?(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:function(){var s=new ci,c=new ci,h=new ci,n=new ci,r=new ci,a=new ci,l=new ci,o=new ci,u=new ci,p=new ci;function d(t){var e,i;for(e=0,i=t.length-3;e<=i;e+=3){l.fromArray(t,e);var n=u.x*Math.abs(l.x)+u.y*Math.abs(l.y)+u.z*Math.abs(l.z),r=s.dot(l),a=c.dot(l),o=h.dot(l);if(Math.max(-Math.max(r,a,o),Math.min(r,a,o))>n)return!1}return!0}return function t(e){if(this.isEmpty())return!1;this.getCenter(o),u.subVectors(this.max,o),s.subVectors(e.a,o),c.subVectors(e.b,o),h.subVectors(e.c,o),n.subVectors(c,s),r.subVectors(h,c),a.subVectors(s,h);var i=[0,-n.z,n.y,0,-r.z,r.y,0,-a.z,a.y,n.z,0,-n.x,r.z,0,-r.x,a.z,0,-a.x,-n.y,n.x,0,-r.y,r.x,0,-a.y,a.x,0];return!!d(i)&&(!!d(i=[1,0,0,0,1,0,0,0,1])&&(p.crossVectors(n,r),d(i=[p.x,p.y,p.z])))}}(),clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new ci),e.copy(t).clamp(this.min,this.max)},distanceToPoint:(mi=new ci,function t(e){var i;return mi.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(fi=new ci,function t(e){return void 0===e&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),e=new Ii),this.getCenter(e.center),e.radius=.5*this.getSize(fi).length(),e}),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){if(this.isEmpty())return this;var e=t.elements,i=e[0]*this.min.x,n=e[1]*this.min.x,r=e[2]*this.min.x,a=e[0]*this.max.x,o=e[1]*this.max.x,s=e[2]*this.max.x,c=e[4]*this.min.y,h=e[5]*this.min.y,l=e[6]*this.min.y,u=e[4]*this.max.y,p=e[5]*this.max.y,d=e[6]*this.max.y,f=e[8]*this.min.z,m=e[9]*this.min.z,g=e[10]*this.min.z,v=e[8]*this.max.z,y=e[9]*this.max.z,x=e[10]*this.max.z;return this.min.x=Math.min(i,a)+Math.min(c,u)+Math.min(f,v)+e[12],this.min.y=Math.min(n,o)+Math.min(h,p)+Math.min(m,y)+e[13],this.min.z=Math.min(r,s)+Math.min(l,d)+Math.min(g,x)+e[14],this.max.x=Math.max(i,a)+Math.max(c,u)+Math.max(f,v)+e[12],this.max.y=Math.max(n,o)+Math.max(h,p)+Math.max(m,y)+e[13],this.max.z=Math.max(r,s)+Math.max(l,d)+Math.max(g,x)+e[14],this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Ii.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(yi=new Oi,function t(e,i){var n=this.center;void 0!==i?n.copy(i):yi.setFromPoints(e).getCenter(n);for(var r=0,a=0,o=e.length;a<o;a++)r=Math.max(r,n.distanceToSquared(e[a]));return this.radius=Math.sqrt(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new ci),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Oi),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(Ni.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:(wi=new ci,Mi=new ci,function t(e,i,n){var r=wi.subVectors(n,i).cross(Mi.subVectors(e,i)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new ci),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:(_i=new ci,function t(e,i){void 0===i&&(console.warn("THREE.Plane: .intersectLine() target is now required"),i=new ci);var n=e.delta(_i),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?i.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/r;return a<0||1<a?void 0:i.copy(n).multiplyScalar(a).add(e.start)}),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&0<i||i<0&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new ci),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(xi=new ci,bi=new hi,function t(e,i){var n=i||bi.getNormalMatrix(e),r=this.coplanarPoint(xi).applyMatrix4(e),a=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(a),this}),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(Di.prototype,{set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(o-n,l-s,f-u,y-m).normalize(),e[1].setComponents(o+n,l+s,f+u,y+m).normalize(),e[2].setComponents(o+r,l+c,f+p,y+g).normalize(),e[3].setComponents(o-r,l-c,f-p,y-g).normalize(),e[4].setComponents(o-a,l-h,f-d,y-v).normalize(),e[5].setComponents(o+a,l+h,f+d,y+v).normalize(),this},intersectsObject:(Si=new Ii,function t(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),Si.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Si)}),intersectsSprite:(Ti=new Ii,function t(e){return Ti.center.set(0,0,0),Ti.radius=.7071067811865476,Ti.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ti)}),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){var a;if(e[r].distanceToPoint(i)<n)return!1}return!0},intersectsBox:(Ei=new ci,function t(e){for(var i=this.planes,n=0;n<6;n++){var r=i[n];if(Ei.x=0<r.normal.x?e.max.x:e.min.x,Ei.y=0<r.normal.y?e.max.y:e.min.y,Ei.z=0<r.normal.z?e.max.z:e.min.z,r.distanceToPoint(Ei)<0)return!1}return!0}),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}});var Ui,Bi,Fi,zi,Gi,Hi,Vi,ki,ji,Wi,Xi,qi,Yi,Ji,Zi,Qi,Ki,$i,tn,en,nn,rn,an,on,sn,cn,hn,ln,un,pn,dn,fn,mn,gn,vn,yn,xn,bn,_n,wn,Mn,En,Tn,Sn,An,Ln,Rn,Cn,Pn,On,In,Nn,Dn,Un,Bn,Fn,zn,Gn,Hn,Vn,kn,jn,Wn,Xn,qn,Yn,Jn,Zn,Qn,Kn,$n,tr,er,ir,nr,rr,ar,or,sr,cr,hr,lr,ur,pr,dr,fr,mr,gr,vr,yr,xr,br,_r,wr,Mr,Er,Tr,Sr,Ar,Lr,Rr,Cr,Pr,Or,Ir,Nr,Dr,Ur,Br,Fr,zr,Gr,Hr,Vr,kr,jr={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_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}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * 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}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.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 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float 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 average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\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}\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};\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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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 linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\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.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\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\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, 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_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\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.specularRoughness;\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#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n",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, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif\n",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}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\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 )\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\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",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\n",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#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\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>\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}\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 <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}\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}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\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 <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 <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_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 <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\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 <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_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 <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_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 <uv2_vertex>\n\t#include <color_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 <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 <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\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 <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_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 <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_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 <uv2_vertex>\n\t#include <color_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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\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}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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>\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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\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>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\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}\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 <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}\n",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\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\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\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\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\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\tvec4 mvPosition;\n\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\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}\n"},Wr={merge:function(t){for(var e={},i=0;i<t.length;i++){var n=this.clone(t[i]);for(var r in n)e[r]=n[r]}return e},clone:function(t){var e={};for(var i in t)for(var n in e[i]={},t[i]){var r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}return e}},Xr={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},qr;function Yr(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}Object.assign(Yr.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function o(t,e,i){return i<0&&(i+=1),1<i&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function t(e,i,n){if(e=De.euclideanModulo(e,1),i=De.clamp(i,0,1),n=De.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,a=2*n-r;this.r=o(a,r,e+1/3),this.g=o(a,r,e),this.b=o(a,r,e-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var i,n;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))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,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))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,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,h=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(s,c,h)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var n,l=(n=i[1]).length;if(3===l)return this.r=parseInt(n.charAt(0)+n.charAt(0),16)/255,this.g=parseInt(n.charAt(1)+n.charAt(1),16)/255,this.b=parseInt(n.charAt(2)+n.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(n.charAt(0)+n.charAt(1),16)/255,this.g=parseInt(n.charAt(2)+n.charAt(3),16)/255,this.b=parseInt(n.charAt(4)+n.charAt(5),16)/255,this}e&&0<e.length&&(void 0!==(n=Xr[e])?this.setHex(n):console.warn("THREE.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=0<e?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(){function i(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}return function t(e){return this.r=i(e.r),this.g=i(e.g),this.b=i(e.b),this}}(),copyLinearToSRGB:function(){function i(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}return function t(e){return this.r=i(e.r),this.g=i(e.g),this.b=i(e.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),a=Math.min(e,i,n),o,s,c=(a+r)/2;if(a===r)s=o=0;else{var h=r-a;switch(s=c<=.5?h/(r+a):h/(2-r-a),r){case e:o=(i-n)/h+(i<n?6:0);break;case i:o=(n-e)/h+2;break;case n:o=(e-i)/h+4}o/=6}return t.h=o,t.s=s,t.l=c,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(qr={},function(t,e,i){return this.getHSL(qr),qr.h+=t,qr.s+=e,qr.l+=i,this.setHSL(qr.h,qr.s,qr.l),this}),add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(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:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(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},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Jr={common:{diffuse:{value:new Yr(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new hi},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ai(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Yr(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Yr(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new hi}},sprite:{diffuse:{value:new Yr(15658734)},opacity:{value:1},center:{value:new ai(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new hi}}},Zr={basic:{uniforms:Wr.merge([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.fog]),vertexShader:jr.meshbasic_vert,fragmentShader:jr.meshbasic_frag},lambert:{uniforms:Wr.merge([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.fog,Jr.lights,{emissive:{value:new Yr(0)}}]),vertexShader:jr.meshlambert_vert,fragmentShader:jr.meshlambert_frag},phong:{uniforms:Wr.merge([Jr.common,Jr.specularmap,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.gradientmap,Jr.fog,Jr.lights,{emissive:{value:new Yr(0)},specular:{value:new Yr(1118481)},shininess:{value:30}}]),vertexShader:jr.meshphong_vert,fragmentShader:jr.meshphong_frag},standard:{uniforms:Wr.merge([Jr.common,Jr.envmap,Jr.aomap,Jr.lightmap,Jr.emissivemap,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,Jr.roughnessmap,Jr.metalnessmap,Jr.fog,Jr.lights,{emissive:{value:new Yr(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:jr.meshphysical_vert,fragmentShader:jr.meshphysical_frag},points:{uniforms:Wr.merge([Jr.points,Jr.fog]),vertexShader:jr.points_vert,fragmentShader:jr.points_frag},dashed:{uniforms:Wr.merge([Jr.common,Jr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:jr.linedashed_vert,fragmentShader:jr.linedashed_frag},depth:{uniforms:Wr.merge([Jr.common,Jr.displacementmap]),vertexShader:jr.depth_vert,fragmentShader:jr.depth_frag},normal:{uniforms:Wr.merge([Jr.common,Jr.bumpmap,Jr.normalmap,Jr.displacementmap,{opacity:{value:1}}]),vertexShader:jr.normal_vert,fragmentShader:jr.normal_frag},sprite:{uniforms:Wr.merge([Jr.sprite,Jr.fog]),vertexShader:jr.sprite_vert,fragmentShader:jr.sprite_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:jr.cube_vert,fragmentShader:jr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:jr.equirect_vert,fragmentShader:jr.equirect_frag},distanceRGBA:{uniforms:Wr.merge([Jr.common,Jr.displacementmap,{referencePosition:{value:new ci},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:jr.distanceRGBA_vert,fragmentShader:jr.distanceRGBA_frag},shadow:{uniforms:Wr.merge([Jr.lights,Jr.fog,{color:{value:new Yr(0)},opacity:{value:1}}]),vertexShader:jr.shadow_vert,fragmentShader:jr.shadow_frag}},Qr,Kr;function $r(){var i=null,n=!1,r=null;function a(t,e){!1!==n&&(r(t,e),i.requestAnimationFrame(a))}return{start:function(){!0!==n&&null!==r&&(i.requestAnimationFrame(a),n=!0)},stop:function(){n=!1},setAnimationLoop:function(t){r=t},setContext:function(t){i=t}}}function ta(o){var n=new WeakMap;function r(t,e){var i=t.array,n=t.dynamic?o.DYNAMIC_DRAW:o.STATIC_DRAW,r=o.createBuffer();o.bindBuffer(e,r),o.bufferData(e,i,n),t.onUploadCallback();var a=o.FLOAT;return i instanceof Float32Array?a=o.FLOAT:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?a=o.UNSIGNED_SHORT:i instanceof Int16Array?a=o.SHORT:i instanceof Uint32Array?a=o.UNSIGNED_INT:i instanceof Int32Array?a=o.INT:i instanceof Int8Array?a=o.BYTE:i instanceof Uint8Array&&(a=o.UNSIGNED_BYTE),{buffer:r,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}function a(t,e,i){var n=e.array,r=e.updateRange;o.bindBuffer(i,t),!1===e.dynamic?o.bufferData(i,n,o.STATIC_DRAW):-1===r.count?o.bufferSubData(i,0,n):0===r.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(o.bufferSubData(i,r.offset*n.BYTES_PER_ELEMENT,n.subarray(r.offset,r.offset+r.count)),r.count=-1)}function t(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)}function e(t){t.isInterleavedBufferAttribute&&(t=t.data);var e=n.get(t);e&&(o.deleteBuffer(e.buffer),n.delete(t))}function i(t,e){t.isInterleavedBufferAttribute&&(t=t.data);var i=n.get(t);void 0===i?n.set(t,r(t,e)):i.version<t.version&&(a(i.buffer,t,e),i.version=t.version)}return{get:t,remove:e,update:i}}function ea(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||ea.DefaultOrder}function ia(){this.mask=1}Zr.physical={uniforms:Wr.merge([Zr.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:jr.meshphysical_vert,fragmentShader:jr.meshphysical_frag},ea.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ea.DefaultOrder="XYZ",Object.defineProperties(ea.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ea.prototype,{isEuler:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=De.clamp,r=t.elements,a=r[0],o=r[4],s=r[8],c=r[1],h=r[5],l=r[9],u=r[2],p=r[6],d=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:(Kr=new oi,function t(e,i,n){return Kr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Kr,i,n)}),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(Qr=new si,function t(e){return Qr.setFromEuler(this),this.setFromQuaternion(Qr,e)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(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:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new ci(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(ia.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var na=0,ra,aa,oa,sa,ca,ha,la,ua,pa,da,fa,ma,ga,va,ya,xa,ba,_a;function wa(){Object.defineProperty(this,"id",{value:na++}),this.uuid=De.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wa.DefaultUp.clone();var t=new ci,e=new ea,i=new si,n=new ci(1,1,1);function r(){i.setFromEuler(e,!1)}function a(){e.setFromQuaternion(i,void 0,!1)}e.onChange(r),i.onChange(a),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:n},modelViewMatrix:{value:new oi},normalMatrix:{value:new hi}}),this.matrix=new oi,this.matrixWorld=new oi,this.matrixAutoUpdate=wa.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ia,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function Ma(){wa.call(this),this.type="Camera",this.matrixWorldInverse=new oi,this.projectionMatrix=new oi}function Ea(t,e,i,n,r,a){Ma.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Ta(t,e,i,n,r,a){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new ci,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new Yr,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}wa.DefaultUp=new ci(0,1,0),wa.DefaultMatrixAutoUpdate=!0,wa.prototype=Object.assign(Object.create(e.prototype),{constructor:wa,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:(ba=new si,function t(e,i){return ba.setFromAxisAngle(e,i),this.quaternion.multiply(ba),this}),rotateOnWorldAxis:(xa=new si,function t(e,i){return xa.setFromAxisAngle(e,i),this.quaternion.premultiply(xa),this}),rotateX:(ya=new ci(1,0,0),function t(e){return this.rotateOnAxis(ya,e)}),rotateY:(va=new ci(0,1,0),function t(e){return this.rotateOnAxis(va,e)}),rotateZ:(ga=new ci(0,0,1),function t(e){return this.rotateOnAxis(ga,e)}),translateOnAxis:(ma=new ci,function t(e,i){return ma.copy(e).applyQuaternion(this.quaternion),this.position.add(ma.multiplyScalar(i)),this}),translateX:(fa=new ci(1,0,0),function t(e){return this.translateOnAxis(fa,e)}),translateY:(da=new ci(0,1,0),function t(e){return this.translateOnAxis(da,e)}),translateZ:(pa=new ci(0,0,1),function t(e){return this.translateOnAxis(pa,e)}),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:(ua=new oi,function t(e){return e.applyMatrix4(ua.getInverse(this.matrixWorld))}),lookAt:(ha=new oi,la=new ci,function t(e,i,n){e.isVector3?la.copy(e):la.set(e,i,n),this.isCamera?ha.lookAt(this.position,la,this.up):ha.lookAt(la,this.position,this.up),this.quaternion.setFromRotationMatrix(ha)}),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",t):t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this},remove:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var i=this.children.indexOf(t);return-1!==i&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(i,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r,a=this.children[i].getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){return void 0===t&&(t=new ci),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(sa=new ci,ca=new ci,function t(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new si),this.updateMatrixWorld(!0),this.matrixWorld.decompose(sa,e,ca),e}),getWorldScale:(aa=new ci,oa=new si,function t(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new ci),this.updateMatrixWorld(!0),this.matrixWorld.decompose(aa,oa,e),e}),getWorldDirection:(ra=new si,function t(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new ci),this.getWorldQuaternion(ra),e.set(0,0,1).applyQuaternion(ra)}),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},toJSON:function(i){var t=void 0===i||"string"==typeof i,e={};t&&(i={geometries:{},materials:{},textures:{},images:{},shapes:{}},e.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n={};function r(t,e){return void 0===t[e.uuid]&&(t[e.uuid]=e.toJSON(i)),e.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),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isMesh||this.isLine||this.isPoints){n.geometry=r(i.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var h=o[s];r(i.shapes,h)}else r(i.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){for(var l=[],s=0,c=this.material.length;s<c;s++)l.push(r(i.materials,this.material[s]));n.material=l}else n.material=r(i.materials,this.material);if(0<this.children.length){n.children=[];for(var s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(i).object)}if(t){var u=m(i.geometries),p=m(i.materials),d=m(i.textures),f=m(i.images),o=m(i.shapes);0<u.length&&(e.geometries=u),0<p.length&&(e.materials=p),0<d.length&&(e.textures=d),0<f.length&&(e.images=f),0<o.length&&(e.shapes=o)}return e.object=n,e;function m(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),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.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(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}}),Ma.prototype=Object.assign(Object.create(wa.prototype),{constructor:Ma,isCamera:!0,copy:function(t,e){return wa.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:(_a=new si,function t(e){return void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new ci),this.getWorldQuaternion(_a),e.set(0,0,-1).applyQuaternion(_a)}),updateMatrixWorld:function(t){wa.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Ea.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Ea,isOrthographicCamera:!0,copy:function(t,e){return Ma.prototype.copy.call(this,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:function(t,e,i,n,r,a){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=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var 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,r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view&&this.view.enabled){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;a=(r+=l*(this.view.offsetX/c))+l*(this.view.width/c),s=(o-=u*(this.view.offsetY/h))-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(t){var e=wa.prototype.toJSON.call(this,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}}),Object.assign(Ta.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var Sa=0,Aa,La,Ra,Ca,Pa,Oa,Ia;function Na(){Object.defineProperty(this,"id",{value:Sa+=2}),this.uuid=De.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Da(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Ua(t,e,i){Da.call(this,new Int8Array(t),e,i)}function Ba(t,e,i){Da.call(this,new Uint8Array(t),e,i)}function Fa(t,e,i){Da.call(this,new Uint8ClampedArray(t),e,i)}function za(t,e,i){Da.call(this,new Int16Array(t),e,i)}function Ga(t,e,i){Da.call(this,new Uint16Array(t),e,i)}function Ha(t,e,i){Da.call(this,new Int32Array(t),e,i)}function Va(t,e,i){Da.call(this,new Uint32Array(t),e,i)}function ka(t,e,i){Da.call(this,new Float32Array(t),e,i)}function ja(t,e,i){Da.call(this,new Float64Array(t),e,i)}function Wa(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Xa(t){if(0===t.length)return-1/0;for(var e=t[0],i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}Na.prototype=Object.assign(Object.create(e.prototype),{constructor:Na,isGeometry:!0,applyMatrix:function(t){for(var e=(new hi).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++){var r;this.vertices[i].applyMatrix4(t)}for(var i=0,n=this.faces.length;i<n;i++){var a=this.faces[i];a.normal.applyMatrix3(e).normalize();for(var o=0,s=a.vertexNormals.length;o<s;o++)a.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:(Ia=new oi,function t(e){return Ia.makeRotationX(e),this.applyMatrix(Ia),this}),rotateY:(Oa=new oi,function t(e){return Oa.makeRotationY(e),this.applyMatrix(Oa),this}),rotateZ:(Pa=new oi,function t(e){return Pa.makeRotationZ(e),this.applyMatrix(Pa),this}),translate:(Ca=new oi,function t(e,i,n){return Ca.makeTranslation(e,i,n),this.applyMatrix(Ca),this}),scale:(Ra=new oi,function t(e,i,n){return Ra.makeScale(e,i,n),this.applyMatrix(Ra),this}),lookAt:(La=new wa,function t(e){La.lookAt(e),La.updateMatrix(),this.applyMatrix(La.matrix)}),fromBufferGeometry:function(t){var s=this,e=null!==t.index?t.index.array:void 0,i=t.attributes,n=i.position.array,c=void 0!==i.normal?i.normal.array:void 0,h=void 0!==i.color?i.color.array:void 0,l=void 0!==i.uv?i.uv.array:void 0,u=void 0!==i.uv2?i.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var p=[],d=[],f=[],r=0,a=0;r<n.length;r+=3,a+=2)s.vertices.push(new ci(n[r],n[r+1],n[r+2])),void 0!==c&&p.push(new ci(c[r],c[r+1],c[r+2])),void 0!==h&&s.colors.push(new Yr(h[r],h[r+1],h[r+2])),void 0!==l&&d.push(new ai(l[a],l[a+1])),void 0!==u&&f.push(new ai(u[a],u[a+1]));function o(t,e,i,n){var r,a,o=new Ta(t,e,i,void 0!==c?[p[t].clone(),p[e].clone(),p[i].clone()]:[],void 0!==h?[s.colors[t].clone(),s.colors[e].clone(),s.colors[i].clone()]:[],n);s.faces.push(o),void 0!==l&&s.faceVertexUvs[0].push([d[t].clone(),d[e].clone(),d[i].clone()]),void 0!==u&&s.faceVertexUvs[1].push([f[t].clone(),f[e].clone(),f[i].clone()])}var m=t.groups;if(0<m.length)for(var r=0;r<m.length;r++)for(var g=m[r],v=g.start,y,a=v,x=v+g.count;a<x;a+=3)void 0!==e?o(e[a],e[a+1],e[a+2],g.materialIndex):o(a,a+1,a+2,g.materialIndex);else if(void 0!==e)for(var r=0;r<e.length;r+=3)o(e[r],e[r+1],e[r+2]);else for(var r=0;r<n.length/3;r+=3)o(r,r+1,r+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:(Aa=new ci,function t(){return this.computeBoundingBox(),this.boundingBox.getCenter(Aa).negate(),this.translate(Aa.x,Aa.y,Aa.z),this}),normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new oi;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new ci,e=new ci,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var e,i,n,r,a,o;for(void 0===t&&(t=!0),o=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)o[e]=new ci;if(t){var s,c,h,l=new ci,u=new ci;for(n=0,r=this.faces.length;n<r;n++)a=this.faces[n],s=this.vertices[a.a],c=this.vertices[a.b],h=this.vertices[a.c],l.subVectors(h,c),u.subVectors(s,c),l.cross(u),o[a.a].add(l),o[a.b].add(l),o[a.c].add(l)}else for(this.computeFaceNormals(),n=0,r=this.faces.length;n<r;n++)o[(a=this.faces[n]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,i=this.vertices.length;e<i;e++)o[e].normalize();for(n=0,r=this.faces.length;n<r;n++){var p=(a=this.faces[n]).vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(i=this.faces[t]).vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for((r=this.faces[i]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var a=new Na;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals,c,h;for(i=0,n=this.faces.length;i<n;i++)c=new ci,h={a:new ci,b:new ci,c:new ci},o.push(c),s.push(h)}var l=this.morphNormals[t],c,h;for(a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),i=0,n=this.faces.length;i<n;i++)r=this.faces[i],c=l.faceNormals[i],h=l.vertexNormals[i],c.copy(r.normal),h.a.copy(r.vertexNormals[0]),h.b.copy(r.vertexNormals[1]),h.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)(r=this.faces[i]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Oi),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ii),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if(t&&t.isGeometry){var n,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],l=t.faceVertexUvs[0],u=this.colors,p=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new hi).getNormalMatrix(e));for(var d=0,f=o.length;d<f;d++){var m,g=o[d].clone();void 0!==e&&g.applyMatrix4(e),a.push(g)}for(var d=0,f=p.length;d<f;d++)u.push(p[d].clone());for(d=0,f=c.length;d<f;d++){var v=c[d],y,x,b,_=v.vertexNormals,w=v.vertexColors;(y=new Ta(v.a+r,v.b+r,v.c+r)).normal.copy(v.normal),void 0!==n&&y.normal.applyMatrix3(n).normalize();for(var M=0,E=_.length;M<E;M++)x=_[M].clone(),void 0!==n&&x.applyMatrix3(n).normalize(),y.vertexNormals.push(x);y.color.copy(v.color);for(var M=0,E=w.length;M<E;M++)b=w[M],y.vertexColors.push(b.clone());y.materialIndex=v.materialIndex+i,s.push(y)}for(d=0,f=l.length;d<f;d++){var T=l[d],S=[];if(void 0!==T){for(var M=0,E=T.length;M<E;M++)S.push(T[M].clone());h.push(S)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t={},e=[],i=[],n,r,a=4,o=Math.pow(10,4),s,c,h,l,u,p;for(s=0,c=this.vertices.length;s<c;s++)n=this.vertices[s],void 0===t[r=Math.round(n.x*o)+"_"+Math.round(n.y*o)+"_"+Math.round(n.z*o)]?(t[r]=s,e.push(this.vertices[s]),i[s]=e.length-1):i[s]=i[t[r]];var d=[];for(s=0,c=this.faces.length;s<c;s++){(h=this.faces[s]).a=i[h.a],h.b=i[h.b],h.c=i[h.c],l=[h.a,h.b,h.c];for(var f=0;f<3;f++)if(l[f]===l[(f+1)%3]){d.push(s);break}}for(s=d.length-1;0<=s;s--){var m=d[s];for(this.faces.splice(m,1),u=0,p=this.faceVertexUvs.length;u<p;u++)this.faceVertexUvs[u].splice(m,1)}var g=this.vertices.length-e.length;return this.vertices=e,g},setFromPoints:function(t){this.vertices=[];for(var e=0,i=t.length;e<i;e++){var n=t[e];this.vertices.push(new ci(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,i=0;i<e;i++)t[i]._id=i;function n(t,e){return t.materialIndex-e.materialIndex}t.sort(n);var r=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;r&&r.length===e&&(o=[]),a&&a.length===e&&(s=[]);for(var i=0;i<e;i++){var c=t[i]._id;o&&o.push(r[c]),s&&s.push(a[c])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}for(var n=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];n.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},h=[],l={},u=[],p={},r=0;r<this.faces.length;r++){var d=this.faces[r],f=!0,m=!1,g=void 0!==this.faceVertexUvs[0][r],v=0<d.normal.length(),y=0<d.vertexNormals.length,x=1!==d.color.r||1!==d.color.g||1!==d.color.b,b=0<d.vertexColors.length,_=0;if(_=T(_=T(_=T(_=T(_=T(_=T(_=T(_=T(_,0,0),1,!0),2,!1),3,g),4,v),5,y),6,x),7,b),o.push(_),o.push(d.a,d.b,d.c),o.push(d.materialIndex),g){var w=this.faceVertexUvs[0][r];o.push(L(w[0]),L(w[1]),L(w[2]))}if(v&&o.push(S(d.normal)),y){var M=d.vertexNormals;o.push(S(M[0]),S(M[1]),S(M[2]))}if(x&&o.push(A(d.color)),b){var E=d.vertexColors;o.push(A(E[0]),A(E[1]),A(E[2]))}}function T(t,e,i){return i?t|1<<e:t&~(1<<e)}function S(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]||(c[e]=s.length/3,s.push(t.x,t.y,t.z)),c[e]}function A(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==l[e]||(l[e]=h.length,h.push(t.getHex())),l[e]}function L(t){var e=t.x.toString()+t.y.toString();return void 0!==p[e]||(p[e]=u.length/2,u.push(t.x,t.y)),p[e]}return t.data={},t.data.vertices=n,t.data.normals=s,0<h.length&&(t.data.colors=h),0<u.length&&(t.data.uvs=[u]),t.data.faces=o,t},clone:function(){return(new Na).copy(this)},copy:function(t){var e,i,n,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,i=s.length;e<i;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,i=c.length;e<i;e++)this.colors.push(c[e].clone());var h=t.faces;for(e=0,i=h.length;e<i;e++)this.faces.push(h[e].clone());for(e=0,i=t.faceVertexUvs.length;e<i;e++){var l=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),n=0,r=l.length;n<r;n++){var u=l[n],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[e].push(p)}}var f=t.morphTargets;for(e=0,i=f.length;e<i;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],n=0,r=f[e].vertices.length;n<r;n++)m.vertices.push(f[e].vertices[n].clone());if(void 0!==f[e].normals)for(m.normals=[],n=0,r=f[e].normals.length;n<r;n++)m.normals.push(f[e].normals[n].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(e=0,i=g.length;e<i;e++){var v={};if(void 0!==g[e].vertexNormals)for(v.vertexNormals=[],n=0,r=g[e].vertexNormals.length;n<r;n++){var y=g[e].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[e].faceNormals)for(v.faceNormals=[],n=0,r=g[e].faceNormals.length;n<r;n++)v.faceNormals.push(g[e].faceNormals[n].clone());this.morphNormals.push(v)}var b=t.skinWeights;for(e=0,i=b.length;e<i;e++)this.skinWeights.push(b[e].clone());var _=t.skinIndices;for(e=0,i=_.length;e<i;e++)this.skinIndices.push(_[e].clone());var w=t.lineDistances;for(e=0,i=w.length;e<i;e++)this.lineDistances.push(w[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=t.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Da.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Da.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.itemSize:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(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.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new Yr),e[i++]=a.r,e[i++]=a.g,e[i++]=a.b}return this},copyVector2sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new ai),e[i++]=a.x,e[i++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new ci),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new Li),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z,e[i++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(Ua.prototype=Object.create(Da.prototype)).constructor=Ua,(Ba.prototype=Object.create(Da.prototype)).constructor=Ba,(Fa.prototype=Object.create(Da.prototype)).constructor=Fa,(za.prototype=Object.create(Da.prototype)).constructor=za,(Ga.prototype=Object.create(Da.prototype)).constructor=Ga,(Ha.prototype=Object.create(Da.prototype)).constructor=Ha,(Va.prototype=Object.create(Da.prototype)).constructor=Va,(ka.prototype=Object.create(Da.prototype)).constructor=ka,(ja.prototype=Object.create(Da.prototype)).constructor=ja,Object.assign(Wa.prototype,{computeGroups:function(t){for(var e,i=[],n=void 0,r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,i.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e=t.faces,i=t.vertices,n=t.faceVertexUvs,r=n[0]&&0<n[0].length,a=n[1]&&0<n[1].length,o=t.morphTargets,s=o.length,c;if(0<s){c=[];for(var h=0;h<s;h++)c[h]=[];this.morphTargets.position=c}var l=t.morphNormals,u=l.length,p;if(0<u){p=[];for(var h=0;h<u;h++)p[h]=[];this.morphTargets.normal=p}var d=t.skinIndices,f=t.skinWeights,m=d.length===i.length,g=f.length===i.length;0<i.length&&0===e.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var h=0;h<e.length;h++){var v=e[h];this.vertices.push(i[v.a],i[v.b],i[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b=v.vertexColors,_,_;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=v.color;this.colors.push(w,w,w)}if(!0===r)void 0!==(_=n[0][h])?this.uvs.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new ai,new ai,new ai));if(!0===a)void 0!==(_=n[1][h])?this.uvs2.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new ai,new ai,new ai));for(var M=0;M<s;M++){var E=o[M].vertices;c[M].push(E[v.a],E[v.b],E[v.c])}for(var M=0;M<u;M++){var T=l[M].vertexNormals[h];p[M].push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}});var qa=1,Ya,Ja,Za,Qa,Ka,$a,to,eo,io,no;function ro(){Object.defineProperty(this,"id",{value:qa+=2}),this.uuid=De.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function ao(t,e,i,n,r,a){Na.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new oo(t,e,i,n,r,a)),this.mergeVertices()}function oo(t,e,i,n,r,a){ro.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var R=this;t=t||1,e=e||1,i=i||1,n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var C=[],P=[],O=[],I=[],N=0,D=0;function o(t,e,i,n,r,a,o,s,c,h,l){var u=a/c,p=o/h,d=a/2,f=o/2,m=s/2,g=c+1,v=h+1,y=0,x=0,b,_,w=new ci;for(_=0;_<v;_++){var M=_*p-f;for(b=0;b<g;b++){var E=b*u-d;w[t]=E*n,w[e]=M*r,w[i]=m,P.push(w.x,w.y,w.z),w[t]=0,w[e]=0,w[i]=0<s?1:-1,O.push(w.x,w.y,w.z),I.push(b/c),I.push(1-_/h),y+=1}}for(_=0;_<h;_++)for(b=0;b<c;b++){var T=N+b+g*_,S=N+b+g*(_+1),A=N+(b+1)+g*(_+1),L=N+(b+1)+g*_;C.push(T,S,L),C.push(S,A,L),x+=6}R.addGroup(D,x,l),D+=x,N+=y}o("z","y","x",-1,-1,i,e,t,a,r,0),o("z","y","x",1,-1,i,e,-t,a,r,1),o("x","z","y",1,1,t,i,e,n,a,2),o("x","z","y",1,-1,t,i,-e,n,a,3),o("x","y","z",1,-1,t,e,i,n,r,4),o("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(C),this.addAttribute("position",new ka(P,3)),this.addAttribute("normal",new ka(O,3)),this.addAttribute("uv",new ka(I,2))}function so(t,e,i,n){Na.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new co(t,e,i,n)),this.mergeVertices()}function co(t,e,i,n){ro.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};var r=(t=t||1)/2,a=(e=e||1)/2,o=Math.floor(i)||1,s=Math.floor(n)||1,c=o+1,h=s+1,l=t/o,u=e/s,p,d,f=[],m=[],g=[],v=[];for(d=0;d<h;d++){var y=d*u-a;for(p=0;p<c;p++){var x=p*l-r;m.push(x,-y,0),g.push(0,0,1),v.push(p/o),v.push(1-d/s)}}for(d=0;d<s;d++)for(p=0;p<o;p++){var b=p+c*d,_=p+c*(d+1),w=p+1+c*(d+1),M=p+1+c*d;f.push(b,_,M),f.push(_,w,M)}this.setIndex(f),this.addAttribute("position",new ka(m,3)),this.addAttribute("normal",new ka(g,3)),this.addAttribute("uv",new ka(v,2))}ro.prototype=Object.assign(Object.create(e.prototype),{constructor:ro,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(65535<Xa(t)?Va:Ga)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?("index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)):this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new Da(e,arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var i=this.attributes.normal,n;void 0!==i&&((new hi).getNormalMatrix(t).applyToBufferAttribute(i),i.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(no=new oi,function t(e){return no.makeRotationX(e),this.applyMatrix(no),this}),rotateY:(io=new oi,function t(e){return io.makeRotationY(e),this.applyMatrix(io),this}),rotateZ:(eo=new oi,function t(e){return eo.makeRotationZ(e),this.applyMatrix(eo),this}),translate:(to=new oi,function t(e,i,n){return to.makeTranslation(e,i,n),this.applyMatrix(to),this}),scale:($a=new oi,function t(e,i,n){return $a.makeScale(e,i,n),this.applyMatrix($a),this}),lookAt:(Ka=new wa,function t(e){Ka.lookAt(e),Ka.updateMatrix(),this.applyMatrix(Ka.matrix)}),center:(Qa=new ci,function t(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qa).negate(),this.translate(Qa.x,Qa.y,Qa.z),this}),setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new ka(3*e.vertices.length,3),n=new ka(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new ka(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];e.push(r.x,r.y,r.z||0)}return this.addAttribute("position",new ka(e,3)),this},updateFromObject:function(t){var e=t.geometry,i;if(t.isMesh){var n=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}return!0===e.verticesNeedUpdate&&(void 0!==(i=this.attributes.position)&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(i=this.attributes.normal)&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(i=this.attributes.color)&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(i=this.attributes.uv)&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(i=this.attributes.lineDistance)&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Wa).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new Da(e,3).copyVector3sArray(t.vertices)),0<t.normals.length){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Da(i,3).copyVector3sArray(t.normals))}if(0<t.colors.length){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new Da(n,3).copyColorsArray(t.colors))}if(0<t.uvs.length){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Da(r,2).copyVector2sArray(t.uvs))}if(0<t.uvs2.length){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Da(a,2).copyVector2sArray(t.uvs2))}for(var o in this.groups=t.groups,t.morphTargets){for(var s=[],c=t.morphTargets[o],h=0,l=c.length;h<l;h++){var u=c[h],p=new ka(3*u.length,3);s.push(p.copyVector3sArray(u))}this.morphAttributes[o]=s}if(0<t.skinIndices.length){var d=new ka(4*t.skinIndices.length,4);this.addAttribute("skinIndex",d.copyVector4sArray(t.skinIndices))}if(0<t.skinWeights.length){var f=new ka(4*t.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Oi);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):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:(Ja=new Oi,Za=new ci,function t(){null===this.boundingSphere&&(this.boundingSphere=new Ii);var e=this.attributes.position;if(e){var i=this.boundingSphere.center;Ja.setFromBufferAttribute(e),Ja.getCenter(i);for(var n=0,r=0,a=e.count;r<a;r++)Za.x=e.getX(r),Za.y=e.getY(r),Za.z=e.getZ(r),n=Math.max(n,i.distanceToSquared(Za));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)}}),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,i=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new Da(new Float32Array(n.length),3));else for(var r=e.normal.array,a=0,o=r.length;a<o;a++)r[a]=0;var s=e.normal.array,c,h,l,u=new ci,p=new ci,d=new ci,f=new ci,m=new ci;if(t){var g=t.array;0===i.length&&this.addGroup(0,g.length);for(var v=0,y=i.length;v<y;++v)for(var x=i[v],b=x.start,_,a=b,o=b+x.count;a<o;a+=3)c=3*g[a+0],h=3*g[a+1],l=3*g[a+2],u.fromArray(n,c),p.fromArray(n,h),d.fromArray(n,l),f.subVectors(d,p),m.subVectors(u,p),f.cross(m),s[c]+=f.x,s[c+1]+=f.y,s[c+2]+=f.z,s[h]+=f.x,s[h+1]+=f.y,s[h+2]+=f.z,s[l]+=f.x,s[l+1]+=f.y,s[l+2]+=f.z}else for(var a=0,o=n.length;a<o;a+=9)u.fromArray(n,a),p.fromArray(n,a+3),d.fromArray(n,a+6),f.subVectors(d,p),m.subVectors(u,p),f.cross(m),s[a]=f.x,s[a+1]=f.y,s[a+2]=f.z,s[a+3]=f.x,s[a+4]=f.y,s[a+5]=f.z,s[a+6]=f.x,s[a+7]=f.y,s[a+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var i=this.attributes;for(var n in i)if(void 0!==t.attributes[n])for(var r,a=i[n].array,o=t.attributes[n],s=o.array,c,h=0,l=o.itemSize*e;h<s.length;h++,l++)a[l]=s[h];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:(Ya=new ci,function t(){for(var e=this.attributes.normal,i=0,n=e.count;i<n;i++)Ya.x=e.getX(i),Ya.y=e.getY(i),Ya.z=e.getZ(i),Ya.normalize(),e.setXYZ(i,Ya.x,Ya.y,Ya.z)}),toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new ro,e=this.index.array,i=this.attributes;for(var n in i){for(var r=i[n],a=r.array,o=r.itemSize,s=new a.constructor(e.length*o),c=0,h=0,l=0,u=e.length;l<u;l++){c=e[l]*o;for(var p=0;p<o;p++)s[h++]=a[c++]}t.addAttribute(n,new Da(s,o))}for(var d=this.groups,l=0,u=d.length;l<u;l++){var f=d[l];t.addGroup(f.start,f.count,f.materialIndex)}return t},toJSON:function(){var 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),0<Object.keys(this.userData).length&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;if(null!==n){var r=Array.prototype.slice.call(n.array);t.data.index={type:n.array.constructor.name,array:r}}var a=this.attributes;for(var i in a){var o=a[i],r=Array.prototype.slice.call(o.array);t.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;0<s.length&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new ro).copy(this)},copy:function(t){var e,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var c=[],h=s[e];for(i=0,n=h.length;i<n;i++)c.push(h[i].clone());this.morphAttributes[e]=c}var l=t.groups;for(i=0,n=l.length;i<n;i++){var u=l[i];this.addGroup(u.start,u.count,u.materialIndex)}var p=t.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=t.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(ao.prototype=Object.create(Na.prototype)).constructor=ao,(oo.prototype=Object.create(ro.prototype)).constructor=oo,(so.prototype=Object.create(Na.prototype)).constructor=so,(co.prototype=Object.create(ro.prototype)).constructor=co;var ho=0,lo,uo,po,fo,mo,go,vo,yo,xo,bo,_o,wo,Mo,Eo,To,So,Ao,Lo,Ro,Co,Po,Oo,Io,No;function Do(){Object.defineProperty(this,"id",{value:ho++}),this.uuid=De.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=dt,this.side=s,this.flatShading=!1,this.vertexColors=l,this.opacity=1,this.transparent=!1,this.blendSrc=w,this.blendDst=M,this.blendEquation=p,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=_t,this.depthTest=!0,this.depthWrite=!0,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.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function Uo(t){Do.call(this),this.type="MeshBasicMaterial",this.color=new Yr(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.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Bo(t){Do.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,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,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function Fo(t,e){this.origin=void 0!==t?t:new ci,this.direction=void 0!==e?e:new ci}function zo(t,e,i){this.a=void 0!==t?t:new ci,this.b=void 0!==e?e:new ci,this.c=void 0!==i?i:new ci}function Go(t,e){wa.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new ro,this.material=void 0!==e?e:new Uo({color:16777215*Math.random()}),this.drawMode=be,this.updateMorphTargets()}function Ho(a,i,o,n){var s=new Yr(0),c=0,h,l,u;function t(t,e,i,n){var r=e.background;null===r?p(s,c):r&&r.isColor&&(p(r,1),n=!0),(a.autoClear||n)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil),r&&r.isCubeTexture?(void 0===u&&((u=new Go(new oo(1,1,1),new Bo({uniforms:Zr.cube.uniforms,vertexShader:Zr.cube.vertexShader,fragmentShader:Zr.cube.fragmentShader,side:Ht,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),u.geometry.removeAttribute("uv"),u.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},o.update(u)),u.material.uniforms.tCube.value=r,t.push(u,u.geometry,u.material,0,null)):r&&r.isTexture&&(void 0===h&&(h=new Ea(-1,1,1,-1,0,1),l=new Go(new co(2,2),new Uo({depthTest:!1,depthWrite:!1,fog:!1})),o.update(l)),l.material.map=r,a.renderBufferDirect(h,null,l.geometry,l.material,l,null))}function p(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,n)}return{getClearColor:function(){return s},setClearColor:function(t,e){s.set(t),p(s,c=void 0!==e?e:1)},getClearAlpha:function(){return c},setClearAlpha:function(t){p(s,c=t)},render:t}}function Vo(r,a,o,s){var c;function t(t){c=t}function e(t,e){r.drawArrays(c,t,e),o.update(e,c)}function i(t,e,i){var n;if(s.isWebGL2)n=r;else if(null===(n=a.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");n[s.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](c,e,i,t.maxInstancedCount),o.update(i,c,t.maxInstancedCount)}this.setMode=t,this.render=e,this.renderInstances=i}function ko(e,i,t){var n;function r(){if(void 0!==n)return n;var t=i.get("EXT_texture_filter_anisotropic");return n=null!==t?e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function a(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision?"mediump":"lowp"}var o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,s=void 0!==t.precision?t.precision:"highp",c=a(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);var h=!0===t.logarithmicDepthBuffer,l=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=e.getParameter(e.MAX_TEXTURE_SIZE),d=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),m=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=0<u,x=o||!!i.get("OES_texture_float"),b;return{isWebGL2:o,getMaxAnisotropy:r,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:h,maxTextures:l,maxVertexTextures:u,maxTextureSize:p,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x}}function jo(){var l=this,u=null,p=0,d=!1,f=!1,m=new Ni,g=new hi,v={value:null,needsUpdate:!1};function y(){v.value!==u&&(v.value=u,v.needsUpdate=0<p),l.numPlanes=p,l.numIntersection=0}function x(t,e,i,n){var r=null!==t?t.length:0,a=null;if(0!==r){if(a=v.value,!0!==n||null===a){var o=i+4*r,s=e.matrixWorldInverse;g.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var c=0,h=i;c!==r;++c,h+=4)m.copy(t[c]).applyMatrix4(s,g),m.normal.toArray(a,h),a[h+3]=m.constant}v.value=a,v.needsUpdate=!0}return l.numPlanes=r,a}this.uniform=v,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,i){var n=0!==t.length||e||0!==p||d;return d=e,u=x(t,i,0),p=t.length,n},this.beginShadows=function(){f=!0,x(null)},this.endShadows=function(){f=!1,y()},this.setState=function(t,e,i,n,r,a){if(!d||null===t||0===t.length||f&&!i)f?x(null):y();else{var o=f?0:p,s=4*o,c=r.clippingState||null;v.value=c,c=x(t,n,s,a);for(var h=0;h!==s;++h)c[h]=u[h];r.clippingState=c,this.numIntersection=e?this.numPlanes:0,this.numPlanes+=o}}}function Wo(i){var n={};return{get:function(t){if(void 0!==n[t])return n[t];var e;switch(t){case"WEBGL_depth_texture":e=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":e=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:e=i.getExtension(t)}return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),n[t]=e}}}function Xo(u,p,a){var o={},d={};function s(t){var e=t.target,i=o[e.id];for(var n in null!==i.index&&p.remove(i.index),i.attributes)p.remove(i.attributes[n]);e.removeEventListener("dispose",s),delete o[e.id];var r=d[i.id];r&&(p.remove(r),delete d[i.id]),a.memory.geometries--}function t(t,e){var i=o[e.id];return i||(e.addEventListener("dispose",s),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new ro).setFromObject(t)),i=e._bufferGeometry),o[e.id]=i,a.memory.geometries++,i)}function e(t){var e=t.index,i=t.attributes;for(var n in null!==e&&p.update(e,u.ELEMENT_ARRAY_BUFFER),i)p.update(i[n],u.ARRAY_BUFFER);var r=t.morphAttributes;for(var n in r)for(var a=r[n],o=0,s=a.length;o<s;o++)p.update(a[o],u.ARRAY_BUFFER)}function i(t){var e=d[t.id];if(e)return e;var i=[],n=t.index,r=t.attributes;if(null!==n)for(var a,o=0,s=(a=n.array).length;o<s;o+=3){var c=a[o+0],h=a[o+1],l=a[o+2];i.push(c,h,h,l,l,c)}else for(var a,o=0,s=(a=r.position.array).length/3-1;o<s;o+=3){var c=o+0,h=o+1,l=o+2;i.push(c,h,h,l,l,c)}return e=new(65535<Xa(i)?Va:Ga)(i,1),p.update(e,u.ELEMENT_ARRAY_BUFFER),d[t.id]=e}return{get:t,update:e,getWireframeAttribute:i}}function qo(r,a,o,s){var c,h,l;function t(t){c=t}function e(t){h=t.type,l=t.bytesPerElement}function i(t,e){r.drawElements(c,e,h,t*l),o.update(e,c)}function n(t,e,i){var n,n;if(s.isWebGL2)n=r;else if(null===(n=a.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");n[s.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](c,i,h,e*l,t.maxInstancedCount),o.update(i,c,t.maxInstancedCount)}this.setMode=t,this.setIndex=e,this.render=i,this.renderInstances=n}function Yo(n){var t,r={frame:0,calls:0,triangles:0,points:0,lines:0};function e(t,e,i){switch(i=i||1,r.calls++,e){case n.TRIANGLES:r.triangles+=i*(t/3);break;case n.TRIANGLE_STRIP:case n.TRIANGLE_FAN:r.triangles+=i*(t-2);break;case n.LINES:r.lines+=i*(t/2);break;case n.LINE_STRIP:r.lines+=i*(t-1);break;case n.LINE_LOOP:r.lines+=i*t;break;case n.POINTS:r.points+=i*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",e)}}function i(){r.frame++,r.calls=0,r.triangles=0,r.points=0,r.lines=0}return{memory:{geometries:0,textures:0},render:r,programs:null,autoReset:!0,reset:i,update:e}}function Jo(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Zo(d){var f={},m=new Float32Array(8);function t(t,e,i,n){var r=t.morphTargetInfluences,a=r.length,o=f[e.id];if(void 0===o){o=[];for(var s=0;s<a;s++)o[s]=[s,0];f[e.id]=o}for(var c=i.morphTargets&&e.morphAttributes.position,h=i.morphNormals&&e.morphAttributes.normal,s=0;s<a;s++){var l;0!==(l=o[s])[1]&&(c&&e.removeAttribute("morphTarget"+s),h&&e.removeAttribute("morphNormal"+s))}for(var s=0;s<a;s++){var l;(l=o[s])[0]=s,l[1]=r[s]}o.sort(Jo);for(var s=0;s<8;s++){var l;if(l=o[s]){var u=l[0],p=l[1];if(p){c&&e.addAttribute("morphTarget"+s,c[u]),h&&e.addAttribute("morphNormal"+s,h[u]),m[s]=p;continue}}m[s]=0}n.getUniforms().setValue(d,"morphTargetInfluences",m)}return{update:t}}function Qo(r,a){var o={};function t(t){var e=a.render.frame,i=t.geometry,n=r.get(t,i);return o[n.id]!==e&&(i.isGeometry&&n.updateFromObject(t),r.update(n),o[n.id]=e),n}function e(){o={}}return{update:t,dispose:e}}function Ko(t,e,i,n,r,a,o,s,c,h){Ai.call(this,t=void 0!==t?t:[],e=void 0!==e?e:G,i,n,r,a,o,s,c,h),this.flipY=!1}Do.prototype=Object.assign(Object.create(e.prototype),{constructor:Do,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i)if("shading"!==e){var n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]="overdraw"===e?Number(i):i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){var e=[];for(var i in t){var 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),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.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.map&&this.map.isTexture&&(i.map=this.map.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),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.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==dt&&(i.blending=this.blending),!0===this.flatShading&&(i.flatShading=this.flatShading),this.side!==s&&(i.side=this.side),this.vertexColors!==l&&(i.vertexColors=this.vertexColors),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,0!==this.rotation&&(i.rotation=this.rotation),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),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){var r=n(t.textures),a=n(t.images);0<r.length&&(i.textures=r),0<a.length&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,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.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.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((Uo.prototype=Object.create(Do.prototype)).constructor=Uo).prototype.isMeshBasicMaterial=!0,Uo.prototype.copy=function(t){return Do.prototype.copy.call(this,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.skinning=t.skinning,this.morphTargets=t.morphTargets,this},((Bo.prototype=Object.create(Do.prototype)).constructor=Bo).prototype.isShaderMaterial=!0,Bo.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Wr.clone(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Bo.prototype.toJSON=function(t){var e=Do.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},Object.assign(Fo.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new ci),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:(_o=new ci,function t(e){return this.origin.copy(this.at(e,_o)),this}),closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new ci),e.subVectors(t,this.origin);var i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:(bo=new ci,function t(e){var i=bo.subVectors(e,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(e):(bo.copy(this.direction).multiplyScalar(i).add(this.origin),bo.distanceToSquared(e))}),distanceSqToSegment:(vo=new ci,yo=new ci,xo=new ci,function t(e,i,n,r){vo.copy(e).add(i).multiplyScalar(.5),yo.copy(i).sub(e).normalize(),xo.copy(this.origin).sub(vo);var a=.5*e.distanceTo(i),o=-this.direction.dot(yo),s=xo.dot(this.direction),c=-xo.dot(yo),h=xo.lengthSq(),l=Math.abs(1-o*o),u,p,d,f;if(0<l)if(p=o*s-c,f=a*l,0<=(u=o*c-s))if(-f<=p)if(p<=f){var m=1/l;d=(u*=m)*(u+o*(p*=m)+2*s)+p*(o*u+p+2*c)+h}else p=a,d=-(u=Math.max(0,-(o*p+s)))*u+p*(p+2*c)+h;else p=-a,d=-(u=Math.max(0,-(o*p+s)))*u+p*(p+2*c)+h;else d=p<=-f?-(u=Math.max(0,-(-o*a+s)))*u+(p=0<u?-a:Math.min(Math.max(-a,-c),a))*(p+2*c)+h:p<=f?(u=0,(p=Math.min(Math.max(-a,-c),a))*(p+2*c)+h):-(u=Math.max(0,-(o*a+s)))*u+(p=0<u?a:Math.min(Math.max(-a,-c),a))*(p+2*c)+h;else p=0<o?-a:a,d=-(u=Math.max(0,-(o*p+s)))*u+p*(p+2*c)+h;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(yo).multiplyScalar(p).add(vo),d}),intersectSphere:(go=new ci,function t(e,i){go.subVectors(e.center,this.origin);var n=go.dot(this.direction),r=go.dot(go)-n*n,a=e.radius*e.radius;if(a<r)return null;var o=Math.sqrt(a-r),s=n-o,c=n+o;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return 0<=i?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin),i;return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,n,r,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return n=0<=c?(i=(t.min.x-u.x)*c,(t.max.x-u.x)*c):(i=(t.max.x-u.x)*c,(t.min.x-u.x)*c),(a=0<=h?(r=(t.min.y-u.y)*h,(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,(t.min.y-u.y)*h))<i||n<r?null:((i<r||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),(s=0<=l?(o=(t.min.z-u.z)*l,(t.max.z-u.z)*l):(o=(t.max.z-u.z)*l,(t.min.z-u.z)*l))<i||n<o?null:((i<o||i!=i)&&(i=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(0<=i?i:n,e)))},intersectsBox:(mo=new ci,function t(e){return null!==this.intersectBox(e,mo)}),intersectTriangle:(lo=new ci,uo=new ci,po=new ci,fo=new ci,function t(e,i,n,r,a){uo.subVectors(i,e),po.subVectors(n,e),fo.crossVectors(uo,po);var o=this.direction.dot(fo),s;if(0<o){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}lo.subVectors(this.origin,e);var c=s*this.direction.dot(po.crossVectors(lo,po));if(c<0)return null;var h=s*this.direction.dot(uo.cross(lo));if(h<0)return null;if(o<c+h)return null;var l=-s*lo.dot(fo);return l<0?null:this.at(l/o,a)}),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(zo,{getNormal:(So=new ci,function t(e,i,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new ci),r.subVectors(n,i),So.subVectors(e,i),r.cross(So);var a=r.lengthSq();return 0<a?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}),getBarycoord:(Mo=new ci,Eo=new ci,To=new ci,function t(e,i,n,r,a){Mo.subVectors(r,i),Eo.subVectors(n,i),To.subVectors(e,i);var o=Mo.dot(Mo),s=Mo.dot(Eo),c=Mo.dot(To),h=Eo.dot(Eo),l=Eo.dot(To),u=o*h-s*s;if(void 0===a&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),a=new ci),0===u)return a.set(-2,-1,-1);var p=1/u,d=(h*c-s*l)*p,f=(o*l-s*c)*p;return a.set(1-d-f,f,d)}),containsPoint:(wo=new ci,function t(e,i,n,r){return zo.getBarycoord(e,i,n,r,wo),0<=wo.x&&0<=wo.y&&wo.x+wo.y<=1})}),Object.assign(zo.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:(Io=new ci,No=new ci,function t(){return Io.subVectors(this.c,this.b),No.subVectors(this.a,this.b),.5*Io.cross(No).length()}),getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new ci),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return zo.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new ci),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return zo.getBarycoord(t,this.a,this.b,this.c,e)},containsPoint:function(t){return zo.containsPoint(t,this.a,this.b,this.c)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:(Ao=new ci,Lo=new ci,Ro=new ci,Co=new ci,Po=new ci,Oo=new ci,function t(e,i){void 0===i&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),i=new ci);var n=this.a,r=this.b,a=this.c,o,s;Ao.subVectors(r,n),Lo.subVectors(a,n),Co.subVectors(e,n);var c=Ao.dot(Co),h=Lo.dot(Co);if(c<=0&&h<=0)return i.copy(n);Po.subVectors(e,r);var l=Ao.dot(Po),u=Lo.dot(Po);if(0<=l&&u<=l)return i.copy(r);var p=c*u-l*h;if(p<=0&&0<=c&&l<=0)return o=c/(c-l),i.copy(n).addScaledVector(Ao,o);Oo.subVectors(e,a);var d=Ao.dot(Oo),f=Lo.dot(Oo);if(0<=f&&d<=f)return i.copy(a);var m=d*h-c*f;if(m<=0&&0<=h&&f<=0)return s=h/(h-f),i.copy(n).addScaledVector(Lo,s);var g=l*f-d*u;if(g<=0&&0<=u-l&&0<=d-f)return Ro.subVectors(a,r),s=(u-l)/(u-l+(d-f)),i.copy(r).addScaledVector(Ro,s);var v=1/(g+m+p);return o=m*v,s=p*v,i.copy(n).addScaledVector(Ao,o).addScaledVector(Lo,s)}),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Go.prototype=Object.assign(Object.create(wa.prototype),{constructor:Go,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return wa.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t=this.geometry,e,i,n;if(t.isBufferGeometry){var r=t.morphAttributes,a=Object.keys(r);if(0<a.length){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,i=o.length;e<i;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=t.morphTargets;if(void 0!==s&&0<s.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,i=s.length;e<i;e++)n=s[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}},raycast:function(){var V=new oi,k=new Fo,j=new Ii,W=new ci,X=new ci,q=new ci,Y=new ci,J=new ci,Z=new ci,Q=new ai,K=new ai,$=new ai,s=new ci,tt=new ci,l=new ci;function et(t,e,i,n,r,a,o){return zo.getBarycoord(t,e,i,n,s),r.multiplyScalar(s.x),a.multiplyScalar(s.y),o.multiplyScalar(s.z),r.add(a).add(o),r.clone()}function it(t,e,i,n,r,a,o,s){var c;if(null===(c=e.side===Ht?n.intersectTriangle(o,a,r,!0,s):n.intersectTriangle(r,a,o,e.side!==ut,s)))return null;l.copy(s),l.applyMatrix4(t.matrixWorld);var h=i.ray.origin.distanceTo(l);return h<i.near||h>i.far?null:{distance:h,point:l.clone(),object:t}}function nt(t,e,i,n,r,a,o,s,c){W.fromBufferAttribute(r,o),X.fromBufferAttribute(r,s),q.fromBufferAttribute(r,c);var h=it(t,e,i,n,W,X,q,tt);if(h){a&&(Q.fromBufferAttribute(a,o),K.fromBufferAttribute(a,s),$.fromBufferAttribute(a,c),h.uv=et(tt,W,X,q,Q,K,$));var l=new Ta(o,s,c);zo.getNormal(W,X,q,l.normal),h.face=l}return h}return function t(e,i){var n=this.geometry,r=this.material,a=this.matrixWorld,o;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),j.copy(n.boundingSphere),j.applyMatrix4(a),!1!==e.ray.intersectsSphere(j)&&(V.getInverse(a),k.copy(e.ray).applyMatrix4(V),null===n.boundingBox||!1!==k.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var s,c,h,l=n.index,u=n.attributes.position,p=n.attributes.uv,d=n.groups,f=n.drawRange,m,g,v,y,x,b,_,w;if(null!==l)if(Array.isArray(r))for(m=0,v=d.length;m<v;m++)for(b=r[(x=d[m]).materialIndex],g=_=Math.max(x.start,f.start),y=w=Math.min(x.start+x.count,f.start+f.count);g<y;g+=3)s=l.getX(g),c=l.getX(g+1),h=l.getX(g+2),(o=nt(this,b,e,k,u,p,s,c,h))&&(o.faceIndex=Math.floor(g/3),i.push(o));else for(m=_=Math.max(0,f.start),v=w=Math.min(l.count,f.start+f.count);m<v;m+=3)s=l.getX(m),c=l.getX(m+1),h=l.getX(m+2),(o=nt(this,r,e,k,u,p,s,c,h))&&(o.faceIndex=Math.floor(m/3),i.push(o));else if(void 0!==u)if(Array.isArray(r))for(m=0,v=d.length;m<v;m++)for(b=r[(x=d[m]).materialIndex],g=_=Math.max(x.start,f.start),y=w=Math.min(x.start+x.count,f.start+f.count);g<y;g+=3)(o=nt(this,b,e,k,u,p,s=g,c=g+1,h=g+2))&&(o.faceIndex=Math.floor(g/3),i.push(o));else for(m=_=Math.max(0,f.start),v=w=Math.min(u.count,f.start+f.count);m<v;m+=3)(o=nt(this,r,e,k,u,p,s=m,c=m+1,h=m+2))&&(o.faceIndex=Math.floor(m/3),i.push(o))}else if(n.isGeometry){var M,E,T,S=Array.isArray(r),A=n.vertices,L=n.faces,R,C=n.faceVertexUvs[0];0<C.length&&(R=C);for(var P=0,O=L.length;P<O;P++){var I=L[P],N=S?r[I.materialIndex]:r;if(void 0!==N){if(M=A[I.a],E=A[I.b],T=A[I.c],!0===N.morphTargets){var D=n.morphTargets,U=this.morphTargetInfluences;W.set(0,0,0),X.set(0,0,0),q.set(0,0,0);for(var B=0,F=D.length;B<F;B++){var z=U[B];if(0!==z){var G=D[B].vertices;W.addScaledVector(Y.subVectors(G[I.a],M),z),X.addScaledVector(J.subVectors(G[I.b],E),z),q.addScaledVector(Z.subVectors(G[I.c],T),z)}}W.add(M),X.add(E),q.add(T),M=W,E=X,T=q}if(o=it(this,N,e,k,M,E,T,tt)){if(R&&R[P]){var H=R[P];Q.copy(H[0]),K.copy(H[1]),$.copy(H[2]),o.uv=et(tt,M,E,T,Q,K,$)}o.face=I,o.faceIndex=P,i.push(o)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((Ko.prototype=Object.create(Ai.prototype)).constructor=Ko).prototype.isCubeTexture=!0,Object.defineProperty(Ko.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var $o=new Ai,ts=new Ko;function es(){this.seq=[],this.map={}}var is=[],ns=[],rs=new Float32Array(16),as=new Float32Array(9),os=new Float32Array(4);function ss(t,e,i){var n=t[0];if(n<=0||0<n)return t;var r=e*i,a=is[r];if(void 0===a&&(a=new Float32Array(r),is[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function cs(t,e){if(t.length!==e.length)return!1;for(var i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function hs(t,e){for(var i=0,n=e.length;i<n;i++)t[i]=e[i]}function ls(t,e){var i=ns[e];void 0===i&&(i=new Int32Array(e),ns[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function us(t,e){var i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function ps(t,e){var i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function ds(t,e){var 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(cs(i,e))return;t.uniform2fv(this.addr,e),hs(i,e)}}function fs(t,e){var 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(cs(i,e))return;t.uniform3fv(this.addr,e),hs(i,e)}}function ms(t,e){var 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(cs(i,e))return;t.uniform4fv(this.addr,e),hs(i,e)}}function gs(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(cs(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),hs(i,e)}else{if(cs(i,n))return;os.set(n),t.uniformMatrix2fv(this.addr,!1,os),hs(i,n)}}function vs(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(cs(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),hs(i,e)}else{if(cs(i,n))return;as.set(n),t.uniformMatrix3fv(this.addr,!1,as),hs(i,n)}}function ys(t,e){var i=this.cache,n=e.elements;if(void 0===n){if(cs(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),hs(i,e)}else{if(cs(i,n))return;rs.set(n),t.uniformMatrix4fv(this.addr,!1,rs),hs(i,n)}}function xs(t,e,i){var n=this.cache,r=i.allocTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2D(e||$o,r)}function bs(t,e,i){var n=this.cache,r=i.allocTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||ts,r)}function _s(t,e){var i=this.cache;cs(i,e)||(t.uniform2iv(this.addr,e),hs(i,e))}function ws(t,e){var i=this.cache;cs(i,e)||(t.uniform3iv(this.addr,e),hs(i,e))}function Ms(t,e){var i=this.cache;cs(i,e)||(t.uniform4iv(this.addr,e),hs(i,e))}function Es(t){switch(t){case 5126:return us;case 35664:return ds;case 35665:return fs;case 35666:return ms;case 35674:return gs;case 35675:return vs;case 35676:return ys;case 35678:case 36198:return xs;case 35680:return bs;case 5124:case 35670:return ps;case 35667:case 35671:return _s;case 35668:case 35672:return ws;case 35669:case 35673:return Ms}}function Ts(t,e){var i=this.cache;cs(i,e)||(t.uniform1fv(this.addr,e),hs(i,e))}function Ss(t,e){var i=this.cache;cs(i,e)||(t.uniform1iv(this.addr,e),hs(i,e))}function As(t,e){var i=this.cache,n=ss(e,this.size,2);cs(i,n)||(t.uniform2fv(this.addr,n),this.updateCache(n))}function Ls(t,e){var i=this.cache,n=ss(e,this.size,3);cs(i,n)||(t.uniform3fv(this.addr,n),this.updateCache(n))}function Rs(t,e){var i=this.cache,n=ss(e,this.size,4);cs(i,n)||(t.uniform4fv(this.addr,n),this.updateCache(n))}function Cs(t,e){var i=this.cache,n=ss(e,this.size,4);cs(i,n)||(t.uniformMatrix2fv(this.addr,!1,n),this.updateCache(n))}function Ps(t,e){var i=this.cache,n=ss(e,this.size,9);cs(i,n)||(t.uniformMatrix3fv(this.addr,!1,n),this.updateCache(n))}function Os(t,e){var i=this.cache,n=ss(e,this.size,16);cs(i,n)||(t.uniformMatrix4fv(this.addr,!1,n),this.updateCache(n))}function Is(t,e,i){var n=this.cache,r=e.length,a=ls(i,r);!1===cs(n,a)&&(t.uniform1iv(this.addr,a),hs(n,a));for(var o=0;o!==r;++o)i.setTexture2D(e[o]||$o,a[o])}function Ns(t,e,i){var n=this.cache,r=e.length,a=ls(i,r);!1===cs(n,a)&&(t.uniform1iv(this.addr,a),hs(n,a));for(var o=0;o!==r;++o)i.setTextureCube(e[o]||ts,a[o])}function Ds(t){switch(t){case 5126:return Ts;case 35664:return As;case 35665:return Ls;case 35666:return Rs;case 35674:return Cs;case 35675:return Ps;case 35676:return Os;case 35678:return Is;case 35680:return Ns;case 5124:case 35670:return Ss;case 35667:case 35671:return _s;case 35668:case 35672:return ws;case 35669:case 35673:return Ms}}function Us(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=Es(e.type)}function Bs(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=Ds(e.type)}function Fs(t){this.id=t,es.call(this)}Bs.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),hs(e,t)},Fs.prototype.setValue=function(t,e,i){for(var n=this.seq,r=0,a=n.length;r!==a;++r){var o=n[r];o.setValue(t,e[o.id],i)}};var zs=/([\w\d_]+)(\])?(\[|\.)?/g;function Gs(t,e){t.seq.push(e),t.map[e.id]=e}function Hs(t,e,i){var n=t.name,r=n.length;for(zs.lastIndex=0;;){var a=zs.exec(n),o=zs.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s|=0),void 0===h||"["===h&&o+2===r){Gs(i,void 0===h?new Us(s,t,e):new Bs(s,t,e));break}var l,u=i.map[s];void 0===u&&Gs(i,u=new Fs(s)),i=u}}function Vs(t,e,i){es.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<n;++r){var a=t.getActiveUniform(e,r),o;Hs(a,t.getUniformLocation(e,a.name),this)}}function ks(t){for(var e=t.split("\n"),i=0;i<e.length;i++)e[i]=i+1+": "+e[i];return e.join("\n")}function js(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),!1===t.getShaderParameter(n,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),ks(i)),n}Vs.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},Vs.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},Vs.upload=function(t,e,i,n){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},Vs.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var a=t[n];a.id in e&&i.push(a)}return i};var Ws=0;function Xs(t){switch(t){case Me:return["Linear","( value )"];case Ee:return["sRGB","( value )"];case Se:return["RGBE","( value )"];case Le:return["RGBM","( value, 7.0 )"];case Re:return["RGBM","( value, 16.0 )"];case Ce:return["RGBD","( value, 256.0 )"];case Te:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function qs(t,e){var i=Xs(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Ys(t,e){var i=Xs(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function Js(t,e){var i;switch(e){case Vt:i="Linear";break;case R:i="Reinhard";break;case C:i="Uncharted2";break;case P:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Zs(t,e,i){var n;return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap&&!e.objectSpaceNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter($s).join("\n")}function Qs(t){var e=[];for(var i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}function Ks(t,e){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r<n;r++){var a,o=t.getActiveAttrib(e,r).name;i[o]=t.getAttribLocation(e,o)}return i}function $s(t){return""!==t}function tc(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function ec(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function ic(t){var e=/^[ \t]*#include +<([\w\d./]+)>/gm;function i(t,e){var i=jr[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return ic(i)}return t.replace(e,i)}function nc(t){var e=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function i(t,e,i,n){for(var r="",a=parseInt(e);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r}return t.replace(e,i)}function rc(t,e,i,n,r,a,o){var s=t.context,c=n.defines,h=r.vertexShader,l=r.fragmentShader,u="SHADOWMAP_TYPE_BASIC";a.shadowMapType===U?u="SHADOWMAP_TYPE_PCF":a.shadowMapType===N&&(u="SHADOWMAP_TYPE_PCF_SOFT");var p="ENVMAP_TYPE_CUBE",d="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(n.envMap.mapping){case G:case H:p="ENVMAP_TYPE_CUBE";break;case W:case X:p="ENVMAP_TYPE_CUBE_UV";break;case V:case k:p="ENVMAP_TYPE_EQUIREC";break;case j:p="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case H:case k:d="ENVMAP_MODE_REFRACTION"}switch(n.combine){case D:f="ENVMAP_BLENDING_MULTIPLY";break;case B:f="ENVMAP_BLENDING_MIX";break;case F:f="ENVMAP_BLENDING_ADD"}}var m=0<t.gammaFactor?t.gammaFactor:1,g=o.isWebGL2?"":Zs(n.extensions,a,e),v=Qs(c),y=s.createProgram(),x,b;if(n.isRawShaderMaterial?(0<(x=[v].filter($s).join("\n")).length&&(x+="\n"),0<(b=[g,v].filter($s).join("\n")).length&&(b+="\n")):(x=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,v,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\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($s).join("\n"),b=[g,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,v,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+m,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.envMap?"#define "+d:"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==z?"#define TONE_MAPPING":"",a.toneMapping!==z?jr.tonemapping_pars_fragment:"",a.toneMapping!==z?Js("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.envMapEncoding||a.emissiveMapEncoding?jr.encodings_pars_fragment:"",a.mapEncoding?qs("mapTexelToLinear",a.mapEncoding):"",a.envMapEncoding?qs("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?qs("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?Ys("linearToOutputTexel",a.outputEncoding):"",a.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter($s).join("\n")),h=ec(h=tc(h=ic(h),a),a),l=ec(l=tc(l=ic(l),a),a),h=nc(h),l=nc(l),o.isWebGL2&&!n.isRawShaderMaterial){var _=!1,w=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==h.match(w)&&null!==l.match(w)&&(_=!0,h=h.replace(w,""),l=l.replace(w,"")),x=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,b=["#version 300 es\n","#define varying in",_?"":"out highp vec4 pc_fragColor;",_?"":"#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"+b}var M=x+h,E=b+l,T=js(s,s.VERTEX_SHADER,M),S=js(s,s.FRAGMENT_SHADER,E);s.attachShader(y,T),s.attachShader(y,S),void 0!==n.index0AttributeName?s.bindAttribLocation(y,0,n.index0AttributeName):!0===a.morphTargets&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y);var A=s.getProgramInfoLog(y).trim(),L=s.getShaderInfoLog(T).trim(),R=s.getShaderInfoLog(S).trim(),C=!0,P=!0,O,I;return!1===s.getProgramParameter(y,s.LINK_STATUS)?(C=!1,console.error("THREE.WebGLProgram: shader error: ",s.getError(),"gl.VALIDATE_STATUS",s.getProgramParameter(y,s.VALIDATE_STATUS),"gl.getProgramInfoLog",A,L,R)):""!==A?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",A):""!==L&&""!==R||(P=!1),P&&(this.diagnostics={runnable:C,material:n,programLog:A,vertexShader:{log:L,prefix:x},fragmentShader:{log:R,prefix:b}}),s.deleteShader(T),s.deleteShader(S),this.getUniforms=function(){return void 0===O&&(O=new Vs(s,y,t)),O},this.getAttributes=function(){return void 0===I&&(I=Ks(s,y)),I},this.destroy=function(){s.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.name=r.name,this.id=Ws++,this.code=i,this.usedTimes=1,this.program=y,this.vertexShader=T,this.fragmentShader=S,this}function ac(p,c,d){var h=[],f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function m(t){var e,i=t.skeleton.bones;if(d.floatVertexTextures)return 1024;var n=d.maxVertexUniforms,r=Math.floor((n-20)/4),a=Math.min(r,i.length);return a<i.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+i.length+" bones. This GPU supports "+a+"."),0):a}function g(t,e){var i;return t?t.isTexture?i=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=t.texture.encoding):i=Me,i===Me&&e&&(i=Te),i}this.getParameters=function(t,e,i,n,r,a,o){var s=f[t.type],c=o.isSkinnedMesh?m(o):0,h=d.precision;null!==t.precision&&(h=d.getMaxPrecision(t.precision))!==t.precision&&console.warn("THREE.WebGLProgram.getParameters:",t.precision,"not supported, using",h,"instead.");var l=p.getRenderTarget(),u;return{shaderID:s,precision:h,supportsVertexTextures:d.vertexTextures,outputEncoding:g(l?l.texture:null,p.gammaOutput),map:!!t.map,mapEncoding:g(t.map,p.gammaInput),envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,envMapEncoding:g(t.envMap,p.gammaInput),envMapCubeUV:!!t.envMap&&(t.envMap.mapping===W||t.envMap.mapping===X),lightMap:!!t.lightMap,aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,emissiveMapEncoding:g(t.emissiveMap,p.gammaInput),bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,objectSpaceNormalMap:t.normalMapType===Ne,displacementMap:!!t.displacementMap,roughnessMap:!!t.roughnessMap,metalnessMap:!!t.metalnessMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,gradientMap:!!t.gradientMap,combine:t.combine,vertexColors:t.vertexColors,fog:!!n,useFog:t.fog,fogExp:n&&n.isFogExp2,flatShading:t.flatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:d.logarithmicDepthBuffer,skinning:t.skinning&&0<c,maxBones:c,useVertexTexture:d.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:p.maxMorphTargets,maxMorphNormals:p.maxMorphNormals,numDirLights:e.directional.length,numPointLights:e.point.length,numSpotLights:e.spot.length,numRectAreaLights:e.rectArea.length,numHemiLights:e.hemi.length,numClippingPlanes:r,numClipIntersection:a,dithering:t.dithering,shadowMapEnabled:p.shadowMap.enabled&&o.receiveShadow&&0<i.length,shadowMapType:p.shadowMap.type,toneMapping:p.toneMapping,physicallyCorrectLights:p.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===ut,flipSided:t.side===Ht,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r<a.length;r++)i.push(e[a[r]]);return i.push(t.onBeforeCompile.toString()),i.push(p.gammaOutput),i.join()},this.acquireProgram=function(t,e,i,n){for(var r,a=0,o=h.length;a<o;a++){var s=h[a];if(s.code===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new rc(p,c,n,t,e,i,d),h.push(r)),r},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},this.programs=h}function oc(){var n=new WeakMap;function t(t){var e=n.get(t);return void 0===e&&(e={},n.set(t,e)),e}function e(t){n.delete(t)}function i(t,e,i){n.get(t)[e]=i}function r(){n=new WeakMap}return{get:t,remove:e,update:i,dispose:r}}function sc(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id: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 cc(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function hc(){var o=[],s=0,c=[],h=[];function t(){s=0,c.length=0,h.length=0}function e(t,e,i,n,r){var a=o[s];void 0===a?(a={id:t.id,object:t,geometry:e,material:i,program:i.program,renderOrder:t.renderOrder,z:n,group:r},o[s]=a):(a.id=t.id,a.object=t,a.geometry=e,a.material=i,a.program=i.program,a.renderOrder=t.renderOrder,a.z=n,a.group=r),(!0===i.transparent?h:c).push(a),s++}function i(){1<c.length&&c.sort(sc),1<h.length&&h.sort(cc)}return{opaque:c,transparent:h,init:t,push:e,sort:i}}function lc(){var r={};function t(t,e){var i=t.id+","+e.id,n=r[i];return void 0===n&&(n=new hc,r[i]=n),n}function e(){r={}}return{get:t,dispose:e}}function uc(){var i={};return{get:function(t){if(void 0!==i[t.id])return i[t.id];var e;switch(t.type){case"DirectionalLight":e={direction:new ci,color:new Yr,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new ai};break;case"SpotLight":e={position:new ci,direction:new ci,color:new Yr,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new ai};break;case"PointLight":e={position:new ci,color:new Yr,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new ai,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":e={direction:new ci,skyColor:new Yr,groundColor:new Yr};break;case"RectAreaLight":e={color:new Yr,position:new ci,halfWidth:new ci,halfHeight:new ci}}return i[t.id]=e}}}var pc=0,dc,fc,mc,gc,vc,yc,xc,bc,_c,wc,Mc,Ec,Tc,Sc,Ac,Lc;function Rc(){var _=new uc,w={id:pc++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},M=new ci,E=new oi,T=new oi;function t(t,e,i){for(var n=0,r=0,a=0,o=0,s=0,c=0,h=0,l=0,u=i.matrixWorldInverse,p=0,d=t.length;p<d;p++){var f=t[p],m=f.color,g=f.intensity,v=f.distance,y=f.shadow&&f.shadow.map?f.shadow.map.texture:null;if(f.isAmbientLight)n+=m.r*g,r+=m.g*g,a+=m.b*g;else if(f.isDirectionalLight){var x;if((x=_.get(f)).color.copy(f.color).multiplyScalar(f.intensity),x.direction.setFromMatrixPosition(f.matrixWorld),M.setFromMatrixPosition(f.target.matrixWorld),x.direction.sub(M),x.direction.transformDirection(u),x.shadow=f.castShadow,f.castShadow){var b=f.shadow;x.shadowBias=b.bias,x.shadowRadius=b.radius,x.shadowMapSize=b.mapSize}w.directionalShadowMap[o]=y,w.directionalShadowMatrix[o]=f.shadow.matrix,w.directional[o]=x,o++}else if(f.isSpotLight){var x;if((x=_.get(f)).position.setFromMatrixPosition(f.matrixWorld),x.position.applyMatrix4(u),x.color.copy(m).multiplyScalar(g),x.distance=v,x.direction.setFromMatrixPosition(f.matrixWorld),M.setFromMatrixPosition(f.target.matrixWorld),x.direction.sub(M),x.direction.transformDirection(u),x.coneCos=Math.cos(f.angle),x.penumbraCos=Math.cos(f.angle*(1-f.penumbra)),x.decay=0===f.distance?0:f.decay,x.shadow=f.castShadow,f.castShadow){var b=f.shadow;x.shadowBias=b.bias,x.shadowRadius=b.radius,x.shadowMapSize=b.mapSize}w.spotShadowMap[c]=y,w.spotShadowMatrix[c]=f.shadow.matrix,w.spot[c]=x,c++}else if(f.isRectAreaLight){var x;(x=_.get(f)).color.copy(m).multiplyScalar(g),x.position.setFromMatrixPosition(f.matrixWorld),x.position.applyMatrix4(u),T.identity(),E.copy(f.matrixWorld),E.premultiply(u),T.extractRotation(E),x.halfWidth.set(.5*f.width,0,0),x.halfHeight.set(0,.5*f.height,0),x.halfWidth.applyMatrix4(T),x.halfHeight.applyMatrix4(T),w.rectArea[h]=x,h++}else if(f.isPointLight){var x;if((x=_.get(f)).position.setFromMatrixPosition(f.matrixWorld),x.position.applyMatrix4(u),x.color.copy(f.color).multiplyScalar(f.intensity),x.distance=f.distance,x.decay=0===f.distance?0:f.decay,x.shadow=f.castShadow,f.castShadow){var b=f.shadow;x.shadowBias=b.bias,x.shadowRadius=b.radius,x.shadowMapSize=b.mapSize,x.shadowCameraNear=b.camera.near,x.shadowCameraFar=b.camera.far}w.pointShadowMap[s]=y,w.pointShadowMatrix[s]=f.shadow.matrix,w.point[s]=x,s++}else if(f.isHemisphereLight){var x;(x=_.get(f)).direction.setFromMatrixPosition(f.matrixWorld),x.direction.transformDirection(u),x.direction.normalize(),x.skyColor.copy(f.color).multiplyScalar(g),x.groundColor.copy(f.groundColor).multiplyScalar(g),w.hemi[l]=x,l++}}w.ambient[0]=n,w.ambient[1]=r,w.ambient[2]=a,w.directional.length=o,w.spot.length=c,w.rectArea.length=h,w.point.length=s,w.hemi.length=l,w.hash.stateID=w.id,w.hash.directionalLength=o,w.hash.pointLength=s,w.hash.spotLength=c,w.hash.rectAreaLength=h,w.hash.hemiLength=l,w.hash.shadowsLength=e.length}return{setup:t,state:w}}function Cc(){var e=new Rc,i=[],n=[],t;function r(){i.length=0,n.length=0}function a(t){i.push(t)}function o(t){n.push(t)}function s(t){e.setup(i,n,t)}return{init:r,state:{lightsArray:i,shadowsArray:n,lights:e},setupLights:s,pushLight:a,pushShadow:o}}function Pc(){var n={};function t(t,e){var i;return void 0===n[t.id]?(i=new Cc,n[t.id]={},n[t.id][e.id]=i):void 0===n[t.id][e.id]?(i=new Cc,n[t.id][e.id]=i):i=n[t.id][e.id],i}function e(){n={}}return{get:t,dispose:e}}function Oc(t){Do.call(this),this.type="MeshDepthMaterial",this.depthPacking=Pe,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function Ic(t){Do.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new ci,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Nc(x,g,t){for(var b=new Di,_=new oi,w=new ai,M=new ai(t,t),E=new ci,T=new ci,v=1,y=2,e=1+(v|y),S=new Array(e),A=new Array(e),L={},R={0:Ht,1:s,2:ut},C=[new ci(1,0,0),new ci(-1,0,0),new ci(0,0,1),new ci(0,0,-1),new ci(0,1,0),new ci(0,-1,0)],P=[new ci(0,1,0),new ci(0,1,0),new ci(0,1,0),new ci(0,1,0),new ci(0,0,1),new ci(0,0,-1)],O=[new Li,new Li,new Li,new Li,new Li,new Li],i=0;i!==e;++i){var n=0!=(i&v),r=0!=(i&y),a=new Oc({depthPacking:Oe,morphTargets:n,skinning:r});S[i]=a;var o=new Ic({morphTargets:n,skinning:r});A[i]=o}var I=this;function N(t,e,i,n,r,a){var o=t.geometry,s=null,c=S,h=t.customDepthMaterial;if(i&&(c=A,h=t.customDistanceMaterial),h)s=h;else{var l=!1;e.morphTargets&&(o&&o.isBufferGeometry?l=o.morphAttributes&&o.morphAttributes.position&&0<o.morphAttributes.position.length:o&&o.isGeometry&&(l=o.morphTargets&&0<o.morphTargets.length)),t.isSkinnedMesh&&!1===e.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var u=t.isSkinnedMesh&&e.skinning,p=0;l&&(p|=v),u&&(p|=y),s=c[p]}if(x.localClippingEnabled&&!0===e.clipShadows&&0!==e.clippingPlanes.length){var d=s.uuid,f=e.uuid,m=L[d];void 0===m&&(m={},L[d]=m);var g=m[f];void 0===g&&(g=s.clone(),m[f]=g),s=g}return s.visible=e.visible,s.wireframe=e.wireframe,s.side=null!=e.shadowSide?e.shadowSide:R[e.side],s.clipShadows=e.clipShadows,s.clippingPlanes=e.clippingPlanes,s.clipIntersection=e.clipIntersection,s.wireframeLinewidth=e.wireframeLinewidth,s.linewidth=e.linewidth,i&&s.isMeshDistanceMaterial&&(s.referencePosition.copy(n),s.nearDistance=r,s.farDistance=a),s}function D(t,e,i,n){if(!1!==t.visible){var r;if(t.layers.test(e.layers)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!t.frustumCulled||b.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld);var a=g.update(t),o=t.material;if(Array.isArray(o))for(var s=a.groups,c=0,h=s.length;c<h;c++){var l=s[c],u=o[l.materialIndex];if(u&&u.visible){var p=N(t,u,n,T,i.near,i.far);x.renderBufferDirect(i,null,a,p,t,l)}}else if(o.visible){var p=N(t,o,n,T,i.near,i.far);x.renderBufferDirect(i,null,a,p,t,null)}}for(var d=t.children,f=0,m=d.length;f<m;f++)D(d[f],e,i,n)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=U,this.render=function(t,e,i){if(!1!==I.enabled&&(!1!==I.autoUpdate||!1!==I.needsUpdate)&&0!==t.length){var n=x.context,r=x.state,a;r.disable(n.BLEND),r.buffers.color.setClear(1,1,1,1),r.buffers.depth.setTest(!0),r.setScissorTest(!1);for(var o=0,s=t.length;o<s;o++){var c=t[o],h=c.shadow,l=c&&c.isPointLight;if(void 0!==h){var u=h.camera;if(w.copy(h.mapSize),w.min(M),l){var p=w.x,d=w.y;O[0].set(2*p,d,p,d),O[1].set(0,d,p,d),O[2].set(3*p,d,p,d),O[3].set(p,d,p,d),O[4].set(3*p,0,p,d),O[5].set(p,0,p,d),w.x*=4,w.y*=2}if(null===h.map){var f={minFilter:J,magFilter:J,format:Xt};h.map=new Ri(w.x,w.y,f),h.map.texture.name=c.name+".shadowMap",u.updateProjectionMatrix()}h.isSpotLightShadow&&h.update(c);var m=h.map,g=h.matrix;T.setFromMatrixPosition(c.matrixWorld),u.position.copy(T),l?(a=6,g.makeTranslation(-T.x,-T.y,-T.z)):(a=1,E.setFromMatrixPosition(c.target.matrixWorld),u.lookAt(E),u.updateMatrixWorld(),g.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),g.multiply(u.projectionMatrix),g.multiply(u.matrixWorldInverse)),x.setRenderTarget(m),x.clear();for(var v=0;v<a;v++){if(l){E.copy(u.position),E.add(C[v]),u.up.copy(P[v]),u.lookAt(E),u.updateMatrixWorld();var y=O[v];r.viewport(y)}_.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),b.setFromMatrix(_),D(e,i,u,l)}}else console.warn("THREE.WebGLShadowMap:",c,"has no shadow.")}I.needsUpdate=!1}}}function Dc(l,n,c,r){function t(){var e=!1,a=new Li,i=null,o=new Li(0,0,0,0);return{setMask:function(t){i===t||e||(l.colorMask(t,t,t,t),i=t)},setLocked:function(t){e=t},setClear:function(t,e,i,n,r){!0===r&&(t*=n,e*=n,i*=n),a.set(t,e,i,n),!1===o.equals(a)&&(l.clearColor(t,e,i,n),o.copy(a))},reset:function(){e=!1,i=null,o.set(-1,0,0,0)}}}function e(){var e=!1,i=null,n=null,r=null;return{setTest:function(t){t?j(l.DEPTH_TEST):W(l.DEPTH_TEST)},setMask:function(t){i===t||e||(l.depthMask(t),i=t)},setFunc:function(t){if(n!==t){if(t)switch(t){case yt:l.depthFunc(l.NEVER);break;case xt:l.depthFunc(l.ALWAYS);break;case bt:l.depthFunc(l.LESS);break;case _t:l.depthFunc(l.LEQUAL);break;case wt:l.depthFunc(l.EQUAL);break;case Mt:l.depthFunc(l.GEQUAL);break;case Et:l.depthFunc(l.GREATER);break;case Tt:l.depthFunc(l.NOTEQUAL);break;default:l.depthFunc(l.LEQUAL)}else l.depthFunc(l.LEQUAL);n=t}},setLocked:function(t){e=t},setClear:function(t){r!==t&&(l.clearDepth(t),r=t)},reset:function(){e=!1,r=n=i=null}}}function i(){var e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null;return{setTest:function(t){t?j(l.STENCIL_TEST):W(l.STENCIL_TEST)},setMask:function(t){i===t||e||(l.stencilMask(t),i=t)},setFunc:function(t,e,i){n===t&&r===e&&a===i||(l.stencilFunc(t,e,i),n=t,r=e,a=i)},setOp:function(t,e,i){o===t&&s===e&&c===i||(l.stencilOp(t,e,i),o=t,s=e,c=i)},setLocked:function(t){e=t},setClear:function(t){h!==t&&(l.clearStencil(t),h=t)},reset:function(){e=!1,h=c=s=o=a=r=n=i=null}}}var a=new t,o=new e,s=new i,h=l.getParameter(l.MAX_VERTEX_ATTRIBS),u=new Uint8Array(h),p=new Uint8Array(h),d=new Uint8Array(h),f={},m=null,g=null,v=null,y=null,x=null,b=null,_=null,w=null,M=null,E=!1,T=null,S=null,A=null,L=null,R=null,C=l.getParameter(l.MAX_COMBINED_TEXTURE_IMAGE_UNITS),P=!1,O=0,I=l.getParameter(l.VERSION);-1!==I.indexOf("WebGL")?(O=parseFloat(/^WebGL\ ([0-9])/.exec(I)[1]),P=1<=O):-1!==I.indexOf("OpenGL ES")&&(O=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(I)[1]),P=2<=O);var N=null,D={},U=new Li,B=new Li;function F(t,e,i){var n=new Uint8Array(4),r=l.createTexture();l.bindTexture(t,r),l.texParameteri(t,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(t,l.TEXTURE_MAG_FILTER,l.NEAREST);for(var a=0;a<i;a++)l.texImage2D(e+a,0,l.RGBA,1,1,0,l.RGBA,l.UNSIGNED_BYTE,n);return r}var z={};function G(){for(var t=0,e=u.length;t<e;t++)u[t]=0}function H(t){V(t,0)}function V(t,e){var i;(u[t]=1,0===p[t]&&(l.enableVertexAttribArray(t),p[t]=1),d[t]!==e)&&((r.isWebGL2?l:n.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](t,e),d[t]=e)}function k(){for(var t=0,e=p.length;t!==e;++t)p[t]!==u[t]&&(l.disableVertexAttribArray(t),p[t]=0)}function j(t){!0!==f[t]&&(l.enable(t),f[t]=!0)}function W(t){!1!==f[t]&&(l.disable(t),f[t]=!1)}function X(){if(null===m&&(m=[],n.get("WEBGL_compressed_texture_pvrtc")||n.get("WEBGL_compressed_texture_s3tc")||n.get("WEBGL_compressed_texture_etc1")||n.get("WEBGL_compressed_texture_astc")))for(var t=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),e=0;e<t.length;e++)m.push(t[e]);return m}function q(t){return g!==t&&(l.useProgram(t),g=t,!0)}function Y(t,e,i,n,r,a,o,s){if(t!==pt?j(l.BLEND):W(l.BLEND),t!==vt){if(t!==v||s!==E)switch(t){case ft:s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ONE,l.ONE,l.ONE,l.ONE)):(l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE));break;case mt:s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ZERO,l.ZERO,l.ONE_MINUS_SRC_COLOR,l.ONE_MINUS_SRC_ALPHA)):(l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR));break;case gt:s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ZERO,l.SRC_COLOR,l.ZERO,l.SRC_ALPHA)):(l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR));break;default:s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)):(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA))}M=w=_=b=x=y=null}else r=r||e,a=a||i,o=o||n,e===y&&r===_||(l.blendEquationSeparate(c.convert(e),c.convert(r)),y=e,_=r),i===x&&n===b&&a===w&&o===M||(l.blendFuncSeparate(c.convert(i),c.convert(n),c.convert(a),c.convert(o)),x=i,b=n,w=a,M=o);v=t,E=s}function J(t,e){t.side===ut?W(l.CULL_FACE):j(l.CULL_FACE);var i=t.side===Ht;e&&(i=!i),Z(i),t.blending===dt&&!1===t.transparent?Y(pt):Y(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),a.setMask(t.colorWrite),$(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function Z(t){T!==t&&(t?l.frontFace(l.CW):l.frontFace(l.CCW),T=t)}function Q(t){t!==ct?(j(l.CULL_FACE),t!==S&&(t===ht?l.cullFace(l.BACK):t===lt?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK))):W(l.CULL_FACE),S=t}function K(t){t!==A&&(P&&l.lineWidth(t),A=t)}function $(t,e,i){t?(j(l.POLYGON_OFFSET_FILL),L===e&&R===i||(l.polygonOffset(e,i),L=e,R=i)):W(l.POLYGON_OFFSET_FILL)}function tt(t){t?j(l.SCISSOR_TEST):W(l.SCISSOR_TEST)}function et(t){void 0===t&&(t=l.TEXTURE0+C-1),N!==t&&(l.activeTexture(t),N=t)}function it(t,e){null===N&&et();var i=D[N];void 0===i&&(i={type:void 0,texture:void 0},D[N]=i),i.type===t&&i.texture===e||(l.bindTexture(t,e||z[t]),i.type=t,i.texture=e)}function nt(){try{l.compressedTexImage2D.apply(l,arguments)}catch(t){console.error("THREE.WebGLState:",t)}}function rt(){try{l.texImage2D.apply(l,arguments)}catch(t){console.error("THREE.WebGLState:",t)}}function at(t){!1===U.equals(t)&&(l.scissor(t.x,t.y,t.z,t.w),U.copy(t))}function ot(t){!1===B.equals(t)&&(l.viewport(t.x,t.y,t.z,t.w),B.copy(t))}function st(){for(var t=0;t<p.length;t++)1===p[t]&&(l.disableVertexAttribArray(t),p[t]=0);f={},D={},S=T=v=g=N=m=null,a.reset(),o.reset(),s.reset()}return z[l.TEXTURE_2D]=F(l.TEXTURE_2D,l.TEXTURE_2D,1),z[l.TEXTURE_CUBE_MAP]=F(l.TEXTURE_CUBE_MAP,l.TEXTURE_CUBE_MAP_POSITIVE_X,6),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),j(l.DEPTH_TEST),o.setFunc(_t),Z(!1),Q(ht),j(l.CULL_FACE),j(l.BLEND),Y(dt),{buffers:{color:a,depth:o,stencil:s},initAttributes:G,enableAttribute:H,enableAttributeAndDivisor:V,disableUnusedAttributes:k,enable:j,disable:W,getCompressedTextureFormats:X,useProgram:q,setBlending:Y,setMaterial:J,setFlipSided:Z,setCullFace:Q,setLineWidth:K,setPolygonOffset:$,setScissorTest:tt,activeTexture:et,bindTexture:it,compressedTexImage2D:nt,texImage2D:rt,scissor:at,viewport:ot,reset:st}}function Uc(g,r,v,y,x,b,_){var n={},i;function w(t,e){if(t.width>e||t.height>e){if("data"in t)return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+t.width+"x"+t.height+").");var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),r;return n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i),n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height),n}return t}function M(t){return De.isPowerOfTwo(t.width)&&De.isPowerOfTwo(t.height)}function p(t){var e;return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageBitmap?(void 0===i&&(i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),i.width=De.floorPowerOfTwo(t.width),i.height=De.floorPowerOfTwo(t.height),i.getContext("2d").drawImage(t,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height),i):t}function d(t){return!x.isWebGL2&&(t.wrapS!==q||t.wrapT!==q||t.minFilter!==J&&t.minFilter!==K)}function E(t,e){return t.generateMipmaps&&e&&t.minFilter!==J&&t.minFilter!==K}function T(t,e,i,n){var r;g.generateMipmap(t),y.get(e).__maxMipLevel=Math.log(Math.max(i,n))*Math.LOG2E}function S(t,e){if(!x.isWebGL2)return t;if(t===g.RGB){if(e===g.FLOAT)return g.RGB32F;if(e===g.HALF_FLOAT)return g.RGB16F;if(e===g.UNSIGNED_BYTE)return g.RGB8}if(t===g.RGBA){if(e===g.FLOAT)return g.RGBA32F;if(e===g.HALF_FLOAT)return g.RGBA16F;if(e===g.UNSIGNED_BYTE)return g.RGBA8}return t}function a(t){return t===J||t===Z||t===Q?g.NEAREST:g.LINEAR}function A(t){var e=t.target;e.removeEventListener("dispose",A),s(e),e.isVideoTexture&&delete n[e.id],_.memory.textures--}function o(t){var e=t.target;e.removeEventListener("dispose",o),c(e),_.memory.textures--}function s(t){var e=y.get(t);if(t.image&&e.__image__webglTextureCube)g.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)return;g.deleteTexture(e.__webglTexture)}y.remove(t)}function c(t){var e=y.get(t),i=y.get(t.texture);if(t){if(void 0!==i.__webglTexture&&g.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var n=0;n<6;n++)g.deleteFramebuffer(e.__webglFramebuffer[n]),e.__webglDepthbuffer&&g.deleteRenderbuffer(e.__webglDepthbuffer[n]);else g.deleteFramebuffer(e.__webglFramebuffer),e.__webglDepthbuffer&&g.deleteRenderbuffer(e.__webglDepthbuffer);y.remove(t.texture),y.remove(t)}}function h(t,e){var i=y.get(t);if(t.isVideoTexture&&O(t),0<t.version&&i.__version!==t.version){var n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void l(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_2D,i.__webglTexture)}function t(t,e){var i=y.get(t);if(6===t.image.length)if(i.__image__webglTextureCube||console.log("no __image__webglTextureCube"),0<t.version&&i.__version!==t.version){i.__image__webglTextureCube||(t.addEventListener("dispose",A),i.__image__webglTextureCube=g.createTexture(),_.memory.textures++),v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_CUBE_MAP,i.__image__webglTextureCube),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var n=t&&t.isCompressedTexture,r=t.image[0]&&t.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=n||r?r?t.image[o].image:t.image[o]:w(t.image[o],x.maxCubemapSize);var s=a[0],c=M(s),h=b.convert(t.format),l=b.convert(t.type),u=S(h,l);L(g.TEXTURE_CUBE_MAP,t,c);for(var o=0;o<6;o++)if(n)for(var p,d=a[o].mipmaps,f=0,m=d.length;f<m;f++)p=d[f],t.format!==Xt&&t.format!==Rt?-1<v.getCompressedTextureFormats().indexOf(h)?v.compressedTexImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,u,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):v.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,u,p.width,p.height,0,h,l,p.data);else r?v.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,u,a[o].width,a[o].height,0,h,l,a[o].data):v.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,u,h,l,a[o]);i.__maxMipLevel=n?d.length-1:0,E(t,c)&&T(g.TEXTURE_CUBE_MAP,t,s.width,s.height),i.__version=t.version,t.onUpdate&&t.onUpdate(t)}else v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_CUBE_MAP,i.__image__webglTextureCube)}function e(t,e){v.activeTexture(g.TEXTURE0+e),v.bindTexture(g.TEXTURE_CUBE_MAP,y.get(t).__webglTexture)}function L(t,e,i){var n;if(i?(g.texParameteri(t,g.TEXTURE_WRAP_S,b.convert(e.wrapS)),g.texParameteri(t,g.TEXTURE_WRAP_T,b.convert(e.wrapT)),g.texParameteri(t,g.TEXTURE_MAG_FILTER,b.convert(e.magFilter)),g.texParameteri(t,g.TEXTURE_MIN_FILTER,b.convert(e.minFilter))):(g.texParameteri(t,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(t,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),e.wrapS===q&&e.wrapT===q||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),g.texParameteri(t,g.TEXTURE_MAG_FILTER,a(e.magFilter)),g.texParameteri(t,g.TEXTURE_MIN_FILTER,a(e.minFilter)),e.minFilter!==J&&e.minFilter!==K&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),n=r.get("EXT_texture_filter_anisotropic")){if(e.type===jt&&null===r.get("OES_texture_float_linear"))return;if(e.type===Wt&&null===(x.isWebGL2||r.get("OES_texture_half_float_linear")))return;(1<e.anisotropy||y.get(e).__currentAnisotropy)&&(g.texParameterf(t,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,x.getMaxAnisotropy())),y.get(e).__currentAnisotropy=e.anisotropy)}}function l(t,e,i){void 0===t.__webglInit&&(t.__webglInit=!0,e.addEventListener("dispose",A),t.__webglTexture=g.createTexture(),_.memory.textures++),v.activeTexture(g.TEXTURE0+i),v.bindTexture(g.TEXTURE_2D,t.__webglTexture),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,e.flipY),g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),g.pixelStorei(g.UNPACK_ALIGNMENT,e.unpackAlignment);var n=w(e.image,x.maxTextureSize);d(e)&&!1===M(n)&&(n=p(n));var r=M(n),a=b.convert(e.format),o=b.convert(e.type),s=S(a,o);L(g.TEXTURE_2D,e,r);var c,h=e.mipmaps;if(e.isDepthTexture){if(s=g.DEPTH_COMPONENT,e.type===jt){if(!x.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");s=g.DEPTH_COMPONENT32F}else x.isWebGL2&&(s=g.DEPTH_COMPONENT16);e.format===It&&s===g.DEPTH_COMPONENT&&e.type!==nt&&e.type!==at&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),e.type=nt,o=b.convert(e.type)),e.format===Nt&&(s=g.DEPTH_STENCIL,e.type!==At&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),e.type=At,o=b.convert(e.type))),v.texImage2D(g.TEXTURE_2D,0,s,n.width,n.height,0,a,o,null)}else if(e.isDataTexture)if(0<h.length&&r){for(var l=0,u=h.length;l<u;l++)c=h[l],v.texImage2D(g.TEXTURE_2D,l,s,c.width,c.height,0,a,o,c.data);e.generateMipmaps=!1,t.__maxMipLevel=h.length-1}else v.texImage2D(g.TEXTURE_2D,0,s,n.width,n.height,0,a,o,n.data),t.__maxMipLevel=0;else if(e.isCompressedTexture){for(var l=0,u=h.length;l<u;l++)c=h[l],e.format!==Xt&&e.format!==Rt?-1<v.getCompressedTextureFormats().indexOf(a)?v.compressedTexImage2D(g.TEXTURE_2D,l,s,c.width,c.height,0,c.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v.texImage2D(g.TEXTURE_2D,l,s,c.width,c.height,0,a,o,c.data);t.__maxMipLevel=h.length-1}else if(0<h.length&&r){for(var l=0,u=h.length;l<u;l++)c=h[l],v.texImage2D(g.TEXTURE_2D,l,s,a,o,c);e.generateMipmaps=!1,t.__maxMipLevel=h.length-1}else v.texImage2D(g.TEXTURE_2D,0,s,a,o,n),t.__maxMipLevel=0;E(e,r)&&T(g.TEXTURE_2D,e,n.width,n.height),t.__version=e.version,e.onUpdate&&e.onUpdate(e)}function u(t,e,i,n){var r=b.convert(e.texture.format),a=b.convert(e.texture.type),o=S(r,a);v.texImage2D(n,0,o,e.width,e.height,0,r,a,null),g.bindFramebuffer(g.FRAMEBUFFER,t),g.framebufferTexture2D(g.FRAMEBUFFER,i,n,y.get(e.texture).__webglTexture,0),g.bindFramebuffer(g.FRAMEBUFFER,null)}function f(t,e){g.bindRenderbuffer(g.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,e.width,e.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,e.width,e.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,t)):g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,e.width,e.height),g.bindRenderbuffer(g.RENDERBUFFER,null)}function m(t,e){var i;if(e&&e.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(g.bindFramebuffer(g.FRAMEBUFFER,t),!e.depthTexture||!e.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");y.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),h(e.depthTexture,0);var n=y.get(e.depthTexture).__webglTexture;if(e.depthTexture.format===It)g.framebufferTexture2D(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.TEXTURE_2D,n,0);else{if(e.depthTexture.format!==Nt)throw new Error("Unknown depthTexture format");g.framebufferTexture2D(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.TEXTURE_2D,n,0)}}function R(t){var e=y.get(t),i=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");m(e.__webglFramebuffer,t)}else if(i){e.__webglDepthbuffer=[];for(var n=0;n<6;n++)g.bindFramebuffer(g.FRAMEBUFFER,e.__webglFramebuffer[n]),e.__webglDepthbuffer[n]=g.createRenderbuffer(),f(e.__webglDepthbuffer[n],t)}else g.bindFramebuffer(g.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=g.createRenderbuffer(),f(e.__webglDepthbuffer,t);g.bindFramebuffer(g.FRAMEBUFFER,null)}function C(t){var e=y.get(t),i=y.get(t.texture);t.addEventListener("dispose",o),i.__webglTexture=g.createTexture(),_.memory.textures++;var n=!0===t.isWebGLRenderTargetCube,r=M(t);if(n){e.__webglFramebuffer=[];for(var a=0;a<6;a++)e.__webglFramebuffer[a]=g.createFramebuffer()}else e.__webglFramebuffer=g.createFramebuffer();if(n){v.bindTexture(g.TEXTURE_CUBE_MAP,i.__webglTexture),L(g.TEXTURE_CUBE_MAP,t.texture,r);for(var a=0;a<6;a++)u(e.__webglFramebuffer[a],t,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+a);E(t.texture,r)&&T(g.TEXTURE_CUBE_MAP,t.texture,t.width,t.height),v.bindTexture(g.TEXTURE_CUBE_MAP,null)}else v.bindTexture(g.TEXTURE_2D,i.__webglTexture),L(g.TEXTURE_2D,t.texture,r),u(e.__webglFramebuffer,t,g.COLOR_ATTACHMENT0,g.TEXTURE_2D),E(t.texture,r)&&T(g.TEXTURE_2D,t.texture,t.width,t.height),v.bindTexture(g.TEXTURE_2D,null);t.depthBuffer&&R(t)}function P(t){var e=t.texture,i;if(E(e,M(t))){var n=t.isWebGLRenderTargetCube?g.TEXTURE_CUBE_MAP:g.TEXTURE_2D,r=y.get(e).__webglTexture;v.bindTexture(n,r),T(n,e,t.width,t.height),v.bindTexture(n,null)}}function O(t){var e=t.id,i=_.render.frame;n[e]!==i&&(n[e]=i,t.update())}this.setTexture2D=h,this.setTextureCube=t,this.setTextureCubeDynamic=e,this.setupRenderTarget=C,this.updateRenderTargetMipmap=P}function Bc(i,n,r){function t(t){var e;if(t===I)return i.REPEAT;if(t===q)return i.CLAMP_TO_EDGE;if(t===Y)return i.MIRRORED_REPEAT;if(t===J)return i.NEAREST;if(t===Z)return i.NEAREST_MIPMAP_NEAREST;if(t===Q)return i.NEAREST_MIPMAP_LINEAR;if(t===K)return i.LINEAR;if(t===$)return i.LINEAR_MIPMAP_NEAREST;if(t===tt)return i.LINEAR_MIPMAP_LINEAR;if(t===kt)return i.UNSIGNED_BYTE;if(t===ot)return i.UNSIGNED_SHORT_4_4_4_4;if(t===st)return i.UNSIGNED_SHORT_5_5_5_1;if(t===St)return i.UNSIGNED_SHORT_5_6_5;if(t===et)return i.BYTE;if(t===it)return i.SHORT;if(t===nt)return i.UNSIGNED_SHORT;if(t===rt)return i.INT;if(t===at)return i.UNSIGNED_INT;if(t===jt)return i.FLOAT;if(t===Wt){if(r.isWebGL2)return i.HALF_FLOAT;if(null!==(e=n.get("OES_texture_half_float")))return e.HALF_FLOAT_OES}if(t===Lt)return i.ALPHA;if(t===Rt)return i.RGB;if(t===Xt)return i.RGBA;if(t===Ct)return i.LUMINANCE;if(t===Pt)return i.LUMINANCE_ALPHA;if(t===It)return i.DEPTH_COMPONENT;if(t===Nt)return i.DEPTH_STENCIL;if(t===p)return i.FUNC_ADD;if(t===d)return i.FUNC_SUBTRACT;if(t===f)return i.FUNC_REVERSE_SUBTRACT;if(t===y)return i.ZERO;if(t===x)return i.ONE;if(t===b)return i.SRC_COLOR;if(t===_)return i.ONE_MINUS_SRC_COLOR;if(t===w)return i.SRC_ALPHA;if(t===M)return i.ONE_MINUS_SRC_ALPHA;if(t===E)return i.DST_ALPHA;if(t===T)return i.ONE_MINUS_DST_ALPHA;if(t===S)return i.DST_COLOR;if(t===A)return i.ONE_MINUS_DST_COLOR;if(t===L)return i.SRC_ALPHA_SATURATE;if((t===Dt||t===Ut||t===Bt||t===Ft)&&null!==(e=n.get("WEBGL_compressed_texture_s3tc"))){if(t===Dt)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Ut)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Bt)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Ft)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===zt||t===qt||t===Yt||t===Jt)&&null!==(e=n.get("WEBGL_compressed_texture_pvrtc"))){if(t===zt)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===qt)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Yt)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Jt)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===Zt&&null!==(e=n.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===Qt||t===Kt||t===$t||t===te||t===ee||t===ie||t===ne||t===re||t===ae||t===oe||t===se||t===ce||t===he||t===le)&&null!==(e=n.get("WEBGL_compressed_texture_astc")))return t;if(t===m||t===g){if(r.isWebGL2){if(t===m)return i.MIN;if(t===g)return i.MAX}if(null!==(e=n.get("EXT_blend_minmax"))){if(t===m)return e.MIN_EXT;if(t===g)return e.MAX_EXT}}if(t===At){if(r.isWebGL2)return i.UNSIGNED_INT_24_8;if(null!==(e=n.get("WEBGL_depth_texture")))return e.UNSIGNED_INT_24_8_WEBGL}return 0}return{convert:t}}function Fc(){wa.call(this),this.type="Group"}function zc(t,e,i,n){Ma.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Gc(t){zc.call(this),this.cameras=t||[]}function Hc(n){var s=this,c=null,h=null,l=null,a=[],u=new oi,p=new oi;"undefined"!=typeof window&&"VRFrameData"in window&&(h=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",t,!1));var d=new oi,f=new si,m=new ci,g=new zc;g.bounds=new Li(0,0,.5,1),g.layers.enable(1);var v=new zc;v.bounds=new Li(.5,0,.5,1),v.layers.enable(2);var y=new Gc([g,v]),r,o;function x(){return null!==c&&!0===c.isPresenting}function t(){if(x()){var t=c.getEyeParameters("left"),e=t.renderWidth,i=t.renderHeight;o=n.getPixelRatio(),r=n.getSize(),n.setDrawingBufferSize(2*e,i,1),M.start()}else s.enabled&&(n.setDrawingBufferSize(r.width,r.height,o),M.stop())}y.layers.enable(1),y.layers.enable(2);var b=[];function _(t){for(var e=navigator.getGamepads&&navigator.getGamepads(),i=0,n=0,r=e.length;i<r;i++){var a=e[i];if(a&&("Daydream Controller"===a.id||"Gear VR Controller"===a.id||"Oculus Go Controller"===a.id||"OpenVR Gamepad"===a.id||a.id.startsWith("Oculus Touch")||a.id.startsWith("Spatial Controller"))){if(n===t)return a;n++}}}function w(){for(var t=0;t<a.length;t++){var e=a[t],i=_(t);if(void 0!==i&&void 0!==i.pose){if(null===i.pose)return;var n=i.pose;!1===n.hasPosition&&e.position.set(.2,-.6,-.05),null!==n.position&&e.position.fromArray(n.position),null!==n.orientation&&e.quaternion.fromArray(n.orientation),e.matrix.compose(e.position,e.quaternion,e.scale),e.matrix.premultiply(u),e.matrix.decompose(e.position,e.quaternion,e.scale),e.matrixWorldNeedsUpdate=!0,e.visible=!0;var r="Daydream Controller"===i.id?0:1;b[t]!==i.buttons[r].pressed&&(b[t]=i.buttons[r].pressed,!0===b[t]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"})))}else e.visible=!1}}this.enabled=!1,this.userHeight=1.6,this.getController=function(t){var e=a[t];return void 0===e&&((e=new Fc).matrixAutoUpdate=!1,e.visible=!1,a[t]=e),e},this.getDevice=function(){return c},this.setDevice=function(t){void 0!==t&&(c=t),M.setContext(t)},this.setPoseTarget=function(t){void 0!==t&&(l=t)},this.getCamera=function(t){if(null===c)return t.position.set(0,s.userHeight,0),t;c.depthNear=t.near,c.depthFar=t.far,c.getFrameData(h);var e=c.stageParameters;e?u.fromArray(e.sittingToStandingTransform):u.makeTranslation(0,s.userHeight,0);var i=h.pose,n=null!==l?l:t;if(n.matrix.copy(u),n.matrix.decompose(n.position,n.quaternion,n.scale),null!==i.orientation&&(f.fromArray(i.orientation),n.quaternion.multiply(f)),null!==i.position&&(f.setFromRotationMatrix(u),m.fromArray(i.position),m.applyQuaternion(f),n.position.add(m)),n.updateMatrixWorld(),!1===c.isPresenting)return t;g.near=t.near,v.near=t.near,g.far=t.far,v.far=t.far,y.matrixWorld.copy(t.matrixWorld),y.matrixWorldInverse.copy(t.matrixWorldInverse),g.matrixWorldInverse.fromArray(h.leftViewMatrix),v.matrixWorldInverse.fromArray(h.rightViewMatrix),p.getInverse(u),g.matrixWorldInverse.multiply(p),v.matrixWorldInverse.multiply(p);var r=n.parent;null!==r&&(d.getInverse(r.matrixWorld),g.matrixWorldInverse.multiply(d),v.matrixWorldInverse.multiply(d)),g.matrixWorld.getInverse(g.matrixWorldInverse),v.matrixWorld.getInverse(v.matrixWorldInverse),g.projectionMatrix.fromArray(h.leftProjectionMatrix),v.projectionMatrix.fromArray(h.rightProjectionMatrix),y.projectionMatrix.copy(g.projectionMatrix);var a=c.getLayers();if(a.length){var o=a[0];null!==o.leftBounds&&4===o.leftBounds.length&&g.bounds.fromArray(o.leftBounds),null!==o.rightBounds&&4===o.rightBounds.length&&v.bounds.fromArray(o.rightBounds)}return w(),y},this.getStandingMatrix=function(){return u},this.isPresenting=x;var M=new $r;this.setAnimationLoop=function(t){M.setAnimationLoop(t)},this.submitFrame=function(){x()&&c.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",t)}}function Vc(i){var n=i.context,e=null,p=null,d=null,f=null,m=[],g=[];function o(){return null!==p&&null!==d}var t=new zc;t.layers.enable(1),t.viewport=new Li;var r=new zc;r.layers.enable(2),r.viewport=new Li;var v=new Gc([t,r]);function a(t){var e=m[g.indexOf(t.inputSource)];e&&e.dispatchEvent({type:t.type})}function s(){i.setFramebuffer(null),l.stop()}function c(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)}v.layers.enable(1),v.layers.enable(2),this.enabled=!1,this.getController=function(t){var e=m[t];return void 0===e&&((e=new Fc).matrixAutoUpdate=!1,e.visible=!1,m[t]=e),e},this.getDevice=function(){return e},this.setDevice=function(t){void 0!==t&&(e=t),t instanceof XRDevice&&n.setCompatibleXRDevice(t)},this.setSession=function(t,e){null!==(p=t)&&(p.addEventListener("select",a),p.addEventListener("selectstart",a),p.addEventListener("selectend",a),p.addEventListener("end",s),p.baseLayer=new XRWebGLLayer(p,n),p.requestFrameOfReference(e.frameOfReferenceType).then(function(t){d=t,i.setFramebuffer(p.baseLayer.framebuffer),l.setContext(p),l.start()}),g=p.getInputSources(),p.addEventListener("inputsourceschange",function(){g=p.getInputSources(),console.log(g)}))},this.getCamera=function(t){if(o()){var e=t.parent,i=v.cameras;c(v,e);for(var n=0;n<i.length;n++)c(i[n],e);t.matrixWorld.copy(v.matrixWorld);for(var r=t.children,n=0,a=r.length;n<a;n++)r[n].updateMatrixWorld(!0);return v}return t},this.isPresenting=o;var y=null;function h(t,e){if(null!==(f=e.getDevicePose(d)))for(var i=p.baseLayer,n=e.views,r=0;r<n.length;r++){var a=n[r],o=i.getViewport(a),s=f.getViewMatrix(a),c=v.cameras[r];c.matrix.fromArray(s).getInverse(c.matrix),c.projectionMatrix.fromArray(a.projectionMatrix),c.viewport.set(o.x,o.y,o.width,o.height),0===r&&(v.matrix.copy(c.matrix),v.projectionMatrix.copy(c.projectionMatrix))}for(var r=0;r<m.length;r++){var h=m[r],l=g[r];if(l){var u=e.getInputPose(l,d);if(null!==u){h.matrix.elements=u.pointerMatrix,h.matrix.decompose(h.position,h.rotation,h.scale),h.visible=!0;continue}}h.visible=!1}y&&y(t)}var l=new $r;l.setAnimationLoop(h),this.setAnimationLoop=function(t){y=t},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new THREE.Matrix4},this.submitFrame=function(){}}function kc(t){console.log("THREE.WebGLRenderer",Gt);var r=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,n=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",p=null,_=null;this.domElement=r,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Vt,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var w=this,l=!1,u=null,d=null,f=null,M=-1,E={geometry:null,program:null,wireframe:!1},T=null,S=null,b=new Li,m=new Li,g=null,A=0,L=r.width,R=r.height,C=1,v=new Li(0,0,L,R),y=new Li(0,0,L,R),x=!1,P=new Di,O=new jo,I=!1,N=!1,D=new oi,U=new ci,B,F,z,G,H,V,k,j,W,X,q,Y,J,Z,Q,K,$,tt;function et(){return null===d?C:1}try{var it={alpha:i,depth:n,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:h};if(r.addEventListener("webglcontextlost",ot,!1),r.addEventListener("webglcontextrestored",st,!1),null===(B=e||r.getContext("webgl",it)||r.getContext("experimental-webgl",it)))throw null!==r.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===B.getShaderPrecisionFormat&&(B.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){console.error("THREE.WebGLRenderer: "+t.message)}function nt(){F=new Wo(B),(z=new ko(B,F,t)).isWebGL2||(F.get("WEBGL_depth_texture"),F.get("OES_texture_float"),F.get("OES_texture_half_float"),F.get("OES_texture_half_float_linear"),F.get("OES_standard_derivatives"),F.get("OES_element_index_uint"),F.get("ANGLE_instanced_arrays")),F.get("OES_texture_float_linear"),tt=new Bc(B,F,z),(G=new Dc(B,F,tt,z)).scissor(m.copy(y).multiplyScalar(C)),G.viewport(b.copy(v).multiplyScalar(C)),H=new Yo(B),V=new oc,k=new Uc(B,F,G,V,z,tt,H),j=new ta(B),W=new Xo(B,j,H),X=new Qo(W,H),Q=new Zo(B),q=new ac(w,F,z),Y=new lc,J=new Pc,Z=new Ho(w,G,X,s),K=new Vo(B,F,H,z),$=new qo(B,F,H,z),H.programs=q.programs,w.context=B,w.capabilities=z,w.extensions=F,w.properties=V,w.renderLists=Y,w.state=G,w.info=H}nt();var rt="xr"in navigator?new Vc(w):new Hc(w);this.vr=rt;var at=new Nc(w,X,z.maxTextureSize);function ot(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),l=!0}function st(){console.log("THREE.WebGLRenderer: Context Restored."),l=!1,nt()}function ct(t){var e=t.target;e.removeEventListener("dispose",ct),ht(e)}function ht(t){lt(t),V.remove(t)}function lt(t){var e=V.get(t).program;(t.program=void 0)!==e&&q.releaseProgram(e)}function ut(t,e){t.render(function(t){w.renderBufferImmediate(t,e)})}function pt(t,e,i){if(i&&i.isInstancedBufferGeometry&!z.isWebGL2&&null===F.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{G.initAttributes();var n=i.attributes,r=e.getAttributes(),a=t.defaultAttributeValues;for(var o in r){var s=r[o];if(0<=s){var c=n[o];if(void 0!==c){var h=c.normalized,l=c.itemSize,u=j.get(c);if(void 0===u)continue;var p=u.buffer,d=u.type,f=u.bytesPerElement;if(c.isInterleavedBufferAttribute){var m=c.data,g=m.stride,v=c.offset;m&&m.isInstancedInterleavedBuffer?(G.enableAttributeAndDivisor(s,m.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=m.meshPerAttribute*m.count)):G.enableAttribute(s),B.bindBuffer(B.ARRAY_BUFFER,p),B.vertexAttribPointer(s,l,d,h,g*f,v*f)}else c.isInstancedBufferAttribute?(G.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=c.meshPerAttribute*c.count)):G.enableAttribute(s),B.bindBuffer(B.ARRAY_BUFFER,p),B.vertexAttribPointer(s,l,d,h,0,0)}else if(void 0!==a){var y=a[o];if(void 0!==y)switch(y.length){case 2:B.vertexAttrib2fv(s,y);break;case 3:B.vertexAttrib3fv(s,y);break;case 4:B.vertexAttrib4fv(s,y);break;default:B.vertexAttrib1fv(s,y)}}}}G.disableUnusedAttributes()}}this.shadowMap=at,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){var t=F.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=F.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(t){void 0!==t&&(C=t,this.setSize(L,R,!1))},this.getSize=function(){return{width:L,height:R}},this.setSize=function(t,e,i,n){null!=n&&(C=n),rt.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=t,R=e,r.width=t*C,r.height=e*C,!1!==i&&(r.style.width=t+"px",r.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(){return{width:L*C,height:R*C}},this.setDrawingBufferSize=function(t,e,i){L=t,R=e,C=i,r.width=t*i,r.height=e*i,this.setViewport(0,0,t,e)},this.getCurrentViewport=function(){return b},this.setViewport=function(t,e,i,n){v.set(t,R-e-n,i,n),G.viewport(b.copy(v).multiplyScalar(C))},this.setScissor=function(t,e,i,n){y.set(t,R-e-n,i,n),G.scissor(m.copy(y).multiplyScalar(C))},this.setScissorTest=function(t){G.setScissorTest(x=t)},this.getClearColor=function(){return Z.getClearColor()},this.setClearColor=function(){Z.setClearColor.apply(Z,arguments)},this.getClearAlpha=function(){return Z.getClearAlpha()},this.setClearAlpha=function(){Z.setClearAlpha.apply(Z,arguments)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=B.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=B.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=B.STENCIL_BUFFER_BIT),B.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.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.dispose=function(){r.removeEventListener("webglcontextlost",ot,!1),r.removeEventListener("webglcontextrestored",st,!1),Y.dispose(),J.dispose(),V.dispose(),X.dispose(),rt.dispose(),mt.stop()},this.renderBufferImmediate=function(t,e){G.initAttributes();var i=V.get(t);t.hasPositions&&!i.position&&(i.position=B.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=B.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=B.createBuffer()),t.hasColors&&!i.color&&(i.color=B.createBuffer());var n=e.getAttributes();t.hasPositions&&(B.bindBuffer(B.ARRAY_BUFFER,i.position),B.bufferData(B.ARRAY_BUFFER,t.positionArray,B.DYNAMIC_DRAW),G.enableAttribute(n.position),B.vertexAttribPointer(n.position,3,B.FLOAT,!1,0,0)),t.hasNormals&&(B.bindBuffer(B.ARRAY_BUFFER,i.normal),B.bufferData(B.ARRAY_BUFFER,t.normalArray,B.DYNAMIC_DRAW),G.enableAttribute(n.normal),B.vertexAttribPointer(n.normal,3,B.FLOAT,!1,0,0)),t.hasUvs&&(B.bindBuffer(B.ARRAY_BUFFER,i.uv),B.bufferData(B.ARRAY_BUFFER,t.uvArray,B.DYNAMIC_DRAW),G.enableAttribute(n.uv),B.vertexAttribPointer(n.uv,2,B.FLOAT,!1,0,0)),t.hasColors&&(B.bindBuffer(B.ARRAY_BUFFER,i.color),B.bufferData(B.ARRAY_BUFFER,t.colorArray,B.DYNAMIC_DRAW),G.enableAttribute(n.color),B.vertexAttribPointer(n.color,3,B.FLOAT,!1,0,0)),G.disableUnusedAttributes(),B.drawArrays(B.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,a){var o=r.isMesh&&r.normalMatrix.determinant()<0;G.setMaterial(n,o);var s=Mt(t,e,n,r),c=!1;E.geometry===i.id&&E.program===s.id&&E.wireframe===(!0===n.wireframe)||(E.geometry=i.id,E.program=s.id,E.wireframe=!0===n.wireframe,c=!0),r.morphTargetInfluences&&(Q.update(r,i,n,s),c=!0);var h=i.index,l=i.attributes.position,u=1,p;!0===n.wireframe&&(h=W.getWireframeAttribute(i),u=2);var d=K;null!==h&&(p=j.get(h),(d=$).setIndex(p)),c&&(pt(n,s,i),null!==h&&B.bindBuffer(B.ELEMENT_ARRAY_BUFFER,p.buffer));var f=1/0;null!==h?f=h.count:void 0!==l&&(f=l.count);var m=i.drawRange.start*u,g=i.drawRange.count*u,v=null!==a?a.start*u:0,y=null!==a?a.count*u:1/0,x=Math.max(m,v),b=Math.min(f,m+g,v+y)-1,_=Math.max(0,b-x+1);if(0!==_){if(r.isMesh)if(!0===n.wireframe)G.setLineWidth(n.wireframeLinewidth*et()),d.setMode(B.LINES);else switch(r.drawMode){case be:d.setMode(B.TRIANGLES);break;case 1:d.setMode(B.TRIANGLE_STRIP);break;case 2:d.setMode(B.TRIANGLE_FAN)}else if(r.isLine){var w=n.linewidth;void 0===w&&(w=1),G.setLineWidth(w*et()),r.isLineSegments?d.setMode(B.LINES):r.isLineLoop?d.setMode(B.LINE_LOOP):d.setMode(B.LINE_STRIP)}else r.isPoints?d.setMode(B.POINTS):r.isSprite&&d.setMode(B.TRIANGLES);i&&i.isInstancedBufferGeometry?0<i.maxInstancedCount&&d.renderInstances(i,x,_):d.render(x,_)}},this.compile=function(i,t){(_=J.get(i,t)).init(),i.traverse(function(t){t.isLight&&(_.pushLight(t),t.castShadow&&_.pushShadow(t))}),_.setupLights(t),i.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var e=0;e<t.material.length;e++)wt(t.material[e],i.fog,t);else wt(t.material,i.fog,t)})};var dt=null;function ft(t){rt.isPresenting()||dt&&dt(t)}var mt=new $r,gt,vt,yt;function xt(t,e,i){if(!1!==t.visible){var n;if(t.layers.test(e.layers))if(t.isLight)_.pushLight(t),t.castShadow&&_.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||P.intersectsSprite(t)){i&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(D);var r=X.update(t),a=t.material;p.push(t,r,a,U.z,null)}}else if(t.isImmediateRenderObject)i&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(D),p.push(t,null,t.material,U.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||P.intersectsObject(t))){i&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(D);var r=X.update(t),a=t.material;if(Array.isArray(a))for(var o=r.groups,s=0,c=o.length;s<c;s++){var h=o[s],l=a[h.materialIndex];l&&l.visible&&p.push(t,r,l,U.z,h)}else a.visible&&p.push(t,r,a,U.z,null)}for(var u=t.children,s=0,c=u.length;s<c;s++)xt(u[s],e,i)}}function bt(t,e,i,n){for(var r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,c=o.geometry,h=void 0===n?o.material:n,l=o.group;if(i.isArrayCamera)for(var u=(S=i).cameras,p=0,d=u.length;p<d;p++){var f=u[p];if(s.layers.test(f.layers)){if("viewport"in f)G.viewport(b.copy(f.viewport));else{var m=f.bounds,g=m.x*L,v=m.y*R,y=m.z*L,x=m.w*R;G.viewport(b.set(g,v,y,x).multiplyScalar(C))}_t(s,e,f,c,h,l)}}else S=null,_t(s,e,i,c,h,l)}}function _t(t,e,i,n,r,a){if(t.onBeforeRender(w,e,i,n,r,a),_=J.get(e,S||i),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){G.setMaterial(r);var o=Mt(i,e.fog,r,t);E.geometry=null,E.program=null,E.wireframe=!1,ut(t,o)}else w.renderBufferDirect(i,e.fog,n,r,t,a);t.onAfterRender(w,e,i,n,r,a),_=J.get(e,S||i)}function wt(t,e,i){var n=V.get(t),r=_.state.lights,a=_.state.shadowsArray,o=n.lightsHash,s=r.state.hash,c=q.getParameters(t,r.state,a,e,O.numPlanes,O.numIntersection,i),h=q.getProgramCode(t,c),l=n.program,u=!0;if(void 0===l)t.addEventListener("dispose",ct);else if(l.code!==h)lt(t);else if(o.stateID!==s.stateID||o.directionalLength!==s.directionalLength||o.pointLength!==s.pointLength||o.spotLength!==s.spotLength||o.rectAreaLength!==s.rectAreaLength||o.hemiLength!==s.hemiLength||o.shadowsLength!==s.shadowsLength)o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,u=!1;else{if(void 0!==c.shaderID)return;u=!1}if(u){if(c.shaderID){var p=Zr[c.shaderID];n.shader={name:t.type,uniforms:Wr.clone(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}}else n.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.onBeforeCompile(n.shader,w),h=q.getProgramCode(t,c),l=q.acquireProgram(t,n.shader,c,h),n.program=l,t.program=l}var d=l.getAttributes();if(t.morphTargets)for(var f=t.numSupportedMorphTargets=0;f<w.maxMorphTargets;f++)0<=d["morphTarget"+f]&&t.numSupportedMorphTargets++;if(t.morphNormals)for(var f=t.numSupportedMorphNormals=0;f<w.maxMorphNormals;f++)0<=d["morphNormal"+f]&&t.numSupportedMorphNormals++;var m=n.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=O.numPlanes,n.numIntersection=O.numIntersection,m.clippingPlanes=O.uniform),n.fog=e,void 0===o&&(n.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,t.lights&&(m.ambientLightColor.value=r.state.ambient,m.directionalLights.value=r.state.directional,m.spotLights.value=r.state.spot,m.rectAreaLights.value=r.state.rectArea,m.pointLights.value=r.state.point,m.hemisphereLights.value=r.state.hemi,m.directionalShadowMap.value=r.state.directionalShadowMap,m.directionalShadowMatrix.value=r.state.directionalShadowMatrix,m.spotShadowMap.value=r.state.spotShadowMap,m.spotShadowMatrix.value=r.state.spotShadowMatrix,m.pointShadowMap.value=r.state.pointShadowMap,m.pointShadowMatrix.value=r.state.pointShadowMatrix);var g=n.program.getUniforms(),v=Vs.seqWithValue(g.seq,m);n.uniformsList=v}function Mt(t,e,i,n){A=0;var r=V.get(i),a=_.state.lights,o=r.lightsHash,s=a.state.hash;if(I&&(N||t!==T)){var c=t===T&&i.id===M;O.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,r,c)}!1===i.needsUpdate&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:(!i.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===r.numClippingPlanes||r.numClippingPlanes===O.numPlanes&&r.numIntersection===O.numIntersection)||(i.needsUpdate=!0)),i.needsUpdate&&(wt(i,e,n),i.needsUpdate=!1);var h=!1,l=!1,u=!1,p=r.program,d=p.getUniforms(),f=r.shader.uniforms;if(G.useProgram(p.program)&&(u=l=h=!0),i.id!==M&&(M=i.id,l=!0),h||t!==T){if(d.setValue(B,"projectionMatrix",t.projectionMatrix),z.logarithmicDepthBuffer&&d.setValue(B,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),T!==(S||t)&&(T=S||t,u=l=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var m=d.map.cameraPosition;void 0!==m&&m.setValue(B,U.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&d.setValue(B,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){d.setOptional(B,n,"bindMatrix"),d.setOptional(B,n,"bindMatrixInverse");var g=n.skeleton;if(g){var v=g.bones;if(z.floatVertexTextures){if(void 0===g.boneTexture){var y=Math.sqrt(4*v.length);y=De.ceilPowerOfTwo(y),y=Math.max(y,4);var x=new Float32Array(y*y*4);x.set(g.boneMatrices);var b=new Pi(x,y,y,Xt,jt);b.needsUpdate=!0,g.boneMatrices=x,g.boneTexture=b,g.boneTextureSize=y}d.setValue(B,"boneTexture",g.boneTexture),d.setValue(B,"boneTextureSize",g.boneTextureSize)}else d.setOptional(B,g,"boneMatrices")}}return l&&(d.setValue(B,"toneMappingExposure",w.toneMappingExposure),d.setValue(B,"toneMappingWhitePoint",w.toneMappingWhitePoint),i.lights&&Ft(f,u),e&&i.fog&&Rt(f,e),i.isMeshBasicMaterial?Et(f,i):i.isMeshLambertMaterial?(Et(f,i),Ct(f,i)):i.isMeshPhongMaterial?(Et(f,i),i.isMeshToonMaterial?Ot(f,i):Pt(f,i)):i.isMeshStandardMaterial?(Et(f,i),i.isMeshPhysicalMaterial?Nt(f,i):It(f,i)):i.isMeshDepthMaterial?(Et(f,i),Dt(f,i)):i.isMeshDistanceMaterial?(Et(f,i),Ut(f,i)):i.isMeshNormalMaterial?(Et(f,i),Bt(f,i)):i.isLineBasicMaterial?(Tt(f,i),i.isLineDashedMaterial&&St(f,i)):i.isPointsMaterial?At(f,i):i.isSpriteMaterial?Lt(f,i):i.isShadowMaterial&&(f.color.value=i.color,f.opacity.value=i.opacity),void 0!==f.ltc_1&&(f.ltc_1.value=Jr.LTC_1),void 0!==f.ltc_2&&(f.ltc_2.value=Jr.LTC_2),Vs.upload(B,r.uniformsList,f,w)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Vs.upload(B,r.uniformsList,f,w),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&d.setValue(B,"center",n.center),d.setValue(B,"modelViewMatrix",n.modelViewMatrix),d.setValue(B,"normalMatrix",n.normalMatrix),d.setValue(B,"modelMatrix",n.matrixWorld),p}function Et(t,e){var i;t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=V.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}function Tt(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function St(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function At(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*C,t.scale.value=.5*R,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}function Lt(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity,t.rotation.value=e.rotation,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}function Rt(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function Ct(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function Pt(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Ht&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Ht&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Ot(t,e){Pt(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function It(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Ht&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Ht&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function Nt(t,e){It(t,e),t.reflectivity.value=e.reflectivity,t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness}function Dt(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Ut(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}function Bt(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Ht&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Ht&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Ft(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function zt(){var t=A;return t>=z.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+z.maxTextures),A+=1,t}mt.setAnimationLoop(ft),"undefined"!=typeof window&&mt.setContext(window),this.setAnimationLoop=function(t){dt=t,rt.setAnimationLoop(t),mt.start()},this.render=function(t,e,i,n){if(e&&e.isCamera){if(!l){E.geometry=null,E.program=null,E.wireframe=!1,M=-1,!(T=null)===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),rt.enabled&&(e=rt.getCamera(e)),(_=J.get(t,e)).init(),t.onBeforeRender(w,t,e,i),D.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),P.setFromMatrix(D),N=this.localClippingEnabled,I=O.init(this.clippingPlanes,N,e),(p=Y.get(t,e)).init(),xt(t,e,w.sortObjects),!0===w.sortObjects&&p.sort(),I&&O.beginShadows();var r=_.state.shadowsArray;at.render(r,t,e),_.setupLights(e),I&&O.endShadows(),this.info.autoReset&&this.info.reset(),void 0===i&&(i=null),this.setRenderTarget(i),Z.render(p,t,e,n);var a=p.opaque,o=p.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&bt(a,t,e,s),o.length&&bt(o,t,e,s)}else a.length&&bt(a,t,e),o.length&&bt(o,t,e);i&&k.updateRenderTargetMipmap(i),G.buffers.depth.setTest(!0),G.buffers.depth.setMask(!0),G.buffers.color.setMask(!0),G.setPolygonOffset(!1),t.onAfterRender(w,t,e),rt.enabled&&rt.submitFrame(),_=p=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.allocTextureUnit=zt,this.setTexture2D=(gt=!1,function t(e,i){e&&e.isWebGLRenderTarget&&(gt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),gt=!0),e=e.texture),k.setTexture2D(e,i)}),this.setTexture=(vt=!1,function t(e,i){vt||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),vt=!0),k.setTexture2D(e,i)}),this.setTextureCube=(yt=!1,function t(e,i){e&&e.isWebGLRenderTargetCube&&(yt||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),yt=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?k.setTextureCube(e,i):k.setTextureCubeDynamic(e,i)}),this.setFramebuffer=function(t){u=t},this.getRenderTarget=function(){return d},this.setRenderTarget=function(t){(d=t)&&void 0===V.get(t).__webglFramebuffer&&k.setupRenderTarget(t);var e=u,i=!1;if(t){var n=V.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(e=n[t.activeCubeFace],i=!0):e=n,b.copy(t.viewport),m.copy(t.scissor),g=t.scissorTest}else b.copy(v).multiplyScalar(C),m.copy(y).multiplyScalar(C),g=x;if(f!==e&&(B.bindFramebuffer(B.FRAMEBUFFER,e),f=e),G.viewport(b),G.scissor(m),G.setScissorTest(g),i){var r=V.get(t.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,a){if(t&&t.isWebGLRenderTarget){var o=V.get(t).__webglFramebuffer;if(o){var s=!1;o!==f&&(B.bindFramebuffer(B.FRAMEBUFFER,o),s=!0);try{var c=t.texture,h=c.format,l=c.type;if(h!==Xt&&tt.convert(h)!==B.getParameter(B.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===kt||tt.convert(l)===B.getParameter(B.IMPLEMENTATION_COLOR_READ_TYPE)||l===jt&&(z.isWebGL2||F.get("OES_texture_float")||F.get("WEBGL_color_buffer_float"))||l===Wt&&(z.isWebGL2?F.get("EXT_color_buffer_float"):F.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");B.checkFramebufferStatus(B.FRAMEBUFFER)===B.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=i&&i<=t.height-r&&B.readPixels(e,i,n,r,tt.convert(h),tt.convert(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&B.bindFramebuffer(B.FRAMEBUFFER,f)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,i){var n=e.image.width,r=e.image.height,a=tt.convert(e.format);this.setTexture2D(e,0),B.copyTexImage2D(B.TEXTURE_2D,i||0,a,t.x,t.y,n,r,0)},this.copyTextureToTexture=function(t,e,i,n){var r=e.image.width,a=e.image.height,o=tt.convert(i.format),s=tt.convert(i.type);this.setTexture2D(i,0),e.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,n||0,t.x,t.y,r,a,o,s,e.image.data):B.texSubImage2D(B.TEXTURE_2D,n||0,t.x,t.y,o,s,e.image)}}function jc(t,e){this.name="",this.color=new Yr(t),this.density=void 0!==e?e:25e-5}function Wc(t,e,i){this.name="",this.color=new Yr(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Xc(){wa.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function qc(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Yc(t,e,i,n){this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function Jc(t){Do.call(this),this.type="SpriteMaterial",this.color=new Yr(16777215),this.map=null,this.rotation=0,this.lights=!1,this.transparent=!0,this.setValues(t)}function Zc(t){if(wa.call(this),this.type="Sprite",void 0===dc){dc=new ro;var e,i=new qc(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);dc.setIndex([0,1,2,0,2,3]),dc.addAttribute("position",new Yc(i,3,0,!1)),dc.addAttribute("uv",new Yc(i,2,3,!1))}this.geometry=dc,this.material=void 0!==t?t:new Jc,this.center=new ai(.5,.5)}function Qc(){wa.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Kc(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new oi)}}function $c(){wa.call(this),this.type="Bone"}function th(t,e){Go.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new oi,this.bindMatrixInverse=new oi;var i,n=new Kc(this.initBones());this.bind(n,this.matrixWorld),this.normalizeSkinWeights()}function eh(t){Do.call(this),this.type="LineBasicMaterial",this.color=new Yr(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function ih(t,e,i){1===i&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),wa.call(this),this.type="Line",this.geometry=void 0!==t?t:new ro,this.material=void 0!==e?e:new eh({color:16777215*Math.random()})}function nh(t,e){ih.call(this,t,e),this.type="LineSegments"}function rh(t,e){ih.call(this,t,e),this.type="LineLoop"}function ah(t){Do.call(this),this.type="PointsMaterial",this.color=new Yr(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function oh(t,e){wa.call(this),this.type="Points",this.geometry=void 0!==t?t:new ro,this.material=void 0!==e?e:new ah({color:16777215*Math.random()})}function sh(t,e,i,n,r,a,o,s,c){Ai.call(this,t,e,i,n,r,a,o,s,c),this.generateMipmaps=!1}function ch(t,e,i,n,r,a,o,s,c,h,l,u){Ai.call(this,null,a,o,s,c,h,n,r,l,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function hh(t,e,i,n,r,a,o,s,c){Ai.call(this,t,e,i,n,r,a,o,s,c),this.needsUpdate=!0}function lh(t,e,i,n,r,a,o,s,c,h){if((h=void 0!==h?h:It)!==It&&h!==Nt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===It&&(i=nt),void 0===i&&h===Nt&&(i=At),Ai.call(this,null,n,r,a,o,s,h,i,c),this.image={width:t,height:e},this.magFilter=void 0!==o?o:J,this.minFilter=void 0!==s?s:J,this.flipY=!1,this.generateMipmaps=!1}function uh(t){ro.call(this),this.type="WireframeGeometry";var e=[],i,n,r,a,o,s=[0,0],c={},h,l,u,p,d=["a","b","c"],f;if(t&&t.isGeometry){var m=t.faces;for(i=0,r=m.length;i<r;i++){var g=m[i];for(n=0;n<3;n++)l=g[d[n]],u=g[d[(n+1)%3]],s[0]=Math.min(l,u),s[1]=Math.max(l,u),void 0===c[p=s[0]+","+s[1]]&&(c[p]={index1:s[0],index2:s[1]})}for(p in c)h=c[p],f=t.vertices[h.index1],e.push(f.x,f.y,f.z),f=t.vertices[h.index2],e.push(f.x,f.y,f.z)}else if(t&&t.isBufferGeometry){var v,y,x,b,_,w,M,E;if(f=new ci,null!==t.index){for(v=t.attributes.position,y=t.index,0===(x=t.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),a=0,o=x.length;a<o;++a)for(r=(i=_=(b=x[a]).start)+(w=b.count);i<r;i+=3)for(n=0;n<3;n++)l=y.getX(i+n),u=y.getX(i+(n+1)%3),s[0]=Math.min(l,u),s[1]=Math.max(l,u),void 0===c[p=s[0]+","+s[1]]&&(c[p]={index1:s[0],index2:s[1]});for(p in c)h=c[p],f.fromBufferAttribute(v,h.index1),e.push(f.x,f.y,f.z),f.fromBufferAttribute(v,h.index2),e.push(f.x,f.y,f.z)}else for(i=0,r=(v=t.attributes.position).count/3;i<r;i++)for(n=0;n<3;n++)M=3*i+n,f.fromBufferAttribute(v,M),e.push(f.x,f.y,f.z),E=3*i+(n+1)%3,f.fromBufferAttribute(v,E),e.push(f.x,f.y,f.z)}this.addAttribute("position",new ka(e,3))}function ph(t,e,i){Na.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new dh(t,e,i)),this.mergeVertices()}function dh(t,e,i){ro.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};var n=[],r=[],a=[],o=[],s=1e-5,c=new ci,h=new ci,l=new ci,u=new ci,p=new ci,d,f;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=e+1;for(d=0;d<=i;d++){var g=d/i;for(f=0;f<=e;f++){var v=f/e;t(v,g,h),r.push(h.x,h.y,h.z),0<=v-s?(t(v-s,g,l),u.subVectors(h,l)):(t(v+s,g,l),u.subVectors(l,h)),0<=g-s?(t(v,g-s,l),p.subVectors(h,l)):(t(v,g+s,l),p.subVectors(l,h)),c.crossVectors(u,p).normalize(),a.push(c.x,c.y,c.z),o.push(v,g)}}for(d=0;d<i;d++)for(f=0;f<e;f++){var y=d*m+f,x=d*m+f+1,b=(d+1)*m+f+1,_=(d+1)*m+f;n.push(y,x,_),n.push(x,b,_)}this.setIndex(n),this.addAttribute("position",new ka(r,3)),this.addAttribute("normal",new ka(a,3)),this.addAttribute("uv",new ka(o,2))}function fh(t,e,i,n){Na.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},this.fromBufferGeometry(new mh(t,e,i,n)),this.mergeVertices()}function mh(n,a,t,e){ro.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:n,indices:a,radius:t,detail:e},t=t||1;var l=[],u=[];function i(t){for(var e=new ci,i=new ci,n=new ci,r=0;r<a.length;r+=3)h(a[r+0],e),h(a[r+1],i),h(a[r+2],n),o(e,i,n,t)}function o(t,e,i,n){var r=Math.pow(2,n),a=[],o,s;for(o=0;o<=r;o++){a[o]=[];var c=t.clone().lerp(i,o/r),h=e.clone().lerp(i,o/r),l=r-o;for(s=0;s<=l;s++)a[o][s]=0===s&&o===r?c:c.clone().lerp(h,s/l)}for(o=0;o<r;o++)for(s=0;s<2*(r-o)-1;s++){var u=Math.floor(s/2);s%2==0?(p(a[o][u+1]),p(a[o+1][u]),p(a[o][u])):(p(a[o][u+1]),p(a[o+1][u+1]),p(a[o+1][u]))}}function r(t){for(var e=new ci,i=0;i<l.length;i+=3)e.x=l[i+0],e.y=l[i+1],e.z=l[i+2],e.normalize().multiplyScalar(t),l[i+0]=e.x,l[i+1]=e.y,l[i+2]=e.z}function s(){for(var t=new ci,e=0;e<l.length;e+=3){t.x=l[e+0],t.y=l[e+1],t.z=l[e+2];var i=m(t)/2/Math.PI+.5,n=g(t)/Math.PI+.5;u.push(i,1-n)}d(),c()}function c(){for(var t=0;t<u.length;t+=6){var e=u[t+0],i=u[t+2],n=u[t+4],r=Math.max(e,i,n),a=Math.min(e,i,n);.9<r&&a<.1&&(e<.2&&(u[t+0]+=1),i<.2&&(u[t+2]+=1),n<.2&&(u[t+4]+=1))}}function p(t){l.push(t.x,t.y,t.z)}function h(t,e){var i=3*t;e.x=n[i+0],e.y=n[i+1],e.z=n[i+2]}function d(){for(var t=new ci,e=new ci,i=new ci,n=new ci,r=new ai,a=new ai,o=new ai,s=0,c=0;s<l.length;s+=9,c+=6){t.set(l[s+0],l[s+1],l[s+2]),e.set(l[s+3],l[s+4],l[s+5]),i.set(l[s+6],l[s+7],l[s+8]),r.set(u[c+0],u[c+1]),a.set(u[c+2],u[c+3]),o.set(u[c+4],u[c+5]),n.copy(t).add(e).add(i).divideScalar(3);var h=m(n);f(r,c+0,t,h),f(a,c+2,e,h),f(o,c+4,i,h)}}function f(t,e,i,n){n<0&&1===t.x&&(u[e]=t.x-1),0===i.x&&0===i.z&&(u[e]=n/2/Math.PI+.5)}function m(t){return Math.atan2(t.z,-t.x)}function g(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}i(e=e||0),r(t),s(),this.addAttribute("position",new ka(l,3)),this.addAttribute("normal",new ka(l.slice(),3)),this.addAttribute("uv",new ka(u,2)),0===e?this.computeVertexNormals():this.normalizeNormals()}function gh(t,e){Na.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new vh(t,e)),this.mergeVertices()}function vh(t,e){var i,n;mh.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function yh(t,e){Na.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new xh(t,e)),this.mergeVertices()}function xh(t,e){var i,n;mh.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function bh(t,e){Na.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new _h(t,e)),this.mergeVertices()}function _h(t,e){var i=(1+Math.sqrt(5))/2,n,r;mh.call(this,[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function wh(t,e){Na.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Mh(t,e)),this.mergeVertices()}function Mh(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,r,a;mh.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Eh(t,e,i,n,r,a){Na.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Th(t,e,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Th(o,s,c,h,t){ro.call(this),this.type="TubeBufferGeometry",this.parameters={path:o,tubularSegments:s,radius:c,radialSegments:h,closed:t},s=s||64,c=c||1,h=h||8,t=t||!1;var l=o.computeFrenetFrames(s,t);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;var u=new ci,p=new ci,e=new ai,d=new ci,r,f,m=[],g=[],i=[],a=[];function n(){for(r=0;r<s;r++)v(r);v(!1===t?s:0),x(),y()}function v(t){d=o.getPointAt(t/s,d);var e=l.normals[t],i=l.binormals[t];for(f=0;f<=h;f++){var n=f/h*Math.PI*2,r=Math.sin(n),a=-Math.cos(n);p.x=a*e.x+r*i.x,p.y=a*e.y+r*i.y,p.z=a*e.z+r*i.z,p.normalize(),g.push(p.x,p.y,p.z),u.x=d.x+c*p.x,u.y=d.y+c*p.y,u.z=d.z+c*p.z,m.push(u.x,u.y,u.z)}}function y(){for(f=1;f<=s;f++)for(r=1;r<=h;r++){var t=(h+1)*(f-1)+(r-1),e=(h+1)*f+(r-1),i=(h+1)*f+r,n=(h+1)*(f-1)+r;a.push(t,e,n),a.push(e,i,n)}}function x(){for(r=0;r<=s;r++)for(f=0;f<=h;f++)e.x=r/s,e.y=f/h,i.push(e.x,e.y)}n(),this.setIndex(a),this.addAttribute("position",new ka(m,3)),this.addAttribute("normal",new ka(g,3)),this.addAttribute("uv",new ka(i,2))}function Sh(t,e,i,n,r,a,o){Na.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ah(t,e,i,n,r,a)),this.mergeVertices()}function Ah(t,e,i,n,r,a){ro.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},t=t||1,e=e||.4,i=Math.floor(i)||64,n=Math.floor(n)||8,r=r||2,a=a||3;var o=[],s=[],c=[],h=[],l,u,p=new ci,d=new ci,f=new ci,m=new ci,g=new ci,v=new ci,y=new ci;for(l=0;l<=i;++l){var x=l/i*r*Math.PI*2;for(A(x,r,a,t,f),A(x+.01,r,a,t,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),u=0;u<=n;++u){var b=u/n*Math.PI*2,_=-e*Math.cos(b),w=e*Math.sin(b);p.x=f.x+(_*y.x+w*g.x),p.y=f.y+(_*y.y+w*g.y),p.z=f.z+(_*y.z+w*g.z),s.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),c.push(d.x,d.y,d.z),h.push(l/i),h.push(u/n)}}for(u=1;u<=i;u++)for(l=1;l<=n;l++){var M=(n+1)*(u-1)+(l-1),E=(n+1)*u+(l-1),T=(n+1)*u+l,S=(n+1)*(u-1)+l;o.push(M,E,S),o.push(E,T,S)}function A(t,e,i,n,r){var a=Math.cos(t),o=Math.sin(t),s=i/e*t,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}this.setIndex(o),this.addAttribute("position",new ka(s,3)),this.addAttribute("normal",new ka(c,3)),this.addAttribute("uv",new ka(h,2))}function Lh(t,e,i,n,r){Na.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new Rh(t,e,i,n,r)),this.mergeVertices()}function Rh(t,e,i,n,r){ro.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||1,e=e||.4,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var a=[],o=[],s=[],c=[],h=new ci,l=new ci,u=new ci,p,d;for(p=0;p<=i;p++)for(d=0;d<=n;d++){var f=d/n*r,m=p/i*Math.PI*2;l.x=(t+e*Math.cos(m))*Math.cos(f),l.y=(t+e*Math.cos(m))*Math.sin(f),l.z=e*Math.sin(m),o.push(l.x,l.y,l.z),h.x=t*Math.cos(f),h.y=t*Math.sin(f),u.subVectors(l,h).normalize(),s.push(u.x,u.y,u.z),c.push(d/n),c.push(p/i)}for(p=1;p<=i;p++)for(d=1;d<=n;d++){var g=(n+1)*p+d-1,v=(n+1)*(p-1)+d-1,y=(n+1)*(p-1)+d,x=(n+1)*p+d;a.push(g,v,x),a.push(v,y,x)}this.setIndex(a),this.addAttribute("position",new ka(o,3)),this.addAttribute("normal",new ka(s,3)),this.addAttribute("uv",new ka(c,2))}((Oc.prototype=Object.create(Do.prototype)).constructor=Oc).prototype.isMeshDepthMaterial=!0,Oc.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,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},((Ic.prototype=Object.create(Do.prototype)).constructor=Ic).prototype.isMeshDistanceMaterial=!0,Ic.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},Fc.prototype=Object.assign(Object.create(wa.prototype),{constructor:Fc,isGroup:!0}),zc.prototype=Object.assign(Object.create(Ma.prototype),{constructor:zc,isPerspectiveCamera:!0,copy:function(t,e){return Ma.prototype.copy.call(this,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:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*De.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*De.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*De.RAD2DEG*Math.atan(Math.tan(.5*De.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){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=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*De.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/o,e-=a.offsetY*i/s,n*=a.width/o,i*=a.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far)},toJSON:function(t){var e=wa.prototype.toJSON.call(this,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}}),Gc.prototype=Object.assign(Object.create(zc.prototype),{constructor:Gc,isArrayCamera:!0}),jc.prototype.isFogExp2=!0,jc.prototype.clone=function(){return new jc(this.color,this.density)},jc.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Wc.prototype.isFog=!0,Wc.prototype.clone=function(){return new Wc(this.color,this.near,this.far)},Wc.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Xc.prototype=Object.assign(Object.create(wa.prototype),{constructor:Xc,copy:function(t,e){return wa.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=wa.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),Object.defineProperty(qc.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(qc.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==t?t.length/this.stride:0,this.array=t,this},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Object.defineProperties(Yc.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Yc.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,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}}),((Jc.prototype=Object.create(Do.prototype)).constructor=Jc).prototype.isSpriteMaterial=!0,Jc.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},Zc.prototype=Object.assign(Object.create(wa.prototype),{constructor:Zc,isSprite:!0,raycast:function(){var h=new ci,l=new ci,u=new ci,o=new ai,s=new ai,p=new oi,d=new ci,f=new ci,m=new ci;function g(t,e,i,n,r,a){o.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(s.x=a*o.x-r*o.y,s.y=r*o.x+a*o.y):s.copy(o),t.copy(e),t.x+=s.x,t.y+=s.y,t.applyMatrix4(p)}return function t(e,i){l.setFromMatrixScale(this.matrixWorld),p.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),u.setFromMatrixPosition(this.modelViewMatrix);var n=this.material.rotation,r,a;0!==n&&(a=Math.cos(n),r=Math.sin(n));var o=this.center;g(d.set(-.5,-.5,0),u,o,l,r,a),g(f.set(.5,-.5,0),u,o,l,r,a),g(m.set(.5,.5,0),u,o,l,r,a);var s=e.ray.intersectTriangle(d,f,m,!1,h);if(null!==s||(g(f.set(-.5,.5,0),u,o,l,r,a),null!==(s=e.ray.intersectTriangle(d,m,f,!1,h)))){var c=e.ray.origin.distanceTo(h);c<e.near||c>e.far||i.push({distance:c,point:h.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return wa.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),Qc.prototype=Object.assign(Object.create(wa.prototype),{constructor:Qc,copy:function(t){wa.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);i.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object},raycast:(gc=new ci,function t(e,i){gc.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(gc);this.getObjectForDistance(n).raycast(e,i)}),update:(fc=new ci,mc=new ci,function t(e){var i=this.levels;if(1<i.length){fc.setFromMatrixPosition(e.matrixWorld),mc.setFromMatrixPosition(this.matrixWorld);var n=fc.distanceTo(mc);i[0].object.visible=!0;for(var r=1,a=i.length;r<a&&n>=i[r].distance;r++)i[r-1].object.visible=!1,i[r].object.visible=!0;for(;r<a;r++)i[r].object.visible=!1}}),toJSON:function(t){var e=wa.prototype.toJSON.call(this,t);e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var a=i[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),Object.assign(Kc.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new oi;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){var t,e,i;for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:(vc=new oi,yc=new oi,function t(){for(var e=this.bones,i=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,a=0,o=e.length;a<o;a++){var s=e[a]?e[a].matrixWorld:yc;vc.multiplyMatrices(s,i[a]),vc.toArray(n,16*a)}void 0!==r&&(r.needsUpdate=!0)}),clone:function(){return new Kc(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,i=this.bones.length;e<i;e++){var n=this.bones[e];if(n.name===t)return n}}}),$c.prototype=Object.assign(Object.create(wa.prototype),{constructor:$c,isBone:!0}),th.prototype=Object.assign(Object.create(Go.prototype),{constructor:th,isSkinnedMesh:!0,initBones:function(){var t=[],e,i,n,r;if(this.geometry&&void 0!==this.geometry.bones){for(n=0,r=this.geometry.bones.length;n<r;n++)i=this.geometry.bones[n],e=new $c,t.push(e),e.name=i.name,e.position.fromArray(i.pos),e.quaternion.fromArray(i.rotq),void 0!==i.scl&&e.scale.fromArray(i.scl);for(n=0,r=this.geometry.bones.length;n<r;n++)-1!==(i=this.geometry.bones[n]).parent&&null!==i.parent&&void 0!==t[i.parent]?t[i.parent].add(t[n]):this.add(t[n])}return this.updateMatrixWorld(!0),t},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var i=this.geometry.skinWeights[e];(t=1/i.manhattanLength())!==1/0?i.multiplyScalar(t):i.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var n=new Li,r=this.geometry.attributes.skinWeight;for(e=0;e<r.count;e++)n.x=r.getX(e),n.y=r.getY(e),n.z=r.getZ(e),n.w=r.getW(e),(t=1/n.manhattanLength())!==1/0?n.multiplyScalar(t):n.set(1,0,0,0),r.setXYZW(e,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(t){Go.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((eh.prototype=Object.create(Do.prototype)).constructor=eh).prototype.isLineBasicMaterial=!0,eh.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},ih.prototype=Object.assign(Object.create(wa.prototype),{constructor:ih,isLine:!0,computeLineDistances:(wc=new ci,Mc=new ci,function t(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var i=e.attributes.position,n=[0],r=1,a=i.count;r<a;r++)wc.fromBufferAttribute(i,r-1),Mc.fromBufferAttribute(i,r),n[r]=n[r-1],n[r]+=wc.distanceTo(Mc);e.addAttribute("lineDistance",new ka(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var o=e.vertices,n;(n=e.lineDistances)[0]=0;for(var r=1,a=o.length;r<a;r++)n[r]=n[r-1],n[r]+=o[r-1].distanceTo(o[r])}return this}),raycast:(xc=new oi,bc=new Fo,_c=new Ii,function t(e,i){var n=e.linePrecision,r=n*n,a=this.geometry,o=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),_c.copy(a.boundingSphere),_c.applyMatrix4(o),!1!==e.ray.intersectsSphere(_c)){xc.getInverse(o),bc.copy(e.ray).applyMatrix4(xc);var s=new ci,c=new ci,h=new ci,l=new ci,u=this&&this.isLineSegments?2:1;if(a.isBufferGeometry){var p=a.index,d,f=a.attributes.position.array;if(null!==p)for(var m=p.array,g=0,v=m.length-1;g<v;g+=u){var y=m[g],x=m[g+1],b,_;s.fromArray(f,3*y),c.fromArray(f,3*x),r<(b=bc.distanceSqToSegment(s,c,l,h))||(l.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(l))<e.near||_>e.far||i.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else for(var g=0,v=f.length/3-1;g<v;g+=u){var b,_;s.fromArray(f,3*g),c.fromArray(f,3*g+3),r<(b=bc.distanceSqToSegment(s,c,l,h))||(l.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(l))<e.near||_>e.far||i.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else if(a.isGeometry)for(var w=a.vertices,M=w.length,g=0;g<M-1;g+=u){var b,_;r<(b=bc.distanceSqToSegment(w[g],w[g+1],l,h))||(l.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(l))<e.near||_>e.far||i.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),nh.prototype=Object.assign(Object.create(ih.prototype),{constructor:nh,isLineSegments:!0,computeLineDistances:(Ec=new ci,Tc=new ci,function t(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var i=e.attributes.position,n=[],r=0,a=i.count;r<a;r+=2)Ec.fromBufferAttribute(i,r),Tc.fromBufferAttribute(i,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Ec.distanceTo(Tc);e.addAttribute("lineDistance",new ka(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(var o=e.vertices,n=e.lineDistances,r=0,a=o.length;r<a;r+=2)Ec.copy(o[r]),Tc.copy(o[r+1]),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Ec.distanceTo(Tc);return this})}),rh.prototype=Object.assign(Object.create(ih.prototype),{constructor:rh,isLineLoop:!0}),((ah.prototype=Object.create(Do.prototype)).constructor=ah).prototype.isPointsMaterial=!0,ah.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this},oh.prototype=Object.assign(Object.create(wa.prototype),{constructor:oh,isPoints:!0,raycast:(Sc=new oi,Ac=new Fo,Lc=new Ii,function t(r,a){var o=this,e=this.geometry,s=this.matrixWorld,i=r.params.Points.threshold;if(null===e.boundingSphere&&e.computeBoundingSphere(),Lc.copy(e.boundingSphere),Lc.applyMatrix4(s),Lc.radius+=i,!1!==r.ray.intersectsSphere(Lc)){Sc.getInverse(s),Ac.copy(r.ray).applyMatrix4(Sc);var n=i/((this.scale.x+this.scale.y+this.scale.z)/3),c=n*n,h=new ci,l=new ci;if(e.isBufferGeometry){var u=e.index,p,d=e.attributes.position.array;if(null!==u)for(var f=u.array,m=0,g=f.length;m<g;m++){var v=f[m];h.fromArray(d,3*v),b(h,v)}else for(var m=0,y=d.length/3;m<y;m++)h.fromArray(d,3*m),b(h,m)}else for(var x=e.vertices,m=0,y=x.length;m<y;m++)b(x[m],m)}function b(t,e){var i=Ac.distanceSqToPoint(t);if(i<c){Ac.closestPointToPoint(t,l),l.applyMatrix4(s);var n=r.ray.origin.distanceTo(l);if(n<r.near||n>r.far)return;a.push({distance:n,distanceToRay:Math.sqrt(i),point:l.clone(),index:e,face:null,object:o})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),sh.prototype=Object.assign(Object.create(Ai.prototype),{constructor:sh,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((ch.prototype=Object.create(Ai.prototype)).constructor=ch).prototype.isCompressedTexture=!0,((hh.prototype=Object.create(Ai.prototype)).constructor=hh).prototype.isCanvasTexture=!0,((lh.prototype=Object.create(Ai.prototype)).constructor=lh).prototype.isDepthTexture=!0,(uh.prototype=Object.create(ro.prototype)).constructor=uh,(ph.prototype=Object.create(Na.prototype)).constructor=ph,(dh.prototype=Object.create(ro.prototype)).constructor=dh,(fh.prototype=Object.create(Na.prototype)).constructor=fh,(mh.prototype=Object.create(ro.prototype)).constructor=mh,(gh.prototype=Object.create(Na.prototype)).constructor=gh,(vh.prototype=Object.create(mh.prototype)).constructor=vh,(yh.prototype=Object.create(Na.prototype)).constructor=yh,(xh.prototype=Object.create(mh.prototype)).constructor=xh,(bh.prototype=Object.create(Na.prototype)).constructor=bh,(_h.prototype=Object.create(mh.prototype)).constructor=_h,(wh.prototype=Object.create(Na.prototype)).constructor=wh,(Mh.prototype=Object.create(mh.prototype)).constructor=Mh,(Eh.prototype=Object.create(Na.prototype)).constructor=Eh,(Th.prototype=Object.create(ro.prototype)).constructor=Th,(Sh.prototype=Object.create(Na.prototype)).constructor=Sh,(Ah.prototype=Object.create(ro.prototype)).constructor=Ah,(Lh.prototype=Object.create(Na.prototype)).constructor=Lh,(Rh.prototype=Object.create(ro.prototype)).constructor=Rh;var Ch=function(t,e,i){i=i||2;var n=e&&e.length,r=n?e[0]*i:t.length,a=Ph(t,0,r,i,!0),o=[],s,c,h,l,u,p,d;if(!a)return o;if(n&&(a=Fh(t,e,a,i)),t.length>80*i){s=h=t[0],c=l=t[1];for(var f=i;f<r;f+=i)(u=t[f])<s&&(s=u),(p=t[f+1])<c&&(c=p),h<u&&(h=u),l<p&&(l=p);d=0!==(d=Math.max(h-s,l-c))?1/d:0}return Ih(a,o,i,s,c,d),o};function Ph(t,e,i,n,r){var a,o;if(r===0<rl(t,e,i,n))for(a=e;a<i;a+=n)o=el(a,t[a],t[a+1],o);else for(a=i-n;e<=a;a-=n)o=el(a,t[a],t[a+1],o);return o&&Jh(o,o.next)&&(il(o),o=o.next),o}function Oh(t,e){if(!t)return t;e||(e=t);var i=t,n;do{if(n=!1,i.steiner||!Jh(i,i.next)&&0!==Yh(i.prev,i,i.next))i=i.next;else{if(il(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function Ih(t,e,i,n,r,a,o){if(t){!o&&a&&Vh(t,n,r,a);for(var s=t,c,h;t.prev!==t.next;)if(c=t.prev,h=t.next,a?Dh(t,n,r,a):Nh(t))e.push(c.i/i),e.push(t.i/i),e.push(h.i/i),il(t),t=h.next,s=h.next;else if((t=h)===s){o?1===o?Ih(t=Uh(t,e,i),e,i,n,r,a,2):2===o&&Bh(t,e,i,n,r,a):Ih(Oh(t),e,i,n,r,a,1);break}}}function Nh(t){var e=t.prev,i=t,n=t.next;if(0<=Yh(e,i,n))return!1;for(var r=t.next.next;r!==t.prev;){if(Xh(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&0<=Yh(r.prev,r,r.next))return!1;r=r.next}return!0}function Dh(t,e,i,n){var r=t.prev,a=t,o=t.next;if(0<=Yh(r,a,o))return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,c=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,h=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,l=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=jh(s,c,e,i,n),p=jh(h,l,e,i,n),d=t.nextZ;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&Xh(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=Yh(d.prev,d,d.next))return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Xh(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=Yh(d.prev,d,d.next))return!1;d=d.prevZ}return!0}function Uh(t,e,i){var n=t;do{var r=n.prev,a=n.next.next;!Jh(r,a)&&Zh(r,n,n.next,a)&&Kh(r,a)&&Kh(a,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(a.i/i),il(n),il(n.next),n=t=a),n=n.next}while(n!==t);return n}function Bh(t,e,i,n,r,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&qh(o,s)){var c=tl(o,s);return o=Oh(o,o.next),c=Oh(c,c.next),Ih(o,e,i,n,r,a),void Ih(c,e,i,n,r,a)}s=s.next}o=o.next}while(o!==t)}function Fh(t,e,i,n){var r=[],a,o,s,c,h;for(a=0,o=e.length;a<o;a++)(h=Ph(t,s=e[a]*n,c=a<o-1?e[a+1]*n:t.length,n,!1))===h.next&&(h.steiner=!0),r.push(Wh(h));for(r.sort(zh),a=0;a<r.length;a++)Gh(r[a],i),i=Oh(i,i.next);return i}function zh(t,e){return t.x-e.x}function Gh(t,e){if(e=Hh(t,e)){var i=tl(e,t);Oh(i,i.next)}}function Hh(t,e){var i=e,n=t.x,r=t.y,a=-1/0,o;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){var s=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&a<s){if((a=s)===n){if(r===i.y)return i;if(r===i.next.y)return i.next}o=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!o)return null;if(n===a)return o.prev;var c=o,h=o.x,l=o.y,u=1/0,p;for(i=o.next;i!==c;)n>=i.x&&i.x>=h&&n!==i.x&&Xh(r<l?n:a,r,h,l,r<l?a:n,r,i.x,i.y)&&((p=Math.abs(r-i.y)/(n-i.x))<u||p===u&&i.x>o.x)&&Kh(i,t)&&(o=i,u=p),i=i.next;return o}function Vh(t,e,i,n){for(var r=t;null===r.z&&(r.z=jh(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,(r=r.next)!==t;);r.prevZ.nextZ=null,r.prevZ=null,kh(r)}function kh(t){var e,i,n,r,a,o,s,c,h=1;do{for(i=t,a=t=null,o=0;i;){for(o++,n=i,e=s=0;e<h&&(s++,n=n.nextZ);e++);for(c=h;0<s||0<c&&n;)0!==s&&(0===c||!n||i.z<=n.z)?(i=(r=i).nextZ,s--):(n=(r=n).nextZ,c--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,h*=2}while(1<o);return t}function jh(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Wh(t){for(var e=t,i=t;e.x<i.x&&(i=e),(e=e.next)!==t;);return i}function Xh(t,e,i,n,r,a,o,s){return 0<=(r-o)*(e-s)-(t-o)*(a-s)&&0<=(t-o)*(n-s)-(i-o)*(e-s)&&0<=(i-o)*(a-s)-(r-o)*(n-s)}function qh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Qh(t,e)&&Kh(t,e)&&Kh(e,t)&&$h(t,e)}function Yh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Jh(t,e){return t.x===e.x&&t.y===e.y}function Zh(t,e,i,n){return!!(Jh(t,e)&&Jh(i,n)||Jh(t,n)&&Jh(i,e))||0<Yh(t,e,i)!=0<Yh(t,e,n)&&0<Yh(i,n,t)!=0<Yh(i,n,e)}function Qh(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Zh(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function Kh(t,e){return Yh(t.prev,t,t.next)<0?0<=Yh(t,e,t.next)&&0<=Yh(t,t.prev,e):Yh(t,e,t.prev)<0||Yh(t,t.next,e)<0}function $h(t,e){for(var i=t,n=!1,r=(t.x+e.x)/2,a=(t.y+e.y)/2;i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),(i=i.next)!==t;);return n}function tl(t,e){var i=new nl(t.i,t.x,t.y),n=new nl(e.i,e.x,e.y),r=t.next,a=e.prev;return(t.next=e).prev=t,(i.next=r).prev=i,(n.next=i).prev=n,(a.next=n).prev=a,n}function el(t,e,i,n){var r=new nl(t,e,i);return n?(r.next=n.next,(r.prev=n).next.prev=r,n.next=r):(r.prev=r).next=r,r}function il(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function nl(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function rl(t,e,i,n){for(var r=0,a=e,o=i-n;a<i;a+=n)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}var al={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},isClockWise:function(t){return al.area(t)<0},triangulateShape:function(t,e){var i=[],n=[],r=[];ol(t),sl(i,t);var a=t.length;e.forEach(ol);for(var o=0;o<e.length;o++)n.push(a),a+=e[o].length,sl(i,e[o]);for(var s=Ch(i,n),o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function ol(t){var e=t.length;2<e&&t[e-1].equals(t[0])&&t.pop()}function sl(t,e){for(var i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function cl(t,e){Na.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new hl(t,e)),this.mergeVertices()}function hl(t,$){ro.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:$},t=Array.isArray(t)?t:[t];for(var tt=this,et=[],it=[],e=0,i=t.length;e<i;e++){var n;r(t[e])}function r(t){var n=[],e=void 0!==$.curveSegments?$.curveSegments:12,p=void 0!==$.steps?$.steps:1,i=void 0!==$.depth?$.depth:100,r=void 0===$.bevelEnabled||$.bevelEnabled,a=void 0!==$.bevelThickness?$.bevelThickness:6,o=void 0!==$.bevelSize?$.bevelSize:a-2,d=void 0!==$.bevelSegments?$.bevelSegments:3,s=$.extrudePath,c=void 0!==$.UVGenerator?$.UVGenerator:ll;void 0!==$.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),i=$.amount);var h,l=!1,u,f,m,g,v,y,x;s&&(h=s.getSpacedPoints(p),r=!(l=!0),u=s.computeFrenetFrames(p,!1),f=new ci,m=new ci,g=new ci),r||(o=a=d=0);var b=t.extractPoints(e),_=b.shape,w=b.holes,M;if(!al.isClockWise(_))for(_=_.reverse(),y=0,x=w.length;y<x;y++)v=w[y],al.isClockWise(v)&&(w[y]=v.reverse());var E=al.triangulateShape(_,w),T=_;for(y=0,x=w.length;y<x;y++)v=w[y],_=_.concat(v);function S(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}var A,L,R,C,P,O=_.length,I,N=E.length;function D(t,e,i){var n,r,a,o=t.x-e.x,s=t.y-e.y,c=i.x-t.x,h=i.y-t.y,l=o*o+s*s,u=o*h-s*c;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(l),d=Math.sqrt(c*c+h*h),f=e.x-s/p,m=e.y+o/p,g,v,y=((i.x-h/d-f)*h-(i.y+c/d-m)*c)/(o*h-s*c),x=(n=f+o*y-t.x)*n+(r=m+s*y-t.y)*r;if(x<=2)return new ai(n,r);a=Math.sqrt(x/2)}else{var b=!1;o>Number.EPSILON?c>Number.EPSILON&&(b=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(b=!0):Math.sign(s)===Math.sign(h)&&(b=!0),a=b?(n=-s,r=o,Math.sqrt(l)):(n=o,r=s,Math.sqrt(l/2))}return new ai(n/a,r/a)}for(var U=[],B=0,F=T.length,z=F-1,G=B+1;B<F;B++,z++,G++)z===F&&(z=0),G===F&&(G=0),U[B]=D(T[B],T[z],T[G]);var H=[],V,k=U.concat(),j;for(y=0,x=w.length;y<x;y++){for(v=w[y],V=[],B=0,z=(F=v.length)-1,G=B+1;B<F;B++,z++,G++)z===F&&(z=0),G===F&&(G=0),V[B]=D(v[B],v[z],v[G]);H.push(V),k=k.concat(V)}for(A=0;A<d;A++){for(R=A/d,C=a*Math.cos(R*Math.PI/2),L=o*Math.sin(R*Math.PI/2),B=0,F=T.length;B<F;B++)Y((P=S(T[B],U[B],L)).x,P.y,-C);for(y=0,x=w.length;y<x;y++)for(v=w[y],V=H[y],B=0,F=v.length;B<F;B++)Y((P=S(v[B],V[B],L)).x,P.y,-C)}for(L=o,B=0;B<O;B++)P=r?S(_[B],k[B],L):_[B],l?(m.copy(u.normals[0]).multiplyScalar(P.x),f.copy(u.binormals[0]).multiplyScalar(P.y),g.copy(h[0]).add(m).add(f),Y(g.x,g.y,g.z)):Y(P.x,P.y,0);for(j=1;j<=p;j++)for(B=0;B<O;B++)P=r?S(_[B],k[B],L):_[B],l?(m.copy(u.normals[j]).multiplyScalar(P.x),f.copy(u.binormals[j]).multiplyScalar(P.y),g.copy(h[j]).add(m).add(f),Y(g.x,g.y,g.z)):Y(P.x,P.y,i/p*j);for(A=d-1;0<=A;A--){for(R=A/d,C=a*Math.cos(R*Math.PI/2),L=o*Math.sin(R*Math.PI/2),B=0,F=T.length;B<F;B++)Y((P=S(T[B],U[B],L)).x,P.y,i+C);for(y=0,x=w.length;y<x;y++)for(v=w[y],V=H[y],B=0,F=v.length;B<F;B++)P=S(v[B],V[B],L),l?Y(P.x,P.y+h[p-1].y,h[p-1].x+C):Y(P.x,P.y,i+C)}function W(){var t=et.length/3;if(r){var e=0,i=O*e;for(B=0;B<N;B++)J((I=E[B])[2]+i,I[1]+i,I[0]+i);for(i=O*(e=p+2*d),B=0;B<N;B++)J((I=E[B])[0]+i,I[1]+i,I[2]+i)}else{for(B=0;B<N;B++)J((I=E[B])[2],I[1],I[0]);for(B=0;B<N;B++)J((I=E[B])[0]+O*p,I[1]+O*p,I[2]+O*p)}tt.addGroup(t,et.length/3-t,0)}function X(){var t=et.length/3,e=0;for(q(T,e),e+=T.length,y=0,x=w.length;y<x;y++)q(v=w[y],e),e+=v.length;tt.addGroup(t,et.length/3-t,1)}function q(t,e){var i,n;for(B=t.length;0<=--B;){(n=(i=B)-1)<0&&(n=t.length-1);var r=0,a=p+2*d;for(r=0;r<a;r++){var o=O*r,s=O*(r+1),c,h,l,u;Z(e+i+o,e+n+o,e+n+s,e+i+s)}}}function Y(t,e,i){n.push(t),n.push(e),n.push(i)}function J(t,e,i){Q(t),Q(e),Q(i);var n=et.length/3,r=c.generateTopUV(tt,et,n-3,n-2,n-1);K(r[0]),K(r[1]),K(r[2])}function Z(t,e,i,n){Q(t),Q(e),Q(n),Q(e),Q(i),Q(n);var r=et.length/3,a=c.generateSideWallUV(tt,et,r-6,r-3,r-2,r-1);K(a[0]),K(a[1]),K(a[3]),K(a[1]),K(a[2]),K(a[3])}function Q(t){et.push(n[3*t+0]),et.push(n[3*t+1]),et.push(n[3*t+2])}function K(t){it.push(t.x),it.push(t.y)}W(),X()}this.addAttribute("position",new ka(et,3)),this.addAttribute("uv",new ka(it,2)),this.computeVertexNormals()}((cl.prototype=Object.create(Na.prototype)).constructor=cl).prototype.toJSON=function(){var t=Na.prototype.toJSON.call(this),e,i;return ul(this.parameters.shapes,this.parameters.options,t)},((hl.prototype=Object.create(ro.prototype)).constructor=hl).prototype.toJSON=function(){var t=ro.prototype.toJSON.call(this),e,i;return ul(this.parameters.shapes,this.parameters.options,t)};var ll={generateTopUV:function(t,e,i,n,r){var a=e[3*i],o=e[3*i+1],s=e[3*n],c=e[3*n+1],h=e[3*r],l=e[3*r+1];return[new ai(a,o),new ai(s,c),new ai(h,l)]},generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1],c=e[3*i+2],h=e[3*n],l=e[3*n+1],u=e[3*n+2],p=e[3*r],d=e[3*r+1],f=e[3*r+2],m=e[3*a],g=e[3*a+1],v=e[3*a+2];return Math.abs(s-l)<.01?[new ai(o,1-c),new ai(h,1-u),new ai(p,1-f),new ai(m,1-v)]:[new ai(s,1-c),new ai(l,1-u),new ai(d,1-f),new ai(g,1-v)]}};function ul(t,e,i){if(i.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var a=t[n];i.shapes.push(a.uuid)}else i.shapes.push(t.uuid);return void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}function pl(t,e){Na.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new dl(t,e)),this.mergeVertices()}function dl(t,e){var i=(e=e||{}).font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Na;var n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),hl.call(this,n,e),this.type="TextBufferGeometry"}function fl(t,e,i,n,r,a,o){Na.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new ml(t,e,i,n,r,a,o)),this.mergeVertices()}function ml(t,e,i,n,r,a,o){ro.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},t=t||1,e=Math.max(3,Math.floor(e)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var s=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),c,h,l=0,u=[],p=new ci,d=new ci,f=[],m=[],g=[],v=[];for(h=0;h<=i;h++){var y=[],x=h/i;for(c=0;c<=e;c++){var b=c/e;p.x=-t*Math.cos(n+b*r)*Math.sin(a+x*o),p.y=t*Math.cos(a+x*o),p.z=t*Math.sin(n+b*r)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.set(p.x,p.y,p.z).normalize(),g.push(d.x,d.y,d.z),v.push(b,1-x),y.push(l++)}u.push(y)}for(h=0;h<i;h++)for(c=0;c<e;c++){var _=u[h][c+1],w=u[h][c],M=u[h+1][c],E=u[h+1][c+1];(0!==h||0<a)&&f.push(_,w,E),(h!==i-1||s<Math.PI)&&f.push(w,M,E)}this.setIndex(f),this.addAttribute("position",new ka(m,3)),this.addAttribute("normal",new ka(g,3)),this.addAttribute("uv",new ka(v,2))}function gl(t,e,i,n,r,a){Na.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new vl(t,e,i,n,r,a)),this.mergeVertices()}function vl(t,e,i,n,r,a){ro.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},t=t||.5,e=e||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var o=[],s=[],c=[],h=[],l,u=t,p=(e-t)/(n=void 0!==n?Math.max(1,n):1),d=new ci,f=new ai,m,g;for(m=0;m<=n;m++){for(g=0;g<=i;g++)l=r+g/i*a,d.x=u*Math.cos(l),d.y=u*Math.sin(l),s.push(d.x,d.y,d.z),c.push(0,0,1),f.x=(d.x/e+1)/2,f.y=(d.y/e+1)/2,h.push(f.x,f.y);u+=p}for(m=0;m<n;m++){var v=m*(i+1);for(g=0;g<i;g++){var y=l=g+v,x=l+i+1,b=l+i+2,_=l+1;o.push(y,x,_),o.push(x,b,_)}}this.setIndex(o),this.addAttribute("position",new ka(s,3)),this.addAttribute("normal",new ka(c,3)),this.addAttribute("uv",new ka(h,2))}function yl(t,e,i,n){Na.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new xl(t,e,i,n)),this.mergeVertices()}function xl(t,e,i,n){ro.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e)||12,i=i||0,n=n||2*Math.PI,n=De.clamp(n,0,2*Math.PI);var r=[],a=[],o=[],s,c=1/e,h=new ci,l=new ai,u,p;for(u=0;u<=e;u++){var d=i+u*c*n,f=Math.sin(d),m=Math.cos(d);for(p=0;p<=t.length-1;p++)h.x=t[p].x*f,h.y=t[p].y,h.z=t[p].x*m,a.push(h.x,h.y,h.z),l.x=u/e,l.y=p/(t.length-1),o.push(l.x,l.y)}for(u=0;u<e;u++)for(p=0;p<t.length-1;p++){var g=s=p+u*t.length,v=s+t.length,y=s+t.length+1,x=s+1;r.push(g,v,x),r.push(v,y,x)}if(this.setIndex(r),this.addAttribute("position",new ka(a,3)),this.addAttribute("uv",new ka(o,2)),this.computeVertexNormals(),n===2*Math.PI){var b=this.attributes.normal.array,_=new ci,w=new ci,M=new ci;for(s=e*t.length*3,p=u=0;u<t.length;u++,p+=3)_.x=b[p+0],_.y=b[p+1],_.z=b[p+2],w.x=b[s+p+0],w.y=b[s+p+1],w.z=b[s+p+2],M.addVectors(_,w).normalize(),b[p+0]=b[s+p+0]=M.x,b[p+1]=b[s+p+1]=M.y,b[p+2]=b[s+p+2]=M.z}}function bl(t,e){Na.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new _l(t,e)),this.mergeVertices()}function _l(t,f){ro.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:f},f=f||12;var m=[],g=[],v=[],y=[],e=0,x=0;if(!1===Array.isArray(t))n(t);else for(var i=0;i<t.length;i++)n(t[i]),this.addGroup(e,x,i),e+=x,x=0;function n(t){var e,i,n,r=g.length/3,a=t.extractPoints(f),o=a.shape,s=a.holes;if(!1===al.isClockWise(o))for(o=o.reverse(),e=0,i=s.length;e<i;e++)n=s[e],!0===al.isClockWise(n)&&(s[e]=n.reverse());var c=al.triangulateShape(o,s);for(e=0,i=s.length;e<i;e++)n=s[e],o=o.concat(n);for(e=0,i=o.length;e<i;e++){var h=o[e];g.push(h.x,h.y,0),v.push(0,0,1),y.push(h.x,h.y)}for(e=0,i=c.length;e<i;e++){var l=c[e],u=l[0]+r,p=l[1]+r,d=l[2]+r;m.push(u,p,d),x+=3}}this.setIndex(m),this.addAttribute("position",new ka(g,3)),this.addAttribute("normal",new ka(v,3)),this.addAttribute("uv",new ka(y,2))}function wl(t,e){if(e.shapes=[],Array.isArray(t))for(var i=0,n=t.length;i<n;i++){var r=t[i];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}function Ml(t,e){ro.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var i=[],n=Math.cos(De.DEG2RAD*e),r=[0,0],a={},o,s,c,h=["a","b","c"],l;t.isBufferGeometry?(l=new Na).fromBufferGeometry(t):l=t.clone(),l.mergeVertices(),l.computeFaceNormals();for(var u=l.vertices,p=l.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],g=0;g<3;g++)o=m[h[g]],s=m[h[(g+1)%3]],r[0]=Math.min(o,s),r[1]=Math.max(o,s),void 0===a[c=r[0]+","+r[1]]?a[c]={index1:r[0],index2:r[1],face1:d,face2:void 0}:a[c].face2=d;for(c in a){var v=a[c];if(void 0===v.face2||p[v.face1].normal.dot(p[v.face2].normal)<=n){var y=u[v.index1];i.push(y.x,y.y,y.z),y=u[v.index2],i.push(y.x,y.y,y.z)}}this.addAttribute("position",new ka(i,3))}function El(t,e,i,n,r,a,o,s){Na.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Tl(t,e,i,n,r,a,o,s)),this.mergeVertices()}function Tl(v,y,x,b,_,t,w,M){ro.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:v,radiusBottom:y,height:x,radialSegments:b,heightSegments:_,openEnded:t,thetaStart:w,thetaLength:M};var E=this;v=void 0!==v?v:1,y=void 0!==y?y:1,x=x||1,b=Math.floor(b)||8,_=Math.floor(_)||1,t=void 0!==t&&t,w=void 0!==w?w:0,M=void 0!==M?M:2*Math.PI;var T=[],S=[],A=[],L=[],R=0,C=[],P=x/2,O=0;function e(){var t,e,i=new ci,n=new ci,r=0,a=(y-v)/x;for(e=0;e<=_;e++){var o=[],s=e/_,c=s*(y-v)+v;for(t=0;t<=b;t++){var h=t/b,l=h*M+w,u=Math.sin(l),p=Math.cos(l);n.x=c*u,n.y=-s*x+P,n.z=c*p,S.push(n.x,n.y,n.z),i.set(u,a,p).normalize(),A.push(i.x,i.y,i.z),L.push(h,1-s),o.push(R++)}C.push(o)}for(t=0;t<b;t++)for(e=0;e<_;e++){var d=C[e][t],f=C[e+1][t],m=C[e+1][t+1],g=C[e][t+1];T.push(d,f,g),T.push(f,m,g),r+=6}E.addGroup(O,r,0),O+=r}function i(t){var e,i,n,r=new ai,a=new ci,o=0,s=!0===t?v:y,c=!0===t?1:-1;for(i=R,e=1;e<=b;e++)S.push(0,P*c,0),A.push(0,c,0),L.push(.5,.5),R++;for(n=R,e=0;e<=b;e++){var h,l=e/b*M+w,u=Math.cos(l),p=Math.sin(l);a.x=s*p,a.y=P*c,a.z=s*u,S.push(a.x,a.y,a.z),A.push(0,c,0),r.x=.5*u+.5,r.y=.5*p*c+.5,L.push(r.x,r.y),R++}for(e=0;e<b;e++){var d=i+e,f=n+e;!0===t?T.push(f,f+1,d):T.push(f+1,f,d),o+=3}E.addGroup(O,o,!0===t?1:2),O+=o}e(),!1===t&&(0<v&&i(!0),0<y&&i(!1)),this.setIndex(T),this.addAttribute("position",new ka(S,3)),this.addAttribute("normal",new ka(A,3)),this.addAttribute("uv",new ka(L,2))}function Sl(t,e,i,n,r,a,o){El.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Al(t,e,i,n,r,a,o){Tl.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Ll(t,e,i,n){Na.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new Rl(t,e,i,n)),this.mergeVertices()}function Rl(t,e,i,n){ro.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r=[],a=[],o=[],s=[],c,h,l=new ci,u=new ai;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),h=0,c=3;h<=e;h++,c+=3){var p=i+h/e*n;l.x=t*Math.cos(p),l.y=t*Math.sin(p),a.push(l.x,l.y,l.z),o.push(0,0,1),u.x=(a[c]/t+1)/2,u.y=(a[c+1]/t+1)/2,s.push(u.x,u.y)}for(c=1;c<=e;c++)r.push(c,c+1,0);this.setIndex(r),this.addAttribute("position",new ka(a,3)),this.addAttribute("normal",new ka(o,3)),this.addAttribute("uv",new ka(s,2))}(pl.prototype=Object.create(Na.prototype)).constructor=pl,(dl.prototype=Object.create(hl.prototype)).constructor=dl,(fl.prototype=Object.create(Na.prototype)).constructor=fl,(ml.prototype=Object.create(ro.prototype)).constructor=ml,(gl.prototype=Object.create(Na.prototype)).constructor=gl,(vl.prototype=Object.create(ro.prototype)).constructor=vl,(yl.prototype=Object.create(Na.prototype)).constructor=yl,(xl.prototype=Object.create(ro.prototype)).constructor=xl,((bl.prototype=Object.create(Na.prototype)).constructor=bl).prototype.toJSON=function(){var t=Na.prototype.toJSON.call(this),e;return wl(this.parameters.shapes,t)},((_l.prototype=Object.create(ro.prototype)).constructor=_l).prototype.toJSON=function(){var t=ro.prototype.toJSON.call(this),e;return wl(this.parameters.shapes,t)},(Ml.prototype=Object.create(ro.prototype)).constructor=Ml,(El.prototype=Object.create(Na.prototype)).constructor=El,(Tl.prototype=Object.create(ro.prototype)).constructor=Tl,(Sl.prototype=Object.create(El.prototype)).constructor=Sl,(Al.prototype=Object.create(Tl.prototype)).constructor=Al,(Ll.prototype=Object.create(Na.prototype)).constructor=Ll,(Rl.prototype=Object.create(ro.prototype)).constructor=Rl;var Cl=Object.freeze({WireframeGeometry:uh,ParametricGeometry:ph,ParametricBufferGeometry:dh,TetrahedronGeometry:gh,TetrahedronBufferGeometry:vh,OctahedronGeometry:yh,OctahedronBufferGeometry:xh,IcosahedronGeometry:bh,IcosahedronBufferGeometry:_h,DodecahedronGeometry:wh,DodecahedronBufferGeometry:Mh,PolyhedronGeometry:fh,PolyhedronBufferGeometry:mh,TubeGeometry:Eh,TubeBufferGeometry:Th,TorusKnotGeometry:Sh,TorusKnotBufferGeometry:Ah,TorusGeometry:Lh,TorusBufferGeometry:Rh,TextGeometry:pl,TextBufferGeometry:dl,SphereGeometry:fl,SphereBufferGeometry:ml,RingGeometry:gl,RingBufferGeometry:vl,PlaneGeometry:so,PlaneBufferGeometry:co,LatheGeometry:yl,LatheBufferGeometry:xl,ShapeGeometry:bl,ShapeBufferGeometry:_l,ExtrudeGeometry:cl,ExtrudeBufferGeometry:hl,EdgesGeometry:Ml,ConeGeometry:Sl,ConeBufferGeometry:Al,CylinderGeometry:El,CylinderBufferGeometry:Tl,CircleGeometry:Ll,CircleBufferGeometry:Rl,BoxGeometry:ao,BoxBufferGeometry:oo});function Pl(t){Do.call(this),this.type="ShadowMaterial",this.color=new Yr(0),this.transparent=!0,this.setValues(t)}function Ol(t){Bo.call(this,t),this.type="RawShaderMaterial"}function Il(t){Do.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Yr(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Yr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ie,this.normalScale=new ai(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.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Nl(t){Il.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Dl(t){Do.call(this),this.type="MeshPhongMaterial",this.color=new Yr(16777215),this.specular=new Yr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Yr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ie,this.normalScale=new ai(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ul(t){Dl.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Bl(t){Do.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ie,this.normalScale=new ai(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Fl(t){Do.call(this),this.type="MeshLambertMaterial",this.color=new Yr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Yr(0),this.emissiveIntensity=1,this.emissiveMap=null,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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function zl(t){eh.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}((Pl.prototype=Object.create(Do.prototype)).constructor=Pl).prototype.isShadowMaterial=!0,Pl.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.color.copy(t.color),this},((Ol.prototype=Object.create(Bo.prototype)).constructor=Ol).prototype.isRawShaderMaterial=!0,((Il.prototype=Object.create(Do.prototype)).constructor=Il).prototype.isMeshStandardMaterial=!0,Il.prototype.copy=function(t){return Do.prototype.copy.call(this,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.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Nl.prototype=Object.create(Il.prototype)).constructor=Nl).prototype.isMeshPhysicalMaterial=!0,Nl.prototype.copy=function(t){return Il.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},((Dl.prototype=Object.create(Do.prototype)).constructor=Dl).prototype.isMeshPhongMaterial=!0,Dl.prototype.copy=function(t){return Do.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,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.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.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Ul.prototype=Object.create(Dl.prototype)).constructor=Ul).prototype.isMeshToonMaterial=!0,Ul.prototype.copy=function(t){return Dl.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},((Bl.prototype=Object.create(Do.prototype)).constructor=Bl).prototype.isMeshNormalMaterial=!0,Bl.prototype.copy=function(t){return Do.prototype.copy.call(this,t),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.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Fl.prototype=Object.create(Do.prototype)).constructor=Fl).prototype.isMeshLambertMaterial=!0,Fl.prototype.copy=function(t){return Do.prototype.copy.call(this,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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,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.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((zl.prototype=Object.create(eh.prototype)).constructor=zl).prototype.isLineDashedMaterial=!0,zl.prototype.copy=function(t){return eh.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Gl=Object.freeze({ShadowMaterial:Pl,SpriteMaterial:Jc,RawShaderMaterial:Ol,ShaderMaterial:Bo,PointsMaterial:ah,MeshPhysicalMaterial:Nl,MeshStandardMaterial:Il,MeshPhongMaterial:Dl,MeshToonMaterial:Ul,MeshNormalMaterial:Bl,MeshLambertMaterial:Fl,MeshDepthMaterial:Oc,MeshDistanceMaterial:Ic,MeshBasicMaterial:Uo,LineDashedMaterial:zl,LineBasicMaterial:eh,Material:Do}),Hl={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={}}};function Vl(t,e,i){var n=this,r=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this}}var kl=new Vl,jl={};function Wl(t){this.manager=void 0!==t?t:kl}function Xl(t){this.manager=void 0!==t?t:kl,this._parser=null}function ql(t){this.manager=void 0!==t?t:kl,this._parser=null}function Yl(t){this.manager=void 0!==t?t:kl}function Jl(t){this.manager=void 0!==t?t:kl}function Zl(t){this.manager=void 0!==t?t:kl}function Ql(){this.type="Curve",this.arcLengthDivisions=200}function Kl(t,e,i,n,r,a,o,s){Ql.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=i||1,this.yRadius=n||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function $l(t,e,i,n,r,a){Kl.call(this,t,e,i,i,n,r,a),this.type="ArcCurve"}function tu(){var r=0,a=0,o=0,s=0;function h(t,e,i,n){o=-3*(r=t)+3*e-2*(a=i)-n,s=2*t-2*e+i+n}return{initCatmullRom:function(t,e,i,n,r){h(e,i,r*(i-t),r*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,r,a,o){var s=(e-t)/r-(i-t)/(r+a)+(i-e)/a,c=(i-e)/a-(n-e)/(a+o)+(n-i)/o;h(e,i,s*=a,c*=a)},calc:function(t){var e=t*t,i;return r+a*t+o*e+s*(e*t)}}}Object.assign(Wl.prototype,{load:function(o,t,e,i){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,n=Hl.get(o);if(void 0!==n)return s.manager.itemStart(o),setTimeout(function(){t&&t(n),s.manager.itemEnd(o)},0),n;if(void 0===jl[o]){var r=/^data:(.*?)(;base64)?,(.*)$/,a=o.match(r);if(a){var c=a[1],h=!!a[2],l=a[3];l=window.decodeURIComponent(l),h&&(l=window.atob(l));try{var u,p=(this.responseType||"").toLowerCase();switch(p){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),f=0;f<l.length;f++)d[f]=l.charCodeAt(f);u="blob"===p?new Blob([d.buffer],{type:c}):d.buffer;break;case"document":var m=new DOMParser;u=m.parseFromString(l,c);break;case"json":u=JSON.parse(l);break;default:u=l}window.setTimeout(function(){t&&t(u),s.manager.itemEnd(o)},0)}catch(t){window.setTimeout(function(){i&&i(t),s.manager.itemEnd(o),s.manager.itemError(o)},0)}}else{jl[o]=[],jl[o].push({onLoad:t,onProgress:e,onError:i});var g=new XMLHttpRequest;for(var v in g.open("GET",o,!0),g.addEventListener("load",function(t){var e=this.response;Hl.add(o,e);var i=jl[o];if(delete jl[o],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var n=0,r=i.length;n<r;n++){var a;(a=i[n]).onLoad&&a.onLoad(e)}s.manager.itemEnd(o)}else{for(var n=0,r=i.length;n<r;n++){var a;(a=i[n]).onError&&a.onError(t)}s.manager.itemEnd(o),s.manager.itemError(o)}},!1),g.addEventListener("progress",function(t){for(var e=jl[o],i=0,n=e.length;i<n;i++){var r=e[i];r.onProgress&&r.onProgress(t)}},!1),g.addEventListener("error",function(t){var e=jl[o];delete jl[o];for(var i=0,n=e.length;i<n;i++){var r=e[i];r.onError&&r.onError(t)}s.manager.itemEnd(o),s.manager.itemError(o)},!1),void 0!==this.responseType&&(g.responseType=this.responseType),void 0!==this.withCredentials&&(g.withCredentials=this.withCredentials),g.overrideMimeType&&g.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)g.setRequestHeader(v,this.requestHeader[v]);g.send(null)}return s.manager.itemStart(o),g}jl[o].push({onLoad:t,onProgress:e,onError:i})},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(Xl.prototype,{load:function(t,a,e,n){var o=this,s=[],c=new ch;c.image=s;var r=new Wl(this.manager);function i(i){r.load(t[i],function(t){var e=o._parser(t,!0);s[i]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(h+=1)&&(1===e.mipmapCount&&(c.minFilter=K),c.format=e.format,c.needsUpdate=!0,a&&a(c))},e,n)}if(r.setPath(this.path),r.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,l=0,u=t.length;l<u;++l)i(l);else r.load(t,function(t){var e=o._parser(t,!0);if(e.isCubemap)for(var i=e.mipmaps.length/e.mipmapCount,n=0;n<i;n++){s[n]={mipmaps:[]};for(var r=0;r<e.mipmapCount;r++)s[n].mipmaps.push(e.mipmaps[n*e.mipmapCount+r]),s[n].format=e.format,s[n].width=e.width,s[n].height=e.height}else c.image.width=e.width,c.image.height=e.height,c.mipmaps=e.mipmaps;1===e.mipmapCount&&(c.minFilter=K),c.format=e.format,c.needsUpdate=!0,a&&a(c)},e,n);return c},setPath:function(t){return this.path=t,this}}),Object.assign(ql.prototype,{load:function(t,i,e,n){var r=this,a=new Pi,o=new Wl(this.manager);return o.setResponseType("arraybuffer"),o.load(t,function(t){var e=r._parser(t);e&&(void 0!==e.image?a.image=e.image:void 0!==e.data&&(a.image.width=e.width,a.image.height=e.height,a.image.data=e.data),a.wrapS=void 0!==e.wrapS?e.wrapS:q,a.wrapT=void 0!==e.wrapT?e.wrapT:q,a.magFilter=void 0!==e.magFilter?e.magFilter:K,a.minFilter=void 0!==e.minFilter?e.minFilter:tt,a.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(a.format=e.format),void 0!==e.type&&(a.type=e.type),void 0!==e.mipmaps&&(a.mipmaps=e.mipmaps),1===e.mipmapCount&&(a.minFilter=K),a.needsUpdate=!0,i&&i(a,e))},e,n),a}}),Object.assign(Yl.prototype,{crossOrigin:"anonymous",load:function(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Hl.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),Hl.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),n&&n(t),r.manager.itemEnd(e),r.manager.itemError(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Jl.prototype,{crossOrigin:"anonymous",load:function(t,i,e,n){var r=new Ko,a=new Yl(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(e){a.load(t[e],function(t){r.images[e]=t,6===++o&&(r.needsUpdate=!0,i&&i(r))},void 0,n)}for(var c=0;c<t.length;++c)s(c);return r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Zl.prototype,{crossOrigin:"anonymous",load:function(i,n,t,e){var r=new Ai,a=new Yl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(i,function(t){r.image=t;var e=0<i.search(/\.(jpg|jpeg)$/)||0===i.search(/^data\:image\/jpeg/);r.format=e?Rt:Xt,r.needsUpdate=!0,void 0!==n&&n(r)},t,e),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Ql.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e=[],i,n=this.getPoint(0),r,a=0;for(e.push(0),r=1;r<=t;r++)a+=(i=this.getPoint(r/t)).distanceTo(n),e.push(a),n=i;return this.cacheArcLengths=e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i=this.getLengths(),n=0,r=i.length,a;a=e||t*i[r-1];for(var o=0,s=r-1,c;o<=s;)if((c=i[n=Math.floor(o+(s-o)/2)]-a)<0)o=n+1;else{if(!(0<c)){s=n;break}s=n-1}if(i[n=s]===a)return n/(r-1);var h=i[n],l,u,p,d;return(n+(a-h)/(i[n+1]-h))/(r-1)},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),1<n&&(n=1);var r=this.getPoint(i),a,o;return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i=new ci,n=[],r=[],a=[],o=new ci,s=new oi,c,h,l;for(c=0;c<=t;c++)h=c/t,n[c]=this.getTangentAt(h),n[c].normalize();r[0]=new ci,a[0]=new ci;var u=Number.MAX_VALUE,p=Math.abs(n[0].x),d=Math.abs(n[0].y),f=Math.abs(n[0].z);for(p<=u&&(u=p,i.set(1,0,0)),d<=u&&(u=d,i.set(0,1,0)),f<=u&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],o),a[0].crossVectors(n[0],r[0]),c=1;c<=t;c++)r[c]=r[c-1].clone(),a[c]=a[c-1].clone(),o.crossVectors(n[c-1],n[c]),o.length()>Number.EPSILON&&(o.normalize(),l=Math.acos(De.clamp(n[c-1].dot(n[c]),-1,1)),r[c].applyMatrix4(s.makeRotationAxis(o,l))),a[c].crossVectors(n[c],r[c]);if(!0===e)for(l=Math.acos(De.clamp(r[0].dot(r[t]),-1,1)),l/=t,0<n[0].dot(o.crossVectors(r[0],r[t]))&&(l=-l),c=1;c<=t;c++)r[c].applyMatrix4(s.makeRotationAxis(n[c],l*c)),a[c].crossVectors(n[c],r[c]);return{tangents:n,normals:r,binormals:a}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),((Kl.prototype=Object.create(Ql.prototype)).constructor=Kl).prototype.isEllipseCurve=!0,Kl.prototype.getPoint=function(t,e){for(var i=e||new ai,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=n;for(;n<r;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);var o=this.aStartAngle+t*r,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var h=Math.cos(this.aRotation),l=Math.sin(this.aRotation),u=s-this.aX,p=c-this.aY;s=u*h-p*l+this.aX,c=u*l+p*h+this.aY}return i.set(s,c)},Kl.prototype.copy=function(t){return Ql.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Kl.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},Kl.prototype.fromJSON=function(t){return Ql.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},(($l.prototype=Object.create(Kl.prototype)).constructor=$l).prototype.isArcCurve=!0;var eu=new ci,iu=new tu,nu=new tu,ru=new tu;function au(t,e,i,n){Ql.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=i||"centripetal",this.tension=n||.5}function ou(t,e,i,n,r){var a=.5*(n-e),o=.5*(r-i),s=t*t,c;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function su(t,e){var i=1-t;return i*i*e}function cu(t,e){return 2*(1-t)*t*e}function hu(t,e){return t*t*e}function lu(t,e,i,n){return su(t,e)+cu(t,i)+hu(t,n)}function uu(t,e){var i=1-t;return i*i*i*e}function pu(t,e){var i=1-t;return 3*i*i*t*e}function du(t,e){return 3*(1-t)*t*t*e}function fu(t,e){return t*t*t*e}function mu(t,e,i,n,r){return uu(t,e)+pu(t,i)+du(t,n)+fu(t,r)}function gu(t,e,i,n){Ql.call(this),this.type="CubicBezierCurve",this.v0=t||new ai,this.v1=e||new ai,this.v2=i||new ai,this.v3=n||new ai}function vu(t,e,i,n){Ql.call(this),this.type="CubicBezierCurve3",this.v0=t||new ci,this.v1=e||new ci,this.v2=i||new ci,this.v3=n||new ci}function yu(t,e){Ql.call(this),this.type="LineCurve",this.v1=t||new ai,this.v2=e||new ai}function xu(t,e){Ql.call(this),this.type="LineCurve3",this.v1=t||new ci,this.v2=e||new ci}function bu(t,e,i){Ql.call(this),this.type="QuadraticBezierCurve",this.v0=t||new ai,this.v1=e||new ai,this.v2=i||new ai}function _u(t,e,i){Ql.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new ci,this.v1=e||new ci,this.v2=i||new ci}function wu(t){Ql.call(this),this.type="SplineCurve",this.points=t||[]}((au.prototype=Object.create(Ql.prototype)).constructor=au).prototype.isCatmullRomCurve3=!0,au.prototype.getPoint=function(t,e){var i=e||new ci,n=this.points,r=n.length,a=(r-(this.closed?0:1))*t,o=Math.floor(a),s=a-o,c,h,l,u;if(this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/r)+1)*r:0===s&&o===r-1&&(o=r-2,s=1),c=this.closed||0<o?n[(o-1)%r]:(eu.subVectors(n[0],n[1]).add(n[0]),eu),h=n[o%r],l=n[(o+1)%r],u=this.closed||o+2<r?n[(o+2)%r]:(eu.subVectors(n[r-1],n[r-2]).add(n[r-1]),eu),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(c.distanceToSquared(h),p),f=Math.pow(h.distanceToSquared(l),p),m=Math.pow(l.distanceToSquared(u),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),iu.initNonuniformCatmullRom(c.x,h.x,l.x,u.x,d,f,m),nu.initNonuniformCatmullRom(c.y,h.y,l.y,u.y,d,f,m),ru.initNonuniformCatmullRom(c.z,h.z,l.z,u.z,d,f,m)}else"catmullrom"===this.curveType&&(iu.initCatmullRom(c.x,h.x,l.x,u.x,this.tension),nu.initCatmullRom(c.y,h.y,l.y,u.y,this.tension),ru.initCatmullRom(c.z,h.z,l.z,u.z,this.tension));return i.set(iu.calc(s),nu.calc(s),ru.calc(s)),i},au.prototype.copy=function(t){Ql.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},au.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},au.prototype.fromJSON=function(t){Ql.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new ci).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},((gu.prototype=Object.create(Ql.prototype)).constructor=gu).prototype.isCubicBezierCurve=!0,gu.prototype.getPoint=function(t,e){var i=e||new ai,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(mu(t,n.x,r.x,a.x,o.x),mu(t,n.y,r.y,a.y,o.y)),i},gu.prototype.copy=function(t){return Ql.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},gu.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},gu.prototype.fromJSON=function(t){return Ql.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},((vu.prototype=Object.create(Ql.prototype)).constructor=vu).prototype.isCubicBezierCurve3=!0,vu.prototype.getPoint=function(t,e){var i=e||new ci,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(mu(t,n.x,r.x,a.x,o.x),mu(t,n.y,r.y,a.y,o.y),mu(t,n.z,r.z,a.z,o.z)),i},vu.prototype.copy=function(t){return Ql.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},vu.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},vu.prototype.fromJSON=function(t){return Ql.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},((yu.prototype=Object.create(Ql.prototype)).constructor=yu).prototype.isLineCurve=!0,yu.prototype.getPoint=function(t,e){var i=e||new ai;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},yu.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},yu.prototype.getTangent=function(){var t;return this.v2.clone().sub(this.v1).normalize()},yu.prototype.copy=function(t){return Ql.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},yu.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},yu.prototype.fromJSON=function(t){return Ql.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((xu.prototype=Object.create(Ql.prototype)).constructor=xu).prototype.isLineCurve3=!0,xu.prototype.getPoint=function(t,e){var i=e||new ci;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i},xu.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},xu.prototype.copy=function(t){return Ql.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},xu.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},xu.prototype.fromJSON=function(t){return Ql.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((bu.prototype=Object.create(Ql.prototype)).constructor=bu).prototype.isQuadraticBezierCurve=!0,bu.prototype.getPoint=function(t,e){var i=e||new ai,n=this.v0,r=this.v1,a=this.v2;return i.set(lu(t,n.x,r.x,a.x),lu(t,n.y,r.y,a.y)),i},bu.prototype.copy=function(t){return Ql.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},bu.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},bu.prototype.fromJSON=function(t){return Ql.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((_u.prototype=Object.create(Ql.prototype)).constructor=_u).prototype.isQuadraticBezierCurve3=!0,_u.prototype.getPoint=function(t,e){var i=e||new ci,n=this.v0,r=this.v1,a=this.v2;return i.set(lu(t,n.x,r.x,a.x),lu(t,n.y,r.y,a.y),lu(t,n.z,r.z,a.z)),i},_u.prototype.copy=function(t){return Ql.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},_u.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},_u.prototype.fromJSON=function(t){return Ql.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},((wu.prototype=Object.create(Ql.prototype)).constructor=wu).prototype.isSplineCurve=!0,wu.prototype.getPoint=function(t,e){var i=e||new ai,n=this.points,r=(n.length-1)*t,a=Math.floor(r),o=r-a,s=n[0===a?a:a-1],c=n[a],h=n[a>n.length-2?n.length-1:a+1],l=n[a>n.length-3?n.length-1:a+2];return i.set(ou(o,s.x,c.x,h.x,l.x),ou(o,s.y,c.y,h.y,l.y)),i},wu.prototype.copy=function(t){Ql.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push(n.clone())}return this},wu.prototype.toJSON=function(){var t=Ql.prototype.toJSON.call(this);t.points=[];for(var e=0,i=this.points.length;e<i;e++){var n=this.points[e];t.points.push(n.toArray())}return t},wu.prototype.fromJSON=function(t){Ql.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,i=t.points.length;e<i;e++){var n=t.points[e];this.points.push((new ai).fromArray(n))}return this};var Mu=Object.freeze({ArcCurve:$l,CatmullRomCurve3:au,CubicBezierCurve:gu,CubicBezierCurve3:vu,EllipseCurve:Kl,LineCurve:yu,LineCurve3:xu,QuadraticBezierCurve:bu,QuadraticBezierCurve3:_u,SplineCurve:wu});function Eu(){Ql.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Tu(t){Eu.call(this),this.type="Path",this.currentPoint=new ai,t&&this.setFromPoints(t)}function Su(t){Tu.call(this,t),this.uuid=De.generateUUID(),this.type="Shape",this.holes=[]}function Au(t,e){wa.call(this),this.type="Light",this.color=new Yr(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Lu(t,e,i){Au.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(wa.DefaultUp),this.updateMatrix(),this.groundColor=new Yr(e)}function Ru(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new ai(512,512),this.map=null,this.matrix=new oi}function Cu(){Ru.call(this,new zc(50,1,.5,500))}function Pu(t,e,i,n,r,a){Au.call(this,t,e),this.type="SpotLight",this.position.copy(wa.DefaultUp),this.updateMatrix(),this.target=new wa,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Cu}function Ou(t,e,i,n){Au.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new Ru(new zc(90,1,.5,500))}function Iu(){Ru.call(this,new Ea(-5,5,5,-5,.5,500))}function Nu(t,e){Au.call(this,t,e),this.type="DirectionalLight",this.position.copy(wa.DefaultUp),this.updateMatrix(),this.target=new wa,this.shadow=new Iu}function Du(t,e){Au.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Uu(t,e,i,n){Au.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}Eu.prototype=Object.assign(Object.create(Ql.prototype),{constructor:Eu,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new yu(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e=[],i,n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var h=s[c];i&&i.equals(h)||(e.push(h),i=h)}return this.autoClose&&1<e.length&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){Ql.prototype.copy.call(this,t),this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){var t=Ql.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,i=this.curves.length;e<i;e++){var n=this.curves[e];t.curves.push(n.toJSON())}return t},fromJSON:function(t){Ql.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,i=t.curves.length;e<i;e++){var n=t.curves[e];this.curves.push((new Mu[n.type]).fromJSON(n))}return this}}),Tu.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Tu,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var i=new yu(this.currentPoint.clone(),new ai(t,e));this.curves.push(i),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,i,n){var r=new bu(this.currentPoint.clone(),new ai(t,e),new ai(i,n));this.curves.push(r),this.currentPoint.set(i,n)},bezierCurveTo:function(t,e,i,n,r,a){var o=new gu(this.currentPoint.clone(),new ai(t,e),new ai(i,n),new ai(r,a));this.curves.push(o),this.currentPoint.set(r,a)},splineThru:function(t){var e,i=new wu([this.currentPoint.clone()].concat(t));this.curves.push(i),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,i,n,r,a)},absarc:function(t,e,i,n,r,a){this.absellipse(t,e,i,i,n,r,a)},ellipse:function(t,e,i,n,r,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,i,n,r,a,o,s)},absellipse:function(t,e,i,n,r,a,o,s){var c=new Kl(t,e,i,n,r,a,o,s);if(0<this.curves.length){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)},copy:function(t){return Eu.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Eu.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Eu.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Su.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Su,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){Tu.prototype.copy.call(this,t),this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push(n.clone())}return this},toJSON:function(){var t=Tu.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,i=this.holes.length;e<i;e++){var n=this.holes[e];t.holes.push(n.toJSON())}return t},fromJSON:function(t){Tu.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,i=t.holes.length;e<i;e++){var n=t.holes[e];this.holes.push((new Tu).fromJSON(n))}return this}}),Au.prototype=Object.assign(Object.create(wa.prototype),{constructor:Au,isLight:!0,copy:function(t){return wa.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=wa.prototype.toJSON.call(this,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}}),Lu.prototype=Object.assign(Object.create(Au.prototype),{constructor:Lu,isHemisphereLight:!0,copy:function(t){return Au.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Ru.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),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}}),Cu.prototype=Object.assign(Object.create(Ru.prototype),{constructor:Cu,isSpotLightShadow:!0,update:function(t){var e=this.camera,i=2*De.RAD2DEG*t.angle,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())}}),Pu.prototype=Object.assign(Object.create(Au.prototype),{constructor:Pu,isSpotLight:!0,copy:function(t){return Au.prototype.copy.call(this,t),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}}),Ou.prototype=Object.assign(Object.create(Au.prototype),{constructor:Ou,isPointLight:!0,copy:function(t){return Au.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Iu.prototype=Object.assign(Object.create(Ru.prototype),{constructor:Iu}),Nu.prototype=Object.assign(Object.create(Au.prototype),{constructor:Nu,isDirectionalLight:!0,copy:function(t){return Au.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Du.prototype=Object.assign(Object.create(Au.prototype),{constructor:Du,isAmbientLight:!0}),Uu.prototype=Object.assign(Object.create(Au.prototype),{constructor:Uu,isRectAreaLight:!0,copy:function(t){return Au.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Au.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var Bu={arraySlice:function(t,e,i){return Bu.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(i){function t(t,e){return i[t]-i[e]}for(var e=i.length,n=new Array(e),r=0;r!==e;++r)n[r]=r;return n.sort(t),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,c=0;c!==e;++c)r[o++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[n])&&(e.push(a.time),i.push.apply(i,o)),void 0!==(a=t[r++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[n])&&(e.push(a.time),o.toArray(i,i.length)),void 0!==(a=t[r++]););else for(;void 0!==(o=a[n])&&(e.push(a.time),i.push(o)),void 0!==(a=t[r++]););}}};function Fu(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}function zu(t,e,i,n){Fu.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Gu(t,e,i,n){Fu.call(this,t,e,i,n)}function Hu(t,e,i,n){Fu.call(this,t,e,i,n)}function Vu(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=Bu.convertArray(e,this.TimeBufferType),this.values=Bu.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function ku(t,e,i){Vu.call(this,t,e,i)}function ju(t,e,i,n){Vu.call(this,t,e,i,n)}function Wu(t,e,i,n){Vu.call(this,t,e,i,n)}function Xu(t,e,i,n){Fu.call(this,t,e,i,n)}function qu(t,e,i,n){Vu.call(this,t,e,i,n)}function Yu(t,e,i,n){Vu.call(this,t,e,i,n)}function Ju(t,e,i,n){Vu.call(this,t,e,i,n)}function Zu(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=De.generateUUID(),this.duration<0&&this.resetDuration()}function Qu(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wu;case"vector":case"vector2":case"vector3":case"vector4":return Ju;case"color":return ju;case"quaternion":return qu;case"bool":case"boolean":return ku;case"string":return Yu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function Ku(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=Qu(t.type);if(void 0===t.times){var i=[],n=[];Bu.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function $u(t){this.manager=void 0!==t?t:kl,this.textures={}}function tp(t){this.manager=void 0!==t?t:kl}Object.assign(Fu.prototype,{evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var a;i:{n:if(!(t<n)){for(var o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,t<(n=e[++i]))break e}a=e.length;break i}if(r<=t)break t;var s=e[1];t<s&&(i=2,r=s);for(var o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,(r=e[--i-1])<=t)break e}a=i,i=0}for(;i<a;){var c=i+a>>>1;t<e[c]?a=c:i=c+1}if(n=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,a=0;a!==n;++a)e[a]=i[r+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Fu.prototype,{beforeStart_:Fu.prototype.copySampleValue_,afterEnd_:Fu.prototype.copySampleValue_}),zu.prototype=Object.assign(Object.create(Fu.prototype),{constructor:zu,DefaultSettings_:{endingStart:ve,endingEnd:ve},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case ye:r=t,o=2*e-i;break;case xe:o=e+n[r=n.length-2]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case ye:a=t,s=2*i-e;break;case xe:s=i+n[a=1]-n[0];break;default:a=t-1,s=e}var c=.5*(i-e),h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-i),this._offsetPrev=r*h,this._offsetNext=a*h},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-e)/(n-e),f=d*d,m=f*d,g=-u*m+2*u*f-u*d,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)r[b]=g*a[h+b]+v*a[c+b]+y*a[s+b]+x*a[l+b];return r}}),Gu.prototype=Object.assign(Object.create(Fu.prototype),{constructor:Gu,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=(i-e)/(n-e),l=1-h,u=0;u!==o;++u)r[u]=a[c+u]*l+a[s+u]*h;return r}}),Hu.prototype=Object.assign(Object.create(Fu.prototype),{constructor:Hu,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Vu,{toJSON:function(t){var e=t.constructor,i;if(void 0!==e.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Bu.convertArray(t.times,Array),values:Bu.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(i.interpolation=n)}return i.type=t.ValueTypeName,i}}),Object.assign(Vu.prototype,{constructor:Vu,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:me,InterpolantFactoryMethodDiscrete:function(t){return new Hu(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Gu(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new zu(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case fe:e=this.InterpolantFactoryMethodDiscrete;break;case me:e=this.InterpolantFactoryMethodLinear;break;case ge:e=this.InterpolantFactoryMethodSmooth}if(void 0!==e)return this.createInterpolant=e,this;var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",i),this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return fe;case this.InterpolantFactoryMethodLinear:return me;case this.InterpolantFactoryMethodSmooth:return ge}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,a=n-1;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){a<=r&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Bu.arraySlice(i,r,a),this.values=Bu.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&s<a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==n&&Bu.isTypedArray(n))for(var o=0,c=n.length;o!==c;++o){var h=n[o];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,h),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=this.getInterpolation()===ge,r=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o],h;if(c!==t[o+1]&&(1!==o||c!==c[0]))if(n)s=!0;else for(var l=o*i,u=l-i,p=l+i,d=0;d!==i;++d){var f=e[l+d];if(f!==e[u+d]||f!==e[p+d]){s=!0;break}}if(s){if(o!==r){t[r]=t[o];for(var m=o*i,g=r*i,d=0;d!==i;++d)e[g+d]=e[m+d]}++r}}if(0<a){t[r]=t[a];for(var m=a*i,g=r*i,d=0;d!==i;++d)e[g+d]=e[m+d];++r}return r!==t.length&&(this.times=Bu.arraySlice(t,0,r),this.values=Bu.arraySlice(e,0,r*i)),this}}),ku.prototype=Object.assign(Object.create(Vu.prototype),{constructor:ku,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:fe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ju.prototype=Object.assign(Object.create(Vu.prototype),{constructor:ju,ValueTypeName:"color"}),Wu.prototype=Object.assign(Object.create(Vu.prototype),{constructor:Wu,ValueTypeName:"number"}),Xu.prototype=Object.assign(Object.create(Fu.prototype),{constructor:Xu,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=(i-e)/(n-e),h=s+o;s!==h;s+=4)si.slerpFlat(r,0,a,s-o,a,s,c);return r}}),qu.prototype=Object.assign(Object.create(Vu.prototype),{constructor:qu,ValueTypeName:"quaternion",DefaultInterpolation:me,InterpolantFactoryMethodLinear:function(t){return new Xu(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Yu.prototype=Object.assign(Object.create(Vu.prototype),{constructor:Yu,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:fe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ju.prototype=Object.assign(Object.create(Vu.prototype),{constructor:Ju,ValueTypeName:"vector"}),Object.assign(Zu,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,a=i.length;r!==a;++r)e.push(Ku(i[r]).scale(n));return new Zu(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},r=0,a=i.length;r!==a;++r)e.push(Vu.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,a=[],o=0;o<r;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var h=Bu.getKeyframeOrder(s);s=Bu.sortedArray(s,1,h),c=Bu.sortedArray(c,1,h),n||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new Wu(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/i))}return new Zu(t,-1,a)},findByName:function(t,e){var i=t;if(!Array.isArray(t)){var n=t;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===e)return i[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(r);if(c&&1<c.length){var h,l=n[h=c[1]];l||(n[h]=l=[]),l.push(s)}}var u=[];for(var h in n)u.push(Zu.CreateFromMorphTargetSequence(h,n[h],e,i));return u},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(t,e,i,n,r){if(0!==i.length){var a=[],o=[];Bu.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o))}},n=[],r=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var l={},u=0;u<h.length;u++)if(h[u].morphTargets)for(var p=0;p<h[u].morphTargets.length;p++)l[h[u].morphTargets[p]]=-1;for(var d in l){for(var f=[],m=[],p=0;p!==h[u].morphTargets.length;++p){var g=h[u];f.push(g.time),m.push(g.morphTarget===d?1:0)}n.push(new Wu(".morphTargetInfluence["+d+"]",f,m))}a=l.length*(o||1)}else{var v=".bones["+e[c].name+"]";i(Ju,v+".position",h,"pos",n),i(qu,v+".quaternion",h,"rot",n),i(Ju,v+".scale",h,"scl",n)}}return 0===n.length?null:new Zu(r,a,n);var y}}),Object.assign(Zu.prototype,{resetDuration:function(){for(var t,e=0,i=0,n=this.tracks.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign($u.prototype,{load:function(t,e,i,n){var r=this,a;new Wl(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},setTextures:function(t){this.textures=t},parse:function(t){var e=this.textures;function i(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var n=new Gl[t.type];if(void 0!==t.uuid&&(n.uuid=t.uuid),void 0!==t.name&&(n.name=t.name),void 0!==t.color&&n.color.setHex(t.color),void 0!==t.roughness&&(n.roughness=t.roughness),void 0!==t.metalness&&(n.metalness=t.metalness),void 0!==t.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&n.specular.setHex(t.specular),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.clearCoat&&(n.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(n.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(n.uniforms=t.uniforms),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(n.vertexColors=t.vertexColors),void 0!==t.fog&&(n.fog=t.fog),void 0!==t.flatShading&&(n.flatShading=t.flatShading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.side&&(n.side=t.side),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.alphaTest&&(n.alphaTest=t.alphaTest),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(n.colorWrite=t.colorWrite),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(n.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(n.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(n.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(n.rotation=t.rotation),1!==t.linewidth&&(n.linewidth=t.linewidth),void 0!==t.dashSize&&(n.dashSize=t.dashSize),void 0!==t.gapSize&&(n.gapSize=t.gapSize),void 0!==t.scale&&(n.scale=t.scale),void 0!==t.polygonOffset&&(n.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(n.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(n.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(n.skinning=t.skinning),void 0!==t.morphTargets&&(n.morphTargets=t.morphTargets),void 0!==t.dithering&&(n.dithering=t.dithering),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.shading&&(n.flatShading=1===t.shading),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=i(t.map)),void 0!==t.alphaMap&&(n.alphaMap=i(t.alphaMap),n.transparent=!0),void 0!==t.bumpMap&&(n.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){var r=t.normalScale;!1===Array.isArray(r)&&(r=[r,r]),n.normalScale=(new ai).fromArray(r)}return void 0!==t.displacementMap&&(n.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=i(t.specularMap)),void 0!==t.envMap&&(n.envMap=i(t.envMap)),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.lightMap&&(n.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=i(t.gradientMap)),n}}),Object.assign(tp.prototype,{load:function(t,e,i,n){var r=this,a;new Wl(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},parse:function(t){var e=new ro,i=t.data.index;if(void 0!==i){var n=new ep[i.type](i.array);e.setIndex(new Da(n,1))}var r=t.data.attributes;for(var a in r){var o=r[a],n=new ep[o.type](o.array);e.addAttribute(a,new Da(n,o.itemSize,o.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,h=s.length;c!==h;++c){var l=s[c];e.addGroup(l.start,l.count,l.materialIndex)}var u=t.data.boundingSphere;if(void 0!==u){var p=new ci;void 0!==u.center&&p.fromArray(u.center),e.boundingSphere=new Ii(p,u.radius)}return e}});var ep={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},ip,np,rp,ap;function op(){}op.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,i=0,n=e.length;i<n;i+=2){var r=e[i],a=e[i+1];if(r.test(t))return a}return null}},Object.assign(op.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(t,e,i){for(var n=[],r=0;r<t.length;++r)n[r]=this.createMaterial(t[r],e,i);return n},createMaterial:(ip={NoBlending:pt,NormalBlending:dt,AdditiveBlending:ft,SubtractiveBlending:mt,MultiplyBlending:gt,CustomBlending:vt},np=new Yr,rp=new Zl,ap=new $u,function t(e,h,l){var u={};function i(t,e,i,n,r){var a=h+t,o=op.Handlers.get(a),s;s=null!==o?o.load(a):(rp.setCrossOrigin(l),rp.load(a)),void 0!==e&&(s.repeat.fromArray(e),1!==e[0]&&(s.wrapS=I),1!==e[1]&&(s.wrapT=I)),void 0!==i&&s.offset.fromArray(i),void 0!==n&&("repeat"===n[0]&&(s.wrapS=I),"mirror"===n[0]&&(s.wrapS=Y),"repeat"===n[1]&&(s.wrapT=I),"mirror"===n[1]&&(s.wrapT=Y)),void 0!==r&&(s.anisotropy=r);var c=De.generateUUID();return u[c]=s,c}var n={uuid:De.generateUUID(),type:"MeshLambertMaterial"};for(var r in e){var a=e[r];switch(r){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":n.name=a;break;case"blending":n.blending=ip[a];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",r,"is no longer supported.");break;case"colorDiffuse":n.color=np.fromArray(a).getHex();break;case"colorSpecular":n.specular=np.fromArray(a).getHex();break;case"colorEmissive":n.emissive=np.fromArray(a).getHex();break;case"specularCoef":n.shininess=a;break;case"shading":"basic"===a.toLowerCase()&&(n.type="MeshBasicMaterial"),"phong"===a.toLowerCase()&&(n.type="MeshPhongMaterial"),"standard"===a.toLowerCase()&&(n.type="MeshStandardMaterial");break;case"mapDiffuse":n.map=i(a,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":n.emissiveMap=i(a,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":n.lightMap=i(a,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":n.aoMap=i(a,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":n.bumpMap=i(a,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":n.bumpScale=a;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":n.normalMap=i(a,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":n.normalScale=a;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":n.specularMap=i(a,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":n.metalnessMap=i(a,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":n.roughnessMap=i(a,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":n.alphaMap=i(a,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":n.side=Ht;break;case"doubleSided":n.side=ut;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),n.opacity=a;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":n[r]=a;break;case"vertexColors":!0===a&&(n.vertexColors=v),"face"===a&&(n.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",r,a)}}return"MeshBasicMaterial"===n.type&&delete n.emissive,"MeshPhongMaterial"!==n.type&&delete n.specular,n.opacity<1&&(n.transparent=!0),ap.setTextures(u),ap.parse(n)})});var sp={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);return decodeURIComponent(escape(e))},extractUrlBase:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function cp(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:kl,this.withCredentials=!1}function hp(t){this.manager=void 0!==t?t:kl,this.texturePath=""}Object.assign(cp.prototype,{crossOrigin:"anonymous",load:function(a,o,t,e){var s=this,c=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:sp.extractUrlBase(a),i=new Wl(this.manager);i.setWithCredentials(this.withCredentials),i.load(a,function(t){var e=JSON.parse(t),i=e.metadata;if(void 0!==i){var n=i.type;if(void 0!==n&&"object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.")}var r=s.parse(e,c);o(r.geometry,r.materials)},t,e)},setCrossOrigin:function(t){return this.crossOrigin=t,this},setTexturePath:function(t){return this.texturePath=t,this},parse:function(){function a(t,e){function i(t,e){return t&1<<e}var n,r,a,o,s,c,h,l,u,p,d,f,m,g,v,y,x,b,_,w,M,E,T,S,A,L,R,C=t.faces,P=t.vertices,O=t.normals,I=t.colors,N=t.scale,D=0;if(void 0!==t.uvs){for(n=0;n<t.uvs.length;n++)t.uvs[n].length&&D++;for(n=0;n<D;n++)e.faceVertexUvs[n]=[]}for(o=0,s=P.length;o<s;)(b=new ci).x=P[o++]*N,b.y=P[o++]*N,b.z=P[o++]*N,e.vertices.push(b);for(o=0,s=C.length;o<s;)if(d=i(p=C[o++],0),f=i(p,1),m=i(p,3),g=i(p,4),v=i(p,5),y=i(p,6),x=i(p,7),d){if((w=new Ta).a=C[o],w.b=C[o+1],w.c=C[o+3],(M=new Ta).a=C[o+1],M.b=C[o+2],M.c=C[o+3],o+=4,f&&(u=C[o++],w.materialIndex=u,M.materialIndex=u),a=e.faces.length,m)for(n=0;n<D;n++)for(S=t.uvs[n],e.faceVertexUvs[n][a]=[],e.faceVertexUvs[n][a+1]=[],r=0;r<4;r++)A=new ai(L=S[2*(l=C[o++])],R=S[2*l+1]),2!==r&&e.faceVertexUvs[n][a].push(A),0!==r&&e.faceVertexUvs[n][a+1].push(A);if(g&&(h=3*C[o++],w.normal.set(O[h++],O[h++],O[h]),M.normal.copy(w.normal)),v)for(n=0;n<4;n++)h=3*C[o++],T=new ci(O[h++],O[h++],O[h]),2!==n&&w.vertexNormals.push(T),0!==n&&M.vertexNormals.push(T);if(y&&(E=I[c=C[o++]],w.color.setHex(E),M.color.setHex(E)),x)for(n=0;n<4;n++)E=I[c=C[o++]],2!==n&&w.vertexColors.push(new Yr(E)),0!==n&&M.vertexColors.push(new Yr(E));e.faces.push(w),e.faces.push(M)}else{if((_=new Ta).a=C[o++],_.b=C[o++],_.c=C[o++],f&&(u=C[o++],_.materialIndex=u),a=e.faces.length,m)for(n=0;n<D;n++)for(S=t.uvs[n],e.faceVertexUvs[n][a]=[],r=0;r<3;r++)A=new ai(L=S[2*(l=C[o++])],R=S[2*l+1]),e.faceVertexUvs[n][a].push(A);if(g&&(h=3*C[o++],_.normal.set(O[h++],O[h++],O[h])),v)for(n=0;n<3;n++)h=3*C[o++],T=new ci(O[h++],O[h++],O[h]),_.vertexNormals.push(T);if(y&&(c=C[o++],_.color.setHex(I[c])),x)for(n=0;n<3;n++)c=C[o++],_.vertexColors.push(new Yr(I[c]));e.faces.push(_)}}function o(t,e){var i=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var n=0,r=t.skinWeights.length;n<r;n+=i){var a=t.skinWeights[n],o=1<i?t.skinWeights[n+1]:0,s=2<i?t.skinWeights[n+2]:0,c=3<i?t.skinWeights[n+3]:0;e.skinWeights.push(new Li(a,o,s,c))}if(t.skinIndices)for(var n=0,r=t.skinIndices.length;n<r;n+=i){var h=t.skinIndices[n],l=1<i?t.skinIndices[n+1]:0,u=2<i?t.skinIndices[n+2]:0,p=3<i?t.skinIndices[n+3]:0;e.skinIndices.push(new Li(h,l,u,p))}e.bones=t.bones,e.bones&&0<e.bones.length&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}function s(t,e){var i=t.scale;if(void 0!==t.morphTargets)for(var n=0,r=t.morphTargets.length;n<r;n++){e.morphTargets[n]={},e.morphTargets[n].name=t.morphTargets[n].name,e.morphTargets[n].vertices=[];for(var a=e.morphTargets[n].vertices,o=t.morphTargets[n].vertices,s=0,c=o.length;s<c;s+=3){var h=new ci;h.x=o[s]*i,h.y=o[s+1]*i,h.z=o[s+2]*i,a.push(h)}}if(void 0!==t.morphColors&&0<t.morphColors.length){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var l=e.faces,u=t.morphColors[0].colors,n=0,r=l.length;n<r;n++)l[n].color.fromArray(u,3*n)}}function c(t,e){var i=[],n=[];void 0!==t.animation&&n.push(t.animation),void 0!==t.animations&&(t.animations.length?n=n.concat(t.animations):n.push(t.animations));for(var r=0;r<n.length;r++){var a=Zu.parseAnimation(n[r],e.bones);a&&i.push(a)}if(e.morphTargets){var o=Zu.CreateClipsFromMorphTargetSequences(e.morphTargets,10);i=i.concat(o)}0<i.length&&(e.animations=i)}return function t(e,i){void 0!==e.data&&(e=e.data),void 0!==e.scale?e.scale=1/e.scale:e.scale=1;var n=new Na,r;return a(e,n),o(e,n),s(e,n),c(e,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:n}:{geometry:n,materials:op.prototype.initMaterials(e.materials,i,this.crossOrigin)}}}()}),Object.assign(hp.prototype,{crossOrigin:"anonymous",load:function(n,r,t,a){""===this.texturePath&&(this.texturePath=n.substring(0,n.lastIndexOf("/")+1));var o=this,e;new Wl(o.manager).load(n,function(t){var e=null;try{e=JSON.parse(t)}catch(t){return void 0!==a&&a(t),void console.error("THREE:ObjectLoader: Can't parse "+n+".",t.message)}var i=e.metadata;void 0!==i&&void 0!==i.type&&"geometry"!==i.type.toLowerCase()?o.parse(e,r):console.error("THREE.ObjectLoader: Can't load "+n+". Use THREE.JSONLoader instead.")},t,a)},setTexturePath:function(t){return this.texturePath=t,this},setCrossOrigin:function(t){return this.crossOrigin=t,this},parse:function(t,e){var i=this.parseShape(t.shapes),n=this.parseGeometries(t.geometries,i),r=this.parseImages(t.images,function(){void 0!==e&&e(s)}),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),s=this.parseObject(t.object,n,o);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var i=0,n=t.length;i<n;i++){var r=(new Su).fromJSON(t[i]);e[r.uuid]=r}return e},parseGeometries:function(t,e){var i={};if(void 0!==t)for(var n=new cp,r=new tp,a=0,o=t.length;a<o;a++){var s,c=t[a];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Cl[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Cl[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Cl[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Cl[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Cl[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Cl[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Cl[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Cl[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Cl[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Cl[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Cl[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Cl[c.type](c.vertices,c.indices,c.radius,c.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var h=[],l=0,u=c.shapes.length;l<u;l++){var p=e[c.shapes[l]];h.push(p)}s=new Cl[c.type](h,c.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(var h=[],l=0,u=c.shapes.length;l<u;l++){var p=e[c.shapes[l]];h.push(p)}var d=c.options.extrudePath;void 0!==d&&(c.options.extrudePath=(new Mu[d.type]).fromJSON(d)),s=new Cl[c.type](h,c.options);break;case"BufferGeometry":s=r.parse(c);break;case"Geometry":s=n.parse(c,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),!0===s.isBufferGeometry&&void 0!==c.userData&&(s.userData=c.userData),i[c.uuid]=s}return i},parseMaterials:function(t,e){var i={};if(void 0!==t){var n=new $u;n.setTextures(e);for(var r=0,a=t.length;r<a;r++){var o=t[r];if("MultiMaterial"===o.type){for(var s=[],c=0;c<o.materials.length;c++)s.push(n.parse(o.materials[c]));i[o.uuid]=s}else i[o.uuid]=n.parse(o)}}return i},parseAnimations:function(t){for(var e=[],i=0;i<t.length;i++){var n=t[i],r=Zu.parse(n);void 0!==n.uuid&&(r.uuid=n.uuid),e.push(r)}return e},parseImages:function(t,e){var i=this,n={};function r(t){return i.manager.itemStart(t),o.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemEnd(t),i.manager.itemError(t)})}if(void 0!==t&&0<t.length){var a,o=new Yl(new Vl(e));o.setCrossOrigin(this.crossOrigin);for(var s=0,c=t.length;s<c;s++){var h=t[s],l=h.url;if(Array.isArray(l)){n[h.uuid]=[];for(var u=0,p=l.length;u<p;u++){var d=l[u],f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:i.texturePath+d;n[h.uuid].push(r(f))}}else{var f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url)?h.url:i.texturePath+h.url;n[h.uuid]=r(f)}}}return n},parseTextures:function(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var n={};if(void 0!==t)for(var r=0,a=t.length;r<a;r++){var o=t[r],s;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image),(s=Array.isArray(e[o.image])?new Ko(e[o.image]):new Ai(e[o.image])).needsUpdate=!0,s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=i(o.mapping,lp)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=i(o.wrap[0],up),s.wrapT=i(o.wrap[1],up)),void 0!==o.format&&(s.format=o.format),void 0!==o.minFilter&&(s.minFilter=i(o.minFilter,pp)),void 0!==o.magFilter&&(s.magFilter=i(o.magFilter,pp)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),n[o.uuid]=s}return n},parseObject:function(t,e,a){var i;function n(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function r(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];void 0===a[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(a[r])}return e}return void 0===a[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),a[t]}}switch(t.type){case"Scene":i=new Xc,void 0!==t.background&&Number.isInteger(t.background)&&(i.background=new Yr(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?i.fog=new Wc(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(i.fog=new jc(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":i=new zc(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(i.focus=t.focus),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.filmGauge&&(i.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(i.filmOffset=t.filmOffset),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"OrthographicCamera":i=new Ea(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"AmbientLight":i=new Du(t.color,t.intensity);break;case"DirectionalLight":i=new Nu(t.color,t.intensity);break;case"PointLight":i=new Ou(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":i=new Uu(t.color,t.intensity,t.width,t.height);break;case"SpotLight":i=new Pu(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":i=new Lu(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=n(t.geometry),s=r(t.material);i=o.bones&&0<o.bones.length?new th(o,s):new Go(o,s);break;case"LOD":i=new Qc;break;case"Line":i=new ih(n(t.geometry),r(t.material),t.mode);break;case"LineLoop":i=new rh(n(t.geometry),r(t.material));break;case"LineSegments":i=new nh(n(t.geometry),r(t.material));break;case"PointCloud":case"Points":i=new oh(n(t.geometry),r(t.material));break;case"Sprite":i=new Zc(r(t.material));break;case"Group":i=new Fc;break;default:i=new wa}if(i.uuid=t.uuid,void 0!==t.name&&(i.name=t.name),void 0!==t.matrix?(i.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(i.matrixAutoUpdate=t.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.rotation&&i.rotation.fromArray(t.rotation),void 0!==t.quaternion&&i.quaternion.fromArray(t.quaternion),void 0!==t.scale&&i.scale.fromArray(t.scale)),void 0!==t.castShadow&&(i.castShadow=t.castShadow),void 0!==t.receiveShadow&&(i.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(i.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(i.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&i.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(i.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.frustumCulled&&(i.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(i.renderOrder=t.renderOrder),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.layers&&(i.layers.mask=t.layers),void 0!==t.children)for(var c=t.children,h=0;h<c.length;h++)i.add(this.parseObject(c[h],e,a));if("LOD"===t.type)for(var l=t.levels,u=0;u<l.length;u++){var p=l[u],d=i.getObjectByProperty("uuid",p.object);void 0!==d&&i.addLevel(d,p.distance)}return i}});var lp={UVMapping:O,CubeReflectionMapping:G,CubeRefractionMapping:H,EquirectangularReflectionMapping:V,EquirectangularRefractionMapping:k,SphericalReflectionMapping:j,CubeUVReflectionMapping:W,CubeUVRefractionMapping:X},up={RepeatWrapping:I,ClampToEdgeWrapping:q,MirroredRepeatWrapping:Y},pp={NearestFilter:J,NearestMipMapNearestFilter:Z,NearestMipMapLinearFilter:Q,LinearFilter:K,LinearMipMapNearestFilter:$,LinearMipMapLinearFilter:tt},dp;function fp(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==t?t:kl,this.options=void 0}function mp(){this.type="ShapePath",this.color=new Yr,this.subPaths=[],this.currentPath=null}function gp(t){this.type="Font",this.data=t}function vp(t,e,i){for(var n=Array.from?Array.from(t):String(t).split(""),r=e/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,o=[],s=0,c=0,h=0;h<n.length;h++){var l=n[h];if("\n"===l)s=0,c-=a;else{var u=yp(l,r,s,c,i);s+=u.offsetX,o.push(u.path)}}return o}function yp(t,e,i,n,r){var a=r.glyphs[t]||r.glyphs["?"];if(a){var o=new mp,s,c,h,l,u,p,d,f;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,v=m.length;g<v;){var y;switch(m[g++]){case"m":s=m[g++]*e+i,c=m[g++]*e+n,o.moveTo(s,c);break;case"l":s=m[g++]*e+i,c=m[g++]*e+n,o.lineTo(s,c);break;case"q":h=m[g++]*e+i,l=m[g++]*e+n,u=m[g++]*e+i,p=m[g++]*e+n,o.quadraticCurveTo(u,p,h,l);break;case"b":h=m[g++]*e+i,l=m[g++]*e+n,u=m[g++]*e+i,p=m[g++]*e+n,d=m[g++]*e+i,f=m[g++]*e+n,o.bezierCurveTo(u,p,d,f,h,l)}}return{offsetX:a.ha*e,path:o}}}function xp(t){this.manager=void 0!==t?t:kl}fp.prototype={constructor:fp,setOptions:function t(e){return this.options=e,this},load:function(e,i,t,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Hl.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){i&&i(a),r.manager.itemEnd(e)},0),a;fetch(e).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,r.options)}).then(function(t){Hl.add(e,t),i&&i(t),r.manager.itemEnd(e)}).catch(function(t){n&&n(t),r.manager.itemEnd(e),r.manager.itemError(e)})},setCrossOrigin:function(){return this},setPath:function(t){return this.path=t,this}},Object.assign(mp.prototype,{moveTo:function(t,e){this.currentPath=new Tu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,i,n){this.currentPath.quadraticCurveTo(t,e,i,n)},bezierCurveTo:function(t,e,i,n,r,a){this.currentPath.bezierCurveTo(t,e,i,n,r,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],a=new Su;a.curves=r.curves,e.push(a)}return e}function n(t,e){for(var i=e.length,n=!1,r=i-1,a=0;a<i;r=a++){var o=e[r],s=e[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n}var r=al.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return i(a);var o,s,c,h=[];if(1===a.length)return s=a[0],(c=new Su).curves=s.curves,h.push(c),h;var l=!r(a[0].getPoints());l=t?!l:l;var u=[],p=[],d=[],f=0,m,g;p[f]=void 0,d[f]=[];for(var v=0,y=a.length;v<y;v++)o=r(m=(s=a[v]).getPoints()),(o=t?!o:o)?(!l&&p[f]&&f++,p[f]={s:new Su,p:m},p[f].s.curves=s.curves,l&&f++,d[f]=[]):d[f].push({h:s,p:m[0]});if(!p[0])return i(a);if(1<p.length){for(var x=!1,b=[],_=0,w=p.length;_<w;_++)u[_]=[];for(var _=0,w=p.length;_<w;_++)for(var M=d[_],E=0;E<M.length;E++){for(var T=M[E],S=!0,A=0;A<p.length;A++)n(T.p,p[A].p)&&(_!==A&&b.push({froms:_,tos:A,hole:E}),S?(S=!1,u[A].push(T)):x=!0);S&&u[_].push(T)}0<b.length&&(x||(d=u))}for(var v=0,L=p.length;v<L;v++){c=p[v].s,h.push(c);for(var R=0,C=(g=d[v]).length;R<C;R++)c.holes.push(g[R].h)}return h}}),Object.assign(gp.prototype,{isFont:!0,generateShapes:function(t,e){void 0===e&&(e=100);for(var i=[],n=vp(t,e,this.data),r=0,a=n.length;r<a;r++)Array.prototype.push.apply(i,n[r].toShapes());return i}}),Object.assign(xp.prototype,{load:function(t,n,e,i){var r=this,a=new Wl(this.manager);a.setPath(this.path),a.load(t,function(e){var i;try{i=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(e.substring(65,e.length-2))}var t=r.parse(i);n&&n(t)},e,i)},parse:function(t){return new gp(t)},setPath:function(t){return this.path=t,this}});var bp={getContext:function(){return void 0===dp&&(dp=new(window.AudioContext||window.webkitAudioContext)),dp},setContext:function(t){dp=t}},_p,wp,Mp,Ep,Tp,Sp,Ap,Lp,Rp,Cp,Pp,Op,Ip,Np,Dp,Up,Bp,Fp;function zp(t){this.manager=void 0!==t?t:kl}function Gp(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new zc,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new zc,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Hp(t,e,i){wa.call(this),this.type="CubeCamera";var n=90,r=1,a=new zc(90,1,t,e);a.up.set(0,-1,0),a.lookAt(new ci(1,0,0)),this.add(a);var o=new zc(90,1,t,e);o.up.set(0,-1,0),o.lookAt(new ci(-1,0,0)),this.add(o);var s=new zc(90,1,t,e);s.up.set(0,0,1),s.lookAt(new ci(0,1,0)),this.add(s);var c=new zc(90,1,t,e);c.up.set(0,0,-1),c.lookAt(new ci(0,-1,0)),this.add(c);var h=new zc(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new ci(0,0,1)),this.add(h);var l=new zc(90,1,t,e);l.up.set(0,-1,0),l.lookAt(new ci(0,0,-1)),this.add(l);var u={format:Rt,magFilter:K,minFilter:K};this.renderTarget=new Ci(i,i,u),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,n=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,t.render(e,a,i),i.activeCubeFace=1,t.render(e,o,i),i.activeCubeFace=2,t.render(e,s,i),i.activeCubeFace=3,t.render(e,c,i),i.activeCubeFace=4,t.render(e,h,i),i.texture.generateMipmaps=n,i.activeCubeFace=5,t.render(e,l,i),t.setRenderTarget(null)},this.clear=function(t,e,i,n){for(var r=this.renderTarget,a=0;a<6;a++)r.activeCubeFace=a,t.setRenderTarget(r),t.clear(e,i,n);t.setRenderTarget(null)}}function Vp(){wa.call(this),this.type="AudioListener",this.context=bp.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function kp(t){wa.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function jp(t){kp.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Wp(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Xp(t,e,i){this.binding=t,this.valueSize=i;var n=Float64Array,r;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":n=Array,r=this._select;break;default:r=this._lerp}this.buffer=new n(4*i),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(zp.prototype,{load:function(t,n,e,i){var r=new Wl(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){var e=t.slice(0),i;bp.getContext().decodeAudioData(e,function(t){n(t)})},e,i)}}),Object.assign(Gp.prototype,{update:(Rp=new oi,Cp=new oi,function t(e){var i;if(_p!==this||wp!==e.focus||Mp!==e.fov||Ep!==e.aspect*this.aspect||Tp!==e.near||Sp!==e.far||Ap!==e.zoom||Lp!==this.eyeSep){_p=this,wp=e.focus,Mp=e.fov,Ep=e.aspect*this.aspect,Tp=e.near,Sp=e.far,Ap=e.zoom;var n=e.projectionMatrix.clone(),r=(Lp=this.eyeSep/2)*Tp/wp,a=Tp*Math.tan(De.DEG2RAD*Mp*.5)/Ap,o,s;Cp.elements[12]=-Lp,Rp.elements[12]=Lp,o=-a*Ep+r,s=a*Ep+r,n.elements[0]=2*Tp/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraL.projectionMatrix.copy(n),o=-a*Ep-r,s=a*Ep-r,n.elements[0]=2*Tp/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Cp),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Rp)})}),(Hp.prototype=Object.create(wa.prototype)).constructor=Hp,Vp.prototype=Object.assign(Object.create(wa.prototype),{constructor:Vp,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},updateMatrixWorld:(Pp=new ci,Op=new si,Ip=new ci,Np=new ci,function t(e){wa.prototype.updateMatrixWorld.call(this,e);var i=this.context.listener,n=this.up;this.matrixWorld.decompose(Pp,Op,Ip),Np.set(0,0,-1).applyQuaternion(Op),i.positionX?(i.positionX.setValueAtTime(Pp.x,this.context.currentTime),i.positionY.setValueAtTime(Pp.y,this.context.currentTime),i.positionZ.setValueAtTime(Pp.z,this.context.currentTime),i.forwardX.setValueAtTime(Np.x,this.context.currentTime),i.forwardY.setValueAtTime(Np.y,this.context.currentTime),i.forwardZ.setValueAtTime(Np.z,this.context.currentTime),i.upX.setValueAtTime(n.x,this.context.currentTime),i.upY.setValueAtTime(n.y,this.context.currentTime),i.upZ.setValueAtTime(n.z,this.context.currentTime)):(i.setPosition(Pp.x,Pp.y,Pp.z),i.setOrientation(Np.x,Np.y,Np.z,n.x,n.y,n.z))})}),kp.prototype=Object.assign(Object.create(wa.prototype),{constructor:kp,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setMediaElementSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),this.startTime=this.context.currentTime,t.start(this.startTime,this.offset),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}),jp.prototype=Object.assign(Object.create(kp.prototype),{constructor:jp,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){return this.panner.refDistance=t,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){return this.panner.rolloffFactor=t,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){return this.panner.distanceModel=t,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){return this.panner.maxDistance=t,this},setDirectionalCone:function(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this},updateMatrixWorld:(Dp=new ci,Up=new si,Bp=new ci,Fp=new ci,function t(e){wa.prototype.updateMatrixWorld.call(this,e);var i=this.panner;this.matrixWorld.decompose(Dp,Up,Bp),Fp.set(0,0,1).applyQuaternion(Up),i.setPosition(Dp.x,Dp.y,Dp.z),i.setOrientation(Fp.x,Fp.y,Fp.z)})}),Object.assign(Wp.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),Object.assign(Xp.prototype,{accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=3*e;this._mixBufferRegion(i,n,o,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(i[s]!==i[s+e]){a.setValue(i,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=3*i;t.getValue(e,n);for(var r=i,a=n;r!==a;++r)e[r]=e[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,i,n,r){if(.5<=n)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n){si.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}});var qp="\\[\\]\\.:\\/",Yp,Jp,Zp,Qp,Kp,$p,td,ed,id,nd,rd,ad,od,sd,cd,hd,ld,ud,pd,dd,fd,md,gd,vd,yd,xd,bd,_d,wd,Md,Ed,Td,Sd,Ad,Ld;function Rd(t,e,i){var n=i||Cd.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function Cd(t,e,i){this.path=e,this.parsedPath=i||Cd.parseTrackName(e),this.node=Cd.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Pd(){this.uuid=De.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function Od(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:ve,endingEnd:ve},s=0;s!==r;++s){var c=n[s].createInterpolant(null);(a[s]=c).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pe,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}function Id(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Nd(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Dd(){ro.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Ud(t,e,i){qc.call(this,t,e),this.meshPerAttribute=i||1}function Bd(t,e,i){Da.call(this,t,e),this.meshPerAttribute=i||1}function Fd(t,e,i,n){this.ray=new Fo(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function zd(t,e){return t.distance-e.distance}function Gd(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n))for(var r=t.children,a=0,o=r.length;a<o;a++)Gd(r[a],e,i,!0)}function Hd(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Vd(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this}function kd(t,e,i){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==i?i:0,this}function jd(t,e){this.min=void 0!==t?t:new ai(1/0,1/0),this.max=void 0!==e?e:new ai(-1/0,-1/0)}function Wd(t,e){this.start=void 0!==t?t:new ci,this.end=void 0!==e?e:new ci}function Xd(t){wa.call(this),this.material=t,this.render=function(){}}function qd(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new ro,h=new ka(2*o*3,3);c.addAttribute("position",h),nh.call(this,c,new eh({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Yd(t,e){wa.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var i=new ro,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1,o=32;r<32;r++,a++){var s=r/32*Math.PI*2,c=a/32*Math.PI*2;n.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}i.addAttribute("position",new ka(n,3));var h=new eh({fog:!1});this.cone=new nh(i,h),this.add(this.cone),this.update()}function Jd(t){var e=[];t&&t.isBone&&e.push(t);for(var i=0;i<t.children.length;i++)e.push.apply(e,Jd(t.children[i]));return e}function Zd(t){for(var e=Jd(t),i=new ro,n=[],r=[],a=new Yr(0,0,1),o=new Yr(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}i.addAttribute("position",new ka(n,3)),i.addAttribute("color",new ka(r,3));var h=new eh({vertexColors:v,depthTest:!1,depthWrite:!1,transparent:!0});nh.call(this,i,h),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}function Qd(t,e,i){this.light=t,this.light.updateMatrixWorld(),this.color=i;var n=new ml(e,4,2),r=new Uo({wireframe:!0,fog:!1});Go.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Kd(t,e){wa.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;var i=new eh({fog:!1}),n=new ro;n.addAttribute("position",new Da(new Float32Array(15),3)),this.line=new ih(n,i),this.add(this.line),this.update()}function $d(t,e,i){wa.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;var n=new xh(e);n.rotateY(.5*Math.PI),this.material=new Uo({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=v);var r=n.getAttribute("position"),a=new Float32Array(3*r.count);n.addAttribute("color",new Da(a,3)),this.add(new Go(n,this.material)),this.update()}function tf(t,e,i,n){t=t||10,e=e||10,i=new Yr(void 0!==i?i:4473924),n=new Yr(void 0!==n?n:8947848);for(var r=e/2,a=t/e,o=t/2,s=[],c=[],h=0,l=0,u=-o;h<=e;h++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=h===r?i:n;p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3}var d=new ro;d.addAttribute("position",new ka(s,3)),d.addAttribute("color",new ka(c,3));var f=new eh({vertexColors:v});nh.call(this,d,f)}function ef(t,e,i,n,r,a){t=t||10,e=e||16,i=i||8,n=n||64,r=new Yr(void 0!==r?r:4473924),a=new Yr(void 0!==a?a:8947848);var o=[],s=[],c,h,l,u,p,d,f;for(u=0;u<=e;u++)l=u/e*(2*Math.PI),c=Math.sin(l)*t,h=Math.cos(l)*t,o.push(0,0,0),o.push(c,0,h),f=1&u?r:a,s.push(f.r,f.g,f.b),s.push(f.r,f.g,f.b);for(u=0;u<=i;u++)for(f=1&u?r:a,d=t-t/i*u,p=0;p<n;p++)l=p/n*(2*Math.PI),c=Math.sin(l)*d,h=Math.cos(l)*d,o.push(c,0,h),s.push(f.r,f.g,f.b),l=(p+1)/n*(2*Math.PI),c=Math.sin(l)*d,h=Math.cos(l)*d,o.push(c,0,h),s.push(f.r,f.g,f.b);var m=new ro;m.addAttribute("position",new ka(o,3)),m.addAttribute("color",new ka(s,3));var g=new eh({vertexColors:v});nh.call(this,m,g)}function nf(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new ro,h=new ka(2*o*3,3);c.addAttribute("position",h),nh.call(this,c,new eh({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function rf(t,e,i){wa.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,void 0===e&&(e=1);var n=new ro;n.addAttribute("position",new ka([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var r=new eh({fog:!1});this.lightPlane=new ih(n,r),this.add(this.lightPlane),(n=new ro).addAttribute("position",new ka([0,0,0,0,0,1],3)),this.targetLine=new ih(n,r),this.add(this.targetLine),this.update()}function af(t){var e=new ro,i=new eh({color:16777215,vertexColors:1}),n=[],r=[],a={},o=new Yr(16755200),s=new Yr(16711680),c=new Yr(43775),h=new Yr(16777215),l=new Yr(3355443);function u(t,e,i){p(t,i),p(e,i)}function p(t,e){n.push(0,0,0),r.push(e.r,e.g,e.b),void 0===a[t]&&(a[t]=[]),a[t].push(n.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c),u("c","t",h),u("p","c",l),u("cn1","cn2",l),u("cn3","cn4",l),u("cf1","cf2",l),u("cf3","cf4",l),e.addAttribute("position",new ka(n,3)),e.addAttribute("color",new ka(r,3)),nh.call(this,e,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function of(t,e){this.object=t,void 0===e&&(e=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new ro;r.setIndex(new Da(i,1)),r.addAttribute("position",new Da(n,3)),nh.call(this,r,new eh({color:e})),this.matrixAutoUpdate=!1,this.update()}function sf(t,e){this.type="Box3Helper",this.box=t;var i=void 0!==e?e:16776960,n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],a=new ro;a.setIndex(new Da(n,1)),a.addAttribute("position",new ka(r,3)),nh.call(this,a,new eh({color:i})),this.geometry.computeBoundingSphere()}function cf(t,e,i){this.type="PlaneHelper",this.plane=t,this.size=void 0===e?1:e;var n=void 0!==i?i:16776960,r=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new ro;a.addAttribute("position",new ka(r,3)),a.computeBoundingSphere(),ih.call(this,a,new eh({color:n}));var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new ro;s.addAttribute("position",new ka(o,3)),s.computeBoundingSphere(),this.add(new Go(s,new Uo({color:n,opacity:.2,transparent:!0,depthWrite:!1})))}function hf(t,e,i,n,r,a){wa.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),void 0===Td&&((Td=new ro).addAttribute("position",new ka([0,0,0,0,1,0],3)),(Sd=new Tl(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new ih(Td,new eh({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Go(Sd,new Uo({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,a)}function lf(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new ro;n.addAttribute("position",new ka(e,3)),n.addAttribute("color",new ka(i,3));var r=new eh({vertexColors:v});nh.call(this,n,r)}function uf(t,e,i,n,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Ta(t,e,i,r,a,o)}Object.assign(Rd.prototype,{getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(Cd,{Composite:Rd,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new Cd.Composite(t,e,i):new Cd(t,e,i)},sanitizeNodeName:(id=new RegExp("["+qp+"]","g"),function t(e){return e.replace(/\s/g,"_").replace(id,"")}),parseTrackName:(Yp="[^"+qp+"]",Jp="[^"+qp.replace("\\.","")+"]",Zp=/((?:WC+[\/:])*)/.source.replace("WC",Yp),Qp=/(WCOD+)?/.source.replace("WCOD",Jp),Kp=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Yp),$p=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Yp),td=new RegExp("^"+Zp+Qp+Kp+$p+"$"),ed=["material","materials","bones"],function t(e){var i=td.exec(e);if(!i)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var a=n.nodeName.substring(r+1);-1!==ed.indexOf(a)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=a)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}),findNode:function(t,r){if(!r||""===r||"root"===r||"."===r||-1===r||r===t.name||r===t.uuid)return t;if(t.skeleton){var e=t.skeleton.getBoneByName(r);if(void 0!==e)return e}if(t.children){var a=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(i.name===r||i.uuid===r)return i;var n=a(i.children);if(n)return n}return null},i=a(t.children);if(i)return i}return null}}),Object.assign(Cd.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function t(e,i){e[i]=this.node[this.propertyName]},function t(e,i){for(var n=this.resolvedProperty,r=0,a=n.length;r!==a;++r)e[i++]=n[r]},function t(e,i){e[i]=this.resolvedProperty[this.propertyIndex]},function t(e,i){this.resolvedProperty.toArray(e,i)}],SetterByBindingTypeAndVersioning:[[function t(e,i){this.targetObject[this.propertyName]=e[i]},function t(e,i){this.targetObject[this.propertyName]=e[i],this.targetObject.needsUpdate=!0},function t(e,i){this.targetObject[this.propertyName]=e[i],this.targetObject.matrixWorldNeedsUpdate=!0}],[function t(e,i){for(var n=this.resolvedProperty,r=0,a=n.length;r!==a;++r)n[r]=e[i++]},function t(e,i){for(var n=this.resolvedProperty,r=0,a=n.length;r!==a;++r)n[r]=e[i++];this.targetObject.needsUpdate=!0},function t(e,i){for(var n=this.resolvedProperty,r=0,a=n.length;r!==a;++r)n[r]=e[i++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function t(e,i){this.resolvedProperty[this.propertyIndex]=e[i]},function t(e,i){this.resolvedProperty[this.propertyIndex]=e[i],this.targetObject.needsUpdate=!0},function t(e,i){this.resolvedProperty[this.propertyIndex]=e[i],this.targetObject.matrixWorldNeedsUpdate=!0}],[function t(e,i){this.resolvedProperty.fromArray(e,i)},function t(e,i){this.resolvedProperty.fromArray(e,i),this.targetObject.needsUpdate=!0},function t(e,i){this.resolvedProperty.fromArray(e,i),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function t(e,i){this.bind(),this.getValue(e,i)},setValue:function t(e,i){this.bind(),this.setValue(e,i)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=Cd.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var a=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(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}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!==a){if(void 0===t[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[a]}}var s=t[n];if(void 0!==s){var c=this.Versioning.None;void 0!==t.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var h=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.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(var o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(t.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===r){r=o;break}}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}else{var l=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+n+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Cd.prototype,{_getValue_unbound:Cd.prototype.getValue,_setValue_unbound:Cd.prototype.setValue}),Object.assign(Pd.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=n[p];if(void 0===d){d=e++,n[p]=d,t.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new Cd(u,r[f],a[f]))}else if(d<i){c=t[d];var g=--i,v=t[g];t[n[v.uuid]=d]=v,t[n[p]=g]=u;for(var f=0,m=s;f!==m;++f){var y=o[f],x=y[g],b=y[d];y[d]=x,void 0===b&&(b=new Cd(u,r[f],a[f])),y[g]=b}}else t[d]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=i},remove:function(){for(var t=this._objects,e=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,r=n.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,h=i[c];if(void 0!==h&&e<=h){var l=e++,u=t[l];t[i[u.uuid]=h]=u,t[i[c]=l]=s;for(var p=0,d=r;p!==d;++p){var f=n[p],m=f[l],g=f[h];f[h]=m,f[l]=g}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c,h=arguments[o].uuid,l=n[h];if(void 0!==l)if(delete n[h],l<i){var u=--i,p=t[u],d,f=t[d=--e];t[n[p.uuid]=l]=p,t[n[f.uuid]=u]=f,t.pop();for(var m=0,g=a;m!==g;++m){var v,y=(v=r[m])[u],x=v[d];v[l]=y,v[u]=x,v.pop()}}else{var d,f;t[n[(f=t[d=--e]).uuid]=l]=f,t.pop();for(var m=0,g=a;m!==g;++m){var v;(v=r[m])[l]=v[d],v.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,l=new Array(c);n=r.length,i[t]=n,a.push(t),o.push(e),r.push(l);for(var u=h,p=s.length;u!==p;++u){var d=s[u];l[u]=new Cd(d,t,e)}return l},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c;a[e[t[o]]=i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}}),Object.assign(Od.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){var n=this._clip.duration,r=t._clip.duration,a=r/n,o=n/r;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+i,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){if(this.enabled){var r=this._startTime;if(null!==r){var a=(t-r)*i;if(a<0||0===i)return;this._startTime=null,e=i*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(0<s)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant,n;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},_updateTime:function(t){var e=this.time+t,i=this._clip.duration,n=this.loop,r=this._loopCount,a=n===de;if(0===t)return-1===r?e:a&&1==(1&r)?i-e:e;if(n===ue){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i<=e)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(0<=t?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i<=e||e<0){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0<t?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&r))return i-(this.time=e)}return this.time=e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=ye,n.endingEnd=ye):(n.endingStart=t?this.zeroSlopeAtStart?ye:ve:xe,n.endingEnd=e?this.zeroSlopeAtEnd?ye:ve:xe)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}}),Id.prototype=Object.assign(Object.create(e.prototype),{constructor:Id,_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==r;++l){var u=n[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(void 0!==(d=a[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;++(d=new Xp(Cd.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var 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)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var 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:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n=this._actions,r=this._actionsByClip,a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;e[i._cacheIndex=n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],h=t._byClipCacheIndex,l,u;s[c._byClipCacheIndex=h]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],a=this._bindings;void 0===r&&(r={},n[e]=r),(r[i]=t)._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;e[s._cacheIndex=c]=s,e.pop(),delete o[r];t:{for(var h in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&(t[(i=new Gu(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];e[t.__cacheIndex=n]=t,e[r.__cacheIndex=i]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Zu.findByName(i,t):t,a=null!==r?r.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new Od(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Zu.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0;for(var r=this._nActiveBindings=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==i;++o){var s;e[o]._update(n,t,r,a)}for(var c=this._bindings,h=this._nActiveBindings,o=0;o!==h;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,e[l._cacheIndex=h]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r,a=i[n].actionByRoot[e];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o,s=this._bindingsByRootAndName[e];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Nd.prototype.clone=function(){return new Nd(void 0===this.value.clone?this.value:this.value.clone())},Dd.prototype=Object.assign(Object.create(ro.prototype),{constructor:Dd,isInstancedBufferGeometry:!0,copy:function(t){return ro.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Ud.prototype=Object.assign(Object.create(qc.prototype),{constructor:Ud,isInstancedInterleavedBuffer:!0,copy:function(t){return qc.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Bd.prototype=Object.assign(Object.create(Da.prototype),{constructor:Bd,isInstancedBufferAttribute:!0,copy:function(t){return Da.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(Fd.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){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()):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)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e,i){var n=i||[];return Gd(t,this,n,e),n.sort(zd),n},intersectObjects:function(t,e,i){var n=i||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var r=0,a=t.length;r<a;r++)Gd(t[r],this,n,e);return n.sort(zd),n}}),Object.assign(Hd.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(Vd.prototype,{set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(De.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(kd.prototype,{set:function(t,e,i){return this.radius=t,this.theta=e,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),Object.assign(jd.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:(rd=new ai,function t(e,i){var n=rd.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return void 0===t&&(t=new ai),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(t=new ai),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(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},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new ai),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(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)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new ai),e.copy(t).clamp(this.min,this.max)},distanceToPoint:(nd=new ai,function t(e){var i;return nd.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Wd.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new ci),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new ci),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new ci),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(ad=new ci,od=new ci,function t(e,i){ad.subVectors(e,this.start),od.subVectors(this.end,this.start);var n=od.dot(od),r,a=od.dot(ad)/n;return i&&(a=De.clamp(a,0,1)),a}),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e);return void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new ci),this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),((Xd.prototype=Object.create(wa.prototype)).constructor=Xd).prototype.isImmediateRenderObject=!0,((qd.prototype=Object.create(nh.prototype)).constructor=qd).prototype.update=(sd=new ci,cd=new ci,hd=new hi,function t(){var e=["a","b","c"];this.object.updateMatrixWorld(!0),hd.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,n=this.geometry.attributes.position,r=this.object.geometry;if(r&&r.isGeometry)for(var a=r.vertices,o=r.faces,s=0,c=0,h=o.length;c<h;c++)for(var l=o[c],u=0,p=l.vertexNormals.length;u<p;u++){var d=a[l[e[u]]],f=l.vertexNormals[u];sd.copy(d).applyMatrix4(i),cd.copy(f).applyMatrix3(hd).normalize().multiplyScalar(this.size).add(sd),n.setXYZ(s,sd.x,sd.y,sd.z),s+=1,n.setXYZ(s,cd.x,cd.y,cd.z),s+=1}else if(r&&r.isBufferGeometry)for(var m=r.attributes.position,g=r.attributes.normal,s=0,u=0,p=m.count;u<p;u++)sd.set(m.getX(u),m.getY(u),m.getZ(u)).applyMatrix4(i),cd.set(g.getX(u),g.getY(u),g.getZ(u)),cd.applyMatrix3(hd).normalize().multiplyScalar(this.size).add(sd),n.setXYZ(s,sd.x,sd.y,sd.z),s+=1,n.setXYZ(s,cd.x,cd.y,cd.z),s+=1;n.needsUpdate=!0}),((Yd.prototype=Object.create(wa.prototype)).constructor=Yd).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Yd.prototype.update=(ld=new ci,ud=new ci,function t(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,i=e*Math.tan(this.light.angle);this.cone.scale.set(i,i,e),ld.setFromMatrixPosition(this.light.matrixWorld),ud.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ud.sub(ld)),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}),((Zd.prototype=Object.create(nh.prototype)).constructor=Zd).prototype.updateMatrixWorld=(pd=new ci,dd=new oi,fd=new oi,function t(e){var i=this.bones,n=this.geometry,r=n.getAttribute("position");fd.getInverse(this.root.matrixWorld);for(var a=0,o=0;a<i.length;a++){var s=i[a];s.parent&&s.parent.isBone&&(dd.multiplyMatrices(fd,s.matrixWorld),pd.setFromMatrixPosition(dd),r.setXYZ(o,pd.x,pd.y,pd.z),dd.multiplyMatrices(fd,s.parent.matrixWorld),pd.setFromMatrixPosition(dd),r.setXYZ(o+1,pd.x,pd.y,pd.z),o+=2)}n.getAttribute("position").needsUpdate=!0,wa.prototype.updateMatrixWorld.call(this,e)}),((Qd.prototype=Object.create(Go.prototype)).constructor=Qd).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Qd.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},((Kd.prototype=Object.create(wa.prototype)).constructor=Kd).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Kd.prototype.update=function(){var t=.5*this.light.width,e=.5*this.light.height,i=this.line.geometry.attributes.position,n=i.array;n[0]=t,n[1]=-e,n[2]=0,n[3]=t,n[4]=e,n[5]=0,n[6]=-t,n[7]=e,n[8]=0,n[9]=-t,n[10]=-e,n[11]=0,n[12]=t,n[13]=-e,n[14]=0,i.needsUpdate=!0,void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)},(($d.prototype=Object.create(wa.prototype)).constructor=$d).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},$d.prototype.update=(md=new ci,gd=new Yr,vd=new Yr,function t(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var i=e.geometry.getAttribute("color");gd.copy(this.light.color),vd.copy(this.light.groundColor);for(var n=0,r=i.count;n<r;n++){var a=n<r/2?gd:vd;i.setXYZ(n,a.r,a.g,a.b)}i.needsUpdate=!0}e.lookAt(md.setFromMatrixPosition(this.light.matrixWorld).negate())}),(tf.prototype=Object.create(nh.prototype)).constructor=tf,(ef.prototype=Object.create(nh.prototype)).constructor=ef,((nf.prototype=Object.create(nh.prototype)).constructor=nf).prototype.update=(yd=new ci,xd=new ci,bd=new hi,function t(){this.object.updateMatrixWorld(!0),bd.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,i=this.geometry.attributes.position,n=this.object.geometry,r=n.vertices,a=n.faces,o=0,s=0,c=a.length;s<c;s++){var h=a[s],l=h.normal;yd.copy(r[h.a]).add(r[h.b]).add(r[h.c]).divideScalar(3).applyMatrix4(e),xd.copy(l).applyMatrix3(bd).normalize().multiplyScalar(this.size).add(yd),i.setXYZ(o,yd.x,yd.y,yd.z),o+=1,i.setXYZ(o,xd.x,xd.y,xd.z),o+=1}i.needsUpdate=!0}),((rf.prototype=Object.create(wa.prototype)).constructor=rf).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},rf.prototype.update=(_d=new ci,wd=new ci,Md=new ci,function t(){_d.setFromMatrixPosition(this.light.matrixWorld),wd.setFromMatrixPosition(this.light.target.matrixWorld),Md.subVectors(wd,_d),this.lightPlane.lookAt(Md),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Md),this.targetLine.scale.z=Md.length()}),((af.prototype=Object.create(nh.prototype)).constructor=af).prototype.update=function(){var c,h,l=new ci,u=new Ma;function n(t,e,i,n){l.set(e,i,n).unproject(u);var r=h[t];if(void 0!==r)for(var a=c.getAttribute("position"),o=0,s=r.length;o<s;o++)a.setXYZ(r[o],l.x,l.y,l.z)}return function t(){c=this.geometry,h=this.pointMap;var e=1,i=1;u.projectionMatrix.copy(this.camera.projectionMatrix),n("c",0,0,-1),n("t",0,0,1),n("n1",-1,-1,-1),n("n2",1,-1,-1),n("n3",-1,1,-1),n("n4",1,1,-1),n("f1",-1,-1,1),n("f2",1,-1,1),n("f3",-1,1,1),n("f4",1,1,1),n("u1",.7,1.1,-1),n("u2",-.7,1.1,-1),n("u3",0,2,-1),n("cf1",-1,0,1),n("cf2",1,0,1),n("cf3",0,-1,1),n("cf4",0,1,1),n("cn1",-1,0,-1),n("cn2",1,0,-1),n("cn3",0,-1,-1),n("cn4",0,1,-1),c.getAttribute("position").needsUpdate=!0}}(),((of.prototype=Object.create(nh.prototype)).constructor=of).prototype.update=(Ed=new Oi,function t(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Ed.setFromObject(this.object),!Ed.isEmpty()){var i=Ed.min,n=Ed.max,r=this.geometry.attributes.position,a=r.array;a[0]=n.x,a[1]=n.y,a[2]=n.z,a[3]=i.x,a[4]=n.y,a[5]=n.z,a[6]=i.x,a[7]=i.y,a[8]=n.z,a[9]=n.x,a[10]=i.y,a[11]=n.z,a[12]=n.x,a[13]=n.y,a[14]=i.z,a[15]=i.x,a[16]=n.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=n.x,a[22]=i.y,a[23]=i.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}),of.prototype.setFromObject=function(t){return this.object=t,this.update(),this},((sf.prototype=Object.create(nh.prototype)).constructor=sf).prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),wa.prototype.updateMatrixWorld.call(this,t))},((cf.prototype=Object.create(ih.prototype)).constructor=cf).prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?Ht:s,this.lookAt(this.plane.normal),wa.prototype.updateMatrixWorld.call(this,t)},((hf.prototype=Object.create(wa.prototype)).constructor=hf).prototype.setDirection=(Ad=new ci,function t(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Ad.set(e.z,0,-e.x).normalize(),Ld=Math.acos(e.y),this.quaternion.setFromAxisAngle(Ad,Ld))}),hf.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},hf.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},(lf.prototype=Object.create(nh.prototype)).constructor=lf;var pf=0,df=1,ff;function mf(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function gf(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,(t.materials=t).clone=function(){return t.slice()},t}function vf(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new oh(t,e)}function yf(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Zc(t)}function xf(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new oh(t,e)}function bf(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ah(t)}function _f(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ah(t)}function wf(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ah(t)}function Mf(t,e,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new ci(t,e,i)}function Ef(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Da(t,e).setDynamic(!0)}function Tf(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ua(t,e)}function Sf(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ba(t,e)}function Af(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Fa(t,e)}function Lf(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new za(t,e)}function Rf(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ga(t,e)}function Cf(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ha(t,e)}function Pf(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Va(t,e)}function Of(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new ka(t,e)}function If(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new ja(t,e)}function Nf(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),au.call(this,t),this.type="catmullrom",this.closed=!0}function Df(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),au.call(this,t),this.type="catmullrom"}function Uf(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),au.call(this,t),this.type="catmullrom"}function Bf(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new lf(t)}function Ff(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new of(t,e)}function zf(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new nh(new Ml(t.geometry),new eh({color:void 0!==e?e:16777215}))}function Gf(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new nh(new uh(t.geometry),new eh({color:void 0!==e?e:16777215}))}function Hf(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Wl(t)}function Vf(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new ql(t)}Ql.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Ql.prototype),(t.prototype.constructor=t).prototype.getPoint=e,t},Object.assign(Eu.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new Na,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new ci(r.x,r.y,r.z||0))}return e}}),Object.assign(Tu.prototype,{fromPoints:function(t){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),Nf.prototype=Object.create(au.prototype),Df.prototype=Object.create(au.prototype),Uf.prototype=Object.create(au.prototype),Object.assign(Uf.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),tf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Zd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(op.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),sp.extractUrlBase(t)}}),Object.assign(jd.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Oi.prototype,{center:function(t){return this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return this.getSize(t)}}),Wd.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(De,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),De.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),De.ceilPowerOfTwo(t)}}),Object.assign(hi.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(oi.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function t(){return void 0===ff&&(ff=new ci),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),ff.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,a)}}),Ni.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},si.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Fo.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(zo.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(zo,{barycoordFromPoint:function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),zo.getBarycoord(t,e,i,n,r)},normal:function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),zo.getNormal(t,e,i,n)}}),Object.assign(Su.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new cl(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new bl(this,t)}}),Object.assign(ai.prototype,{fromAttribute:function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(ci.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Li.prototype,{fromAttribute:function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Na.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}}),Object.assign(wa.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties(wa.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Qc.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Kc.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(Ql.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),zc.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Au.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(Da.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}}),Object.assign(ro.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(ro.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.assign(hl.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(Nd.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Do.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Yr}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}}}),Object.defineProperties(Dl.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Bo.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(kc.prototype,{animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")}}),Object.defineProperties(kc.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Nc.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Ri.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(Hc.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}}}),kp.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this,i;return(new zp).load(t,function(t){e.setBuffer(t)}),this},Wp.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Hp.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)};var kf={merge:function(t,e,i){var n;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,i)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}};function jf(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function Wf(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}li.crossOrigin=void 0,li.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Zl;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},li.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Jl;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},li.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},li.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Xf={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};function qf(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")}t.WebGLRenderTargetCube=Ci,t.WebGLRenderTarget=Ri,t.WebGLRenderer=kc,t.ShaderLib=Zr,t.UniformsLib=Jr,t.UniformsUtils=Wr,t.ShaderChunk=jr,t.FogExp2=jc,t.Fog=Wc,t.Scene=Xc,t.Sprite=Zc,t.LOD=Qc,t.SkinnedMesh=th,t.Skeleton=Kc,t.Bone=$c,t.Mesh=Go,t.LineSegments=nh,t.LineLoop=rh,t.Line=ih,t.Points=oh,t.Group=Fc,t.VideoTexture=sh,t.DataTexture=Pi,t.CompressedTexture=ch,t.CubeTexture=Ko,t.CanvasTexture=hh,t.DepthTexture=lh,t.Texture=Ai,t.CompressedTextureLoader=Xl,t.DataTextureLoader=ql,t.CubeTextureLoader=Jl,t.TextureLoader=Zl,t.ObjectLoader=hp,t.MaterialLoader=$u,t.BufferGeometryLoader=tp,t.DefaultLoadingManager=kl,t.LoadingManager=Vl,t.JSONLoader=cp,t.ImageLoader=Yl,t.ImageBitmapLoader=fp,t.FontLoader=xp,t.FileLoader=Wl,t.Loader=op,t.LoaderUtils=sp,t.Cache=Hl,t.AudioLoader=zp,t.SpotLightShadow=Cu,t.SpotLight=Pu,t.PointLight=Ou,t.RectAreaLight=Uu,t.HemisphereLight=Lu,t.DirectionalLightShadow=Iu,t.DirectionalLight=Nu,t.AmbientLight=Du,t.LightShadow=Ru,t.Light=Au,t.StereoCamera=Gp,t.PerspectiveCamera=zc,t.OrthographicCamera=Ea,t.CubeCamera=Hp,t.ArrayCamera=Gc,t.Camera=Ma,t.AudioListener=Vp,t.PositionalAudio=jp,t.AudioContext=bp,t.AudioAnalyser=Wp,t.Audio=kp,t.VectorKeyframeTrack=Ju,t.StringKeyframeTrack=Yu,t.QuaternionKeyframeTrack=qu,t.NumberKeyframeTrack=Wu,t.ColorKeyframeTrack=ju,t.BooleanKeyframeTrack=ku,t.PropertyMixer=Xp,t.PropertyBinding=Cd,t.KeyframeTrack=Vu,t.AnimationUtils=Bu,t.AnimationObjectGroup=Pd,t.AnimationMixer=Id,t.AnimationClip=Zu,t.Uniform=Nd,t.InstancedBufferGeometry=Dd,t.BufferGeometry=ro,t.Geometry=Na,t.InterleavedBufferAttribute=Yc,t.InstancedInterleavedBuffer=Ud,t.InterleavedBuffer=qc,t.InstancedBufferAttribute=Bd,t.Face3=Ta,t.Object3D=wa,t.Raycaster=Fd,t.Layers=ia,t.EventDispatcher=e,t.Clock=Hd,t.QuaternionLinearInterpolant=Xu,t.LinearInterpolant=Gu,t.DiscreteInterpolant=Hu,t.CubicInterpolant=zu,t.Interpolant=Fu,t.Triangle=zo,t.Math=De,t.Spherical=Vd,t.Cylindrical=kd,t.Plane=Ni,t.Frustum=Di,t.Sphere=Ii,t.Ray=Fo,t.Matrix4=oi,t.Matrix3=hi,t.Box3=Oi,t.Box2=jd,t.Line3=Wd,t.Euler=ea,t.Vector4=Li,t.Vector3=ci,t.Vector2=ai,t.Quaternion=si,t.Color=Yr,t.ImmediateRenderObject=Xd,t.VertexNormalsHelper=qd,t.SpotLightHelper=Yd,t.SkeletonHelper=Zd,t.PointLightHelper=Qd,t.RectAreaLightHelper=Kd,t.HemisphereLightHelper=$d,t.GridHelper=tf,t.PolarGridHelper=ef,t.FaceNormalsHelper=nf,t.DirectionalLightHelper=rf,t.CameraHelper=af,t.BoxHelper=of,t.Box3Helper=sf,t.PlaneHelper=cf,t.ArrowHelper=hf,t.AxesHelper=lf,t.Shape=Su,t.Path=Tu,t.ShapePath=mp,t.Font=gp,t.CurvePath=Eu,t.Curve=Ql,t.ImageUtils=li,t.ShapeUtils=al,t.WebGLUtils=Bc,t.WireframeGeometry=uh,t.ParametricGeometry=ph,t.ParametricBufferGeometry=dh,t.TetrahedronGeometry=gh,t.TetrahedronBufferGeometry=vh,t.OctahedronGeometry=yh,t.OctahedronBufferGeometry=xh,t.IcosahedronGeometry=bh,t.IcosahedronBufferGeometry=_h,t.DodecahedronGeometry=wh,t.DodecahedronBufferGeometry=Mh,t.PolyhedronGeometry=fh,t.PolyhedronBufferGeometry=mh,t.TubeGeometry=Eh,t.TubeBufferGeometry=Th,t.TorusKnotGeometry=Sh,t.TorusKnotBufferGeometry=Ah,t.TorusGeometry=Lh,t.TorusBufferGeometry=Rh,t.TextGeometry=pl,t.TextBufferGeometry=dl,t.SphereGeometry=fl,t.SphereBufferGeometry=ml,t.RingGeometry=gl,t.RingBufferGeometry=vl,t.PlaneGeometry=so,t.PlaneBufferGeometry=co,t.LatheGeometry=yl,t.LatheBufferGeometry=xl,t.ShapeGeometry=bl,t.ShapeBufferGeometry=_l,t.ExtrudeGeometry=cl,t.ExtrudeBufferGeometry=hl,t.EdgesGeometry=Ml,t.ConeGeometry=Sl,t.ConeBufferGeometry=Al,t.CylinderGeometry=El,t.CylinderBufferGeometry=Tl,t.CircleGeometry=Ll,t.CircleBufferGeometry=Rl,t.BoxGeometry=ao,t.BoxBufferGeometry=oo,t.ShadowMaterial=Pl,t.SpriteMaterial=Jc,t.RawShaderMaterial=Ol,t.ShaderMaterial=Bo,t.PointsMaterial=ah,t.MeshPhysicalMaterial=Nl,t.MeshStandardMaterial=Il,t.MeshPhongMaterial=Dl,t.MeshToonMaterial=Ul,t.MeshNormalMaterial=Bl,t.MeshLambertMaterial=Fl,t.MeshDepthMaterial=Oc,t.MeshDistanceMaterial=Ic,t.MeshBasicMaterial=Uo,t.LineDashedMaterial=zl,t.LineBasicMaterial=eh,t.Material=Do,t.Float64BufferAttribute=ja,t.Float32BufferAttribute=ka,t.Uint32BufferAttribute=Va,t.Int32BufferAttribute=Ha,t.Uint16BufferAttribute=Ga,t.Int16BufferAttribute=za,t.Uint8ClampedBufferAttribute=Fa,t.Uint8BufferAttribute=Ba,t.Int8BufferAttribute=Ua,t.BufferAttribute=Da,t.ArcCurve=$l,t.CatmullRomCurve3=au,t.CubicBezierCurve=gu,t.CubicBezierCurve3=vu,t.EllipseCurve=Kl,t.LineCurve=yu,t.LineCurve3=xu,t.QuadraticBezierCurve=bu,t.QuadraticBezierCurve3=_u,t.SplineCurve=wu,t.REVISION=Gt,t.MOUSE=i,t.CullFaceNone=ct,t.CullFaceBack=ht,t.CullFaceFront=lt,t.CullFaceFrontBack=3,t.FrontFaceDirectionCW=0,t.FrontFaceDirectionCCW=1,t.BasicShadowMap=0,t.PCFShadowMap=U,t.PCFSoftShadowMap=N,t.FrontSide=s,t.BackSide=Ht,t.DoubleSide=ut,t.FlatShading=1,t.SmoothShading=2,t.NoColors=l,t.FaceColors=1,t.VertexColors=v,t.NoBlending=pt,t.NormalBlending=dt,t.AdditiveBlending=ft,t.SubtractiveBlending=mt,t.MultiplyBlending=gt,t.CustomBlending=vt,t.AddEquation=p,t.SubtractEquation=d,t.ReverseSubtractEquation=f,t.MinEquation=m,t.MaxEquation=g,t.ZeroFactor=y,t.OneFactor=x,t.SrcColorFactor=b,t.OneMinusSrcColorFactor=_,t.SrcAlphaFactor=w,t.OneMinusSrcAlphaFactor=M,t.DstAlphaFactor=E,t.OneMinusDstAlphaFactor=T,t.DstColorFactor=S,t.OneMinusDstColorFactor=A,t.SrcAlphaSaturateFactor=L,t.NeverDepth=yt,t.AlwaysDepth=xt,t.LessDepth=bt,t.LessEqualDepth=_t,t.EqualDepth=wt,t.GreaterEqualDepth=Mt,t.GreaterDepth=Et,t.NotEqualDepth=Tt,t.MultiplyOperation=D,t.MixOperation=B,t.AddOperation=F,t.NoToneMapping=z,t.LinearToneMapping=Vt,t.ReinhardToneMapping=R,t.Uncharted2ToneMapping=C,t.CineonToneMapping=P,t.UVMapping=O,t.CubeReflectionMapping=G,t.CubeRefractionMapping=H,t.EquirectangularReflectionMapping=V,t.EquirectangularRefractionMapping=k,t.SphericalReflectionMapping=j,t.CubeUVReflectionMapping=W,t.CubeUVRefractionMapping=X,t.RepeatWrapping=I,t.ClampToEdgeWrapping=q,t.MirroredRepeatWrapping=Y,t.NearestFilter=J,t.NearestMipMapNearestFilter=Z,t.NearestMipMapLinearFilter=Q,t.LinearFilter=K,t.LinearMipMapNearestFilter=$,t.LinearMipMapLinearFilter=tt,t.UnsignedByteType=kt,t.ByteType=et,t.ShortType=it,t.UnsignedShortType=nt,t.IntType=rt,t.UnsignedIntType=at,t.FloatType=jt,t.HalfFloatType=Wt,t.UnsignedShort4444Type=ot,t.UnsignedShort5551Type=st,t.UnsignedShort565Type=St,t.UnsignedInt248Type=At,t.AlphaFormat=Lt,t.RGBFormat=Rt,t.RGBAFormat=Xt,t.LuminanceFormat=Ct,t.LuminanceAlphaFormat=Pt,t.RGBEFormat=Ot,t.DepthFormat=It,t.DepthStencilFormat=Nt,t.RGB_S3TC_DXT1_Format=Dt,t.RGBA_S3TC_DXT1_Format=Ut,t.RGBA_S3TC_DXT3_Format=Bt,t.RGBA_S3TC_DXT5_Format=Ft,t.RGB_PVRTC_4BPPV1_Format=zt,t.RGB_PVRTC_2BPPV1_Format=qt,t.RGBA_PVRTC_4BPPV1_Format=Yt,t.RGBA_PVRTC_2BPPV1_Format=Jt,t.RGB_ETC1_Format=Zt,t.RGBA_ASTC_4x4_Format=Qt,t.RGBA_ASTC_5x4_Format=Kt,t.RGBA_ASTC_5x5_Format=$t,t.RGBA_ASTC_6x5_Format=te,t.RGBA_ASTC_6x6_Format=ee,t.RGBA_ASTC_8x5_Format=ie,t.RGBA_ASTC_8x6_Format=ne,t.RGBA_ASTC_8x8_Format=re,t.RGBA_ASTC_10x5_Format=ae,t.RGBA_ASTC_10x6_Format=oe,t.RGBA_ASTC_10x8_Format=se,t.RGBA_ASTC_10x10_Format=ce,t.RGBA_ASTC_12x10_Format=he,t.RGBA_ASTC_12x12_Format=le,t.LoopOnce=ue,t.LoopRepeat=pe,t.LoopPingPong=de,t.InterpolateDiscrete=fe,t.InterpolateLinear=me,t.InterpolateSmooth=ge,t.ZeroCurvatureEnding=ve,t.ZeroSlopeEnding=ye,t.WrapAroundEnding=xe,t.TrianglesDrawMode=be,t.TriangleStripDrawMode=1,t.TriangleFanDrawMode=2,t.LinearEncoding=Me,t.sRGBEncoding=Ee,t.GammaEncoding=Te,t.RGBEEncoding=Se,t.LogLuvEncoding=Ae,t.RGBM7Encoding=Le,t.RGBM16Encoding=Re,t.RGBDEncoding=Ce,t.BasicDepthPacking=Pe,t.RGBADepthPacking=Oe,t.TangentSpaceNormalMap=Ie,t.ObjectSpaceNormalMap=Ne,t.CubeGeometry=ao,t.Face4=uf,t.LineStrip=0,t.LinePieces=1,t.MeshFaceMaterial=mf,t.MultiMaterial=gf,t.PointCloud=vf,t.Particle=yf,t.ParticleSystem=xf,t.PointCloudMaterial=bf,t.ParticleBasicMaterial=_f,t.ParticleSystemMaterial=wf,t.Vertex=Mf,t.DynamicBufferAttribute=Ef,t.Int8Attribute=Tf,t.Uint8Attribute=Sf,t.Uint8ClampedAttribute=Af,t.Int16Attribute=Lf,t.Uint16Attribute=Rf,t.Int32Attribute=Cf,t.Uint32Attribute=Pf,t.Float32Attribute=Of,t.Float64Attribute=If,t.ClosedSplineCurve3=Nf,t.SplineCurve3=Df,t.Spline=Uf,t.AxisHelper=Bf,t.BoundingBoxHelper=Ff,t.EdgesHelper=zf,t.WireframeHelper=Gf,t.XHRLoader=Hf,t.BinaryTextureLoader=Vf,t.GeometryUtils=kf,t.Projector=jf,t.CanvasRenderer=Wf,t.SceneUtils=Xf,t.LensFlare=qf,Object.defineProperty(t,"__esModule",{value:!0})});;
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;(t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).flvjs=e()}}(function(){var e,t,n;return function s(a,o,u){function l(n,e){if(!o[n]){if(!a[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(d)return d(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var r=o[n]={exports:{}};a[n][0].call(r.exports,function(e){var t=a[n][1][e];return l(t||e)},r,r.exports,s,a,o,u)}return o[n].exports}for(var d="function"==typeof require&&require,e=0;e<u.length;e++)l(u[e]);return l}({1:[function(de,n,i){(function(ue,le){var e,t;e=this,t=function(){"use strict";function n(e){return"function"==typeof e||"object"==typeof e&&null!==e}function l(e){return"function"==typeof e}var e=void 0,i=e=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,s=void 0,a=void 0,o=function e(t,n){E[r]=t,E[r+1]=n,2===(r+=2)&&(a?a(b):k())};function t(e){a=e}function u(e){o=e}var d="undefined"!=typeof window?window:void 0,h=d||{},f=h.MutationObserver||h.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==ue&&"[object process]"==={}.toString.call(ue),_="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function m(){return function(){return ue.nextTick(b)}}function p(){return void 0!==s?function(){s(b)}:y()}function v(){var e=0,t=new f(b),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function g(){var e=new MessageChannel;return e.port1.onmessage=b,function(){return e.port2.postMessage(0)}}function y(){var e=setTimeout;return function(){return e(b,1)}}var E=new Array(1e3);function b(){for(var e=0;e<r;e+=2){var t,n;(0,E[e])(E[e+1]),E[e]=void 0,E[e+1]=void 0}r=0}function S(){try{var e,t=de("vertx");return s=t.runOnLoop||t.runOnContext,p()}catch(e){return y()}}var k=void 0;function L(e,t){var n=arguments,i=this,r=new this.constructor(A);void 0===r[R]&&J(r);var s=i._state,a;return s?(a=n[s-1],o(function(){return X(s,r,a,i._result)})):z(i,r,e,t),r}function w(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(A);return N(n,e),n}k=c?m():f?v():_?g():void 0===d&&"function"==typeof de?S():y();var R=Math.random().toString(36).substring(16);function A(){}var O=void 0,T=1,C=2,I=new K;function x(){return new TypeError("You cannot resolve a promise with itself")}function M(){return new TypeError("A promises callback cannot return that same promise.")}function D(e){try{return e.then}catch(e){return I.error=e,I}}function B(e,t,n,i){try{e.call(t,n,i)}catch(e){return e}}function j(e,i,r){o(function(t){var n=!1,e=B(r,i,function(e){n||(n=!0,i!==e?N(t,e):G(t,e))},function(e){n||(n=!0,V(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&e&&(n=!0,V(t,e))},e)}function P(t,e){e._state===T?G(t,e._result):e._state===C?V(t,e._result):z(e,void 0,function(e){return N(t,e)},function(e){return V(t,e)})}function U(e,t,n){t.constructor===e.constructor&&n===L&&t.constructor.resolve===w?P(e,t):n===I?(V(e,I.error),I.error=null):void 0===n?G(e,t):l(n)?j(e,t,n):G(e,t)}function N(e,t){e===t?V(e,x()):n(t)?U(e,t,D(t)):G(e,t)}function F(e){e._onerror&&e._onerror(e._result),H(e)}function G(e,t){e._state===O&&(e._result=t,e._state=T,0!==e._subscribers.length&&o(H,e))}function V(e,t){e._state===O&&(e._state=C,e._result=t,o(F,e))}function z(e,t,n,i){var r=e._subscribers,s=r.length;e._onerror=null,r[s]=t,r[s+T]=n,r[s+C]=i,0===s&&e._state&&o(H,e)}function H(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var i=void 0,r=void 0,s=e._result,a=0;a<t.length;a+=3)i=t[a],r=t[a+n],i?X(n,i,r,s):r(s);e._subscribers.length=0}}function K(){this.error=null}var q=new K;function W(e,t){try{return e(t)}catch(e){return q.error=e,q}}function X(e,t,n,i){var r=l(n),s=void 0,a=void 0,o=void 0,u=void 0;if(r){if((s=W(n,i))===q?(u=!0,a=s.error,s.error=null):o=!0,t===s)return void V(t,M())}else s=i,o=!0;t._state!==O||(r&&o?N(t,s):u?V(t,a):e===T?G(t,s):e===C&&V(t,s))}function Y(n,e){try{e(function e(t){N(n,t)},function e(t){V(n,t)})}catch(e){V(n,e)}}var Z=0;function Q(){return Z++}function J(e){e[R]=Z++,e._state=void 0,e._result=void 0,e._subscribers=[]}function $(e,t){this._instanceConstructor=e,this.promise=new e(A),this.promise[R]||J(this.promise),i(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?G(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&G(this.promise,this._result))):V(this.promise,ee())}function ee(){return new Error("Array Methods must be provided an Array")}function te(e){return new $(this,e).promise}function ne(r){var s=this;return i(r)?new s(function(e,t){for(var n=r.length,i=0;i<n;i++)s.resolve(r[i]).then(e,t)}):new s(function(e,t){return t(new TypeError("You must pass an array to race."))})}function ie(e){var t,n=new this(A);return V(n,e),n}function re(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function se(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function ae(e){this[R]=Q(),this._result=this._state=void 0,this._subscribers=[],A!==e&&("function"!=typeof e&&re(),this instanceof ae?Y(this,e):se())}function oe(){var e=void 0;if(void 0!==le)e=le;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=ae}return $.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===O&&n<e;n++)this._eachEntry(t[n],n)},$.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,i=n.resolve;if(i===w){var r=D(t);if(r===L&&t._state!==O)this._settledAt(t._state,e,t._result);else if("function"!=typeof r)this._remaining--,this._result[e]=t;else if(n===ae){var s=new n(A);U(s,t,r),this._willSettleAt(s,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(i(t),e)},$.prototype._settledAt=function(e,t,n){var i=this.promise;i._state===O&&(this._remaining--,e===C?V(i,n):this._result[t]=n),0===this._remaining&&G(i,this._result)},$.prototype._willSettleAt=function(e,t){var n=this;z(e,void 0,function(e){return n._settledAt(T,t,e)},function(e){return n._settledAt(C,t,e)})},ae.all=te,ae.race=ne,ae.resolve=w,ae.reject=ie,ae._setScheduler=t,ae._setAsap=u,ae._asap=o,ae.prototype={constructor:ae,then:L,catch:function e(t){return this.then(null,t)}},ae.polyfill=oe,ae.Promise=ae},"object"==typeof i&&void 0!==n?n.exports=t():e.ES6Promise=t()}).call(this,de("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],2:[function(e,t,n){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function u(e){return"function"==typeof e}function r(e){return"number"==typeof e}function l(e){return"object"==typeof e&&null!==e}function d(e){return void 0===e}((t.exports=i).EventEmitter=i).prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!r(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,n,i,r,s,a;if(this._events||(this._events={}),"error"===e&&(!this._events.error||l(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var o=new Error('Uncaught, unspecified "error" event. ('+t+")");throw o.context=t,o}if(d(n=this._events[e]))return!1;if(u(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:r=Array.prototype.slice.call(arguments,1),n.apply(this,r)}else if(l(n))for(r=Array.prototype.slice.call(arguments,1),i=(a=n.slice()).length,s=0;s<i;s++)a[s].apply(this,r);return!0},i.prototype.on=i.prototype.addListener=function(e,t){var n;if(!u(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,u(t.listener)?t.listener:t),this._events[e]?l(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,l(this._events[e])&&!this._events[e].warned&&(n=d(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&0<n&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.once=function(e,t){if(!u(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var n,i,r,s;if(!u(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=(n=this._events[e]).length,i=-1,n===t||u(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(l(n)){for(s=r;0<s--;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(u(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?u(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(u(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],3:[function(e,t,n){var i=t.exports={},r,s;function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}function l(t){if(s===clearTimeout)return clearTimeout(t);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(t);try{return s(t)}catch(e){try{return s.call(null,t)}catch(e){return s.call(this,t)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(e){s=o}}();var d=[],h=!1,f,c=-1;function _(){h&&f&&(h=!1,f.length?d=f.concat(d):c=-1,d.length&&m())}function m(){if(!h){var e=u(_);h=!0;for(var t=d.length;t;){for(f=d,d=[];++c<t;)f&&f[c].run();c=-1,t=d.length}f=null,h=!1,l(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new p(e,t)),1!==d.length||h||u(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],4:[function(e,t,n){var g=arguments[3],y=arguments[4],E=arguments[5],b=JSON.stringify;t.exports=function(e,t){for(var n,i=Object.keys(E),r=0,s=i.length;r<s;r++){var a=i[r],o=E[a].exports;if(o===e||o&&o.default===e){n=a;break}}if(!n){n=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var u={},r=0,s=i.length;r<s;r++){var a;u[a=i[r]]=a}y[n]=[Function(["require","module","exports"],"("+e+")(self)"),u]}var l=Math.floor(Math.pow(16,8)*Math.random()).toString(16),d={};d[n]=n,y[l]=[Function(["require"],"var f = require("+b(n)+");(f.default ? f.default : f)(self);"),d];var h={};function f(e){for(var t in h[e]=!0,y[e][1]){var n=y[e][1][t];h[n]||f(n)}}f(l);var c="("+g+")({"+Object.keys(h).map(function(e){return b(e)+":["+y[e][0]+","+b(y[e][1])+"]"}).join(",")+"},{},["+b(l)+"])",_=window.URL||window.webkitURL||window.mozURL||window.msURL,m=new Blob([c],{type:"text/javascript"});if(t&&t.bare)return m;var p=_.createObjectURL(m),v=new Worker(p);return v.objectURL=p,v}},{}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.createDefaultConfig=r;var i=n.defaultConfig={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1};function r(){return Object.assign({},i)}},{}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,s=o(e("../io/io-controller.js")),a=e("../config.js");function o(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l=function(){function i(){u(this,i)}return r(i,null,[{key:"supportMSEH264Playback",value:function e(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"supportNetworkStreamIO",value:function e(){var t=new s.default({},(0,a.createDefaultConfig)()),n=t.loaderType;return t.destroy(),"fetch-stream-loader"==n||"xhr-moz-chunked-loader"==n}},{key:"getNetworkLoaderTypeName",value:function e(){var t=new s.default({},(0,a.createDefaultConfig)()),n=t.loaderType;return t.destroy(),n}},{key:"supportNativeMediaPlayback",value:function e(t){null==i.videoElement&&(i.videoElement=window.document.createElement("video"));var n=i.videoElement.canPlayType(t);return"probably"===n||"maybe"==n}},{key:"getFeatureList",value:function e(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=i.supportMSEH264Playback(),t.networkStreamIO=i.supportNetworkStreamIO(),t.networkLoaderName=i.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=i.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=i.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=i.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t}}]),i}();n.default=l},{"../config.js":5,"../io/io-controller.js":23}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(){r(this,e),this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return i(e,[{key:"isComplete",value:function e(){var t=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,n=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&t&&n}},{key:"isSeekable",value:function e(){return!0===this.hasKeyframesIndex}},{key:"getNearestKeyframe",value:function e(t){if(null==this.keyframesIndex)return null;var n=this.keyframesIndex,i=this._search(n.times,t);return{index:i,milliseconds:n.times[i],fileposition:n.filepositions[i]}}},{key:"_search",value:function e(t,n){var i=0,r=t.length-1,s=0,a=0,o=r;for(n<t[0]&&(i=0,a=o+1);a<=o;){if((s=a+Math.floor((o-a)/2))===r||n>=t[s]&&n<t[s+1]){i=s;break}t[s]<n?a=s+1:o=s-1}return i}}]),e}();n.default=s},{}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=n.SampleInfo=function e(t,n,i,r,s){a(this,e),this.dts=t,this.pts=n,this.duration=i,this.originalDts=r,this.isSyncPoint=s,this.fileposition=null},s=n.MediaSegmentInfo=function(){function e(){a(this,e),this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return i(e,[{key:"appendSyncPoint",value:function e(t){t.isSyncPoint=!0,this.syncPoints.push(t)}}]),e}(),o=n.IDRSampleList=function(){function e(){a(this,e),this._list=[]}return i(e,[{key:"clear",value:function e(){this._list=[]}},{key:"appendArray",value:function e(t){var n=this._list;0!==t.length&&(0<n.length&&t[0].originalDts<n[n.length-1].originalDts&&this.clear(),Array.prototype.push.apply(n,t))}},{key:"getLastSyncPointBeforeDts",value:function e(t){if(0==this._list.length)return null;var n=this._list,i=0,r=n.length-1,s=0,a=0,o=r;for(t<n[0].dts&&(i=0,a=o+1);a<=o;){if((s=a+Math.floor((o-a)/2))===r||t>=n[s].dts&&t<n[s+1].dts){i=s;break}n[s].dts<t?a=s+1:o=s-1}return this._list[i]}}]),e}(),u=n.MediaSegmentInfoList=function(){function t(e){a(this,t),this._type=e,this._list=[],this._lastAppendLocation=-1}return i(t,[{key:"isEmpty",value:function e(){return 0===this._list.length}},{key:"clear",value:function e(){this._list=[],this._lastAppendLocation=-1}},{key:"_searchNearestSegmentBefore",value:function e(t){var n=this._list;if(0===n.length)return-2;var i=n.length-1,r=0,s=0,a=i,o=0;if(t<n[0].originalBeginDts)return o=-1;for(;s<=a;){if((r=s+Math.floor((a-s)/2))===i||t>n[r].lastSample.originalDts&&t<n[r+1].originalBeginDts){o=r;break}n[r].originalBeginDts<t?s=r+1:a=r-1}return o}},{key:"_searchNearestSegmentAfter",value:function e(t){return this._searchNearestSegmentBefore(t)+1}},{key:"append",value:function e(t){var n=this._list,i=t,r=this._lastAppendLocation,s=0;-1!==r&&r<n.length&&i.originalBeginDts>=n[r].lastSample.originalDts&&(r===n.length-1||r<n.length-1&&i.originalBeginDts<n[r+1].originalBeginDts)?s=r+1:0<n.length&&(s=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=s,this._list.splice(s,0,i)}},{key:"getLastSegmentBefore",value:function e(t){var n=this._searchNearestSegmentBefore(t);return 0<=n?this._list[n]:null}},{key:"getLastSampleBefore",value:function e(t){var n=this.getLastSegmentBefore(t);return null!=n?n.lastSample:null}},{key:"getLastSyncPointBefore",value:function e(t){for(var n=this._searchNearestSegmentBefore(t),i=this._list[n].syncPoints;0===i.length&&0<n;)n--,i=this._list[n].syncPoints;return 0<i.length?i[i.length-1]:null}},{key:"type",get:function e(){return this._type}},{key:"length",get:function e(){return this._list.length}}]),t}()},{}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r,s=_(e("events")),a,l=_(e("../utils/logger.js")),o,d=_(e("../utils/browser.js")),u,h=_(e("./mse-events.js")),f=e("./media-segment-info.js"),c=e("../utils/exception.js");function _(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var p=function(){function t(e){m(this,t),this.TAG="MSEController",this._config=e,this._emitter=new s.default,this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new f.IDRSampleList}return i(t,[{key:"destroy",value:function e(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function e(t,n){this._emitter.addListener(t,n)}},{key:"off",value:function e(t,n){this._emitter.removeListener(t,n)}},{key:"attachMediaElement",value:function e(t){if(this._mediaSource)throw new c.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var n=this._mediaSource=new window.MediaSource;n.addEventListener("sourceopen",this.e.onSourceOpen),n.addEventListener("sourceended",this.e.onSourceEnded),n.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=t,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),t.src=this._mediaSourceObjectURL}},{key:"detachMediaElement",value:function e(){if(this._mediaSource){var t=this._mediaSource;for(var n in this._sourceBuffers){var i=this._pendingSegments[n];i.splice(0,i.length),this._pendingSegments[n]=null,this._pendingRemoveRanges[n]=null,this._lastInitSegments[n]=null;var r=this._sourceBuffers[n];r&&("closed"!==t.readyState&&(t.removeSourceBuffer(r),r.removeEventListener("error",this.e.onSourceBufferError),r.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)),this._mimeTypes[n]=null,this._sourceBuffers[n]=null)}if("open"===t.readyState)try{t.endOfStream()}catch(e){l.default.e(this.TAG,e.message)}t.removeEventListener("sourceopen",this.e.onSourceOpen),t.removeEventListener("sourceended",this.e.onSourceEnded),t.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}},{key:"appendInitSegment",value:function e(t,n){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(t),void this._pendingSegments[t.type].push(t);var i=t,r=""+i.container;i.codec&&0<i.codec.length&&(r+=";codecs="+i.codec);var s=!1;if(l.default.v(this.TAG,"Received Initialization Segment, mimeType: "+r),this._lastInitSegments[i.type]=i,r!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])l.default.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+r);else{s=!0;try{var a=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(r);a.addEventListener("error",this.e.onSourceBufferError),a.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return l.default.e(this.TAG,e.message),void this._emitter.emit(h.default.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=r}n||this._pendingSegments[i.type].push(i),s||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),d.default.safari&&"audio/mpeg"===i.container&&0<i.mediaDuration&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())}},{key:"appendMediaSegment",value:function e(t){var n=t;this._pendingSegments[n.type].push(n),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[n.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}},{key:"seek",value:function e(t){for(var n in this._sourceBuffers)if(this._sourceBuffers[n]){var i=this._sourceBuffers[n];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){l.default.e(this.TAG,e.message)}this._idrList.clear();var r=this._pendingSegments[n];if(r.splice(0,r.length),"closed"!==this._mediaSource.readyState){for(var s=0;s<i.buffered.length;s++){var a=i.buffered.start(s),o=i.buffered.end(s);this._pendingRemoveRanges[n].push({start:a,end:o})}if(i.updating||this._doRemoveRanges(),d.default.safari){var u=this._lastInitSegments[n];u&&(this._pendingSegments[n].push(u),i.updating||this._doAppendSegments())}}}}},{key:"endOfStream",value:function e(){var t=this._mediaSource,n=this._sourceBuffers;t&&"open"===t.readyState?n.video&&n.video.updating||n.audio&&n.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,t.endOfStream()):t&&"closed"===t.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)}},{key:"getNearestKeyframe",value:function e(t){return this._idrList.getLastSyncPointBeforeDts(t)}},{key:"_needCleanupSourceBuffer",value:function e(){if(!this._config.autoCleanupSourceBuffer)return!1;var t=this._mediaElement.currentTime;for(var n in this._sourceBuffers){var i=this._sourceBuffers[n];if(i){var r=i.buffered;if(1<=r.length&&t-r.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}},{key:"_doCleanupSourceBuffer",value:function e(){var t=this._mediaElement.currentTime;for(var n in this._sourceBuffers){var i=this._sourceBuffers[n];if(i){for(var r=i.buffered,s=!1,a=0;a<r.length;a++){var o=r.start(a),u=r.end(a);if(o<=t&&t<u+3){if(t-o>=this._config.autoCleanupMaxBackwardDuration){s=!0;var l=t-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[n].push({start:o,end:l})}}else u<t&&(s=!0,this._pendingRemoveRanges[n].push({start:o,end:u}))}s&&!i.updating&&this._doRemoveRanges()}}}},{key:"_updateMediaSourceDuration",value:function e(){var t=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(t.video&&t.video.updating||t.audio&&t.audio.updating)){var n=this._mediaSource.duration,i=this._pendingMediaDuration;0<i&&(isNaN(n)||n<i)&&(l.default.v(this.TAG,"Update MediaSource duration from "+n+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}}},{key:"_doRemoveRanges",value:function e(){for(var t in this._pendingRemoveRanges)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating)for(var n=this._sourceBuffers[t],i=this._pendingRemoveRanges[t];i.length&&!n.updating;){var r=i.shift();n.remove(r.start,r.end)}}},{key:"_doAppendSegments",value:function e(){var t=this._pendingSegments;for(var n in t)if(this._sourceBuffers[n]&&!this._sourceBuffers[n].updating&&0<t[n].length){var i=t[n].shift();if(i.timestampOffset){var r=this._sourceBuffers[n].timestampOffset,s=i.timestampOffset/1e3,a;.1<Math.abs(r-s)&&(l.default.v(this.TAG,"Update MPEG audio timestampOffset from "+r+" to "+s),this._sourceBuffers[n].timestampOffset=s),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[n].appendBuffer(i.data),this._isBufferFull=!1,"video"===n&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[n].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(h.default.BUFFER_FULL),this._isBufferFull=!0):(l.default.e(this.TAG,e.message),this._emitter.emit(h.default.ERROR,{code:e.code,msg:e.message}))}}}},{key:"_onSourceOpen",value:function e(){if(l.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),0<this._pendingSourceBufferInit.length)for(var t=this._pendingSourceBufferInit;t.length;){var n=t.shift();this.appendInitSegment(n,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(h.default.SOURCE_OPEN)}},{key:"_onSourceEnded",value:function e(){l.default.v(this.TAG,"MediaSource onSourceEnded")}},{key:"_onSourceClose",value:function e(){l.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}},{key:"_hasPendingSegments",value:function e(){var t=this._pendingSegments;return 0<t.video.length||0<t.audio.length}},{key:"_hasPendingRemoveRanges",value:function e(){var t=this._pendingRemoveRanges;return 0<t.video.length||0<t.audio.length}},{key:"_onSourceBufferUpdateEnd",value:function e(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(h.default.UPDATE_END)}},{key:"_onSourceBufferError",value:function e(t){l.default.e(this.TAG,"SourceBuffer Error: "+t)}}]),t}();n.default=p},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./media-segment-info.js":8,"./mse-events.js":10,events:2}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};n.default=i},{}],11:[function(s,e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,a=g(s("events")),r,o=g(s("../utils/logger.js")),u,l=g(s("../utils/logging-control.js")),d,h=g(s("./transmuxing-controller.js")),f,c=g(s("./transmuxing-events.js")),_,m=g(s("./transmuxing-worker.js")),p,v=g(s("./media-info.js"));function g(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var E=function(){function r(t,n){if(y(this,r),this.TAG="Transmuxer",this._emitter=new a.default,n.enableWorker&&"undefined"!=typeof Worker)try{var e=s("webworkify");this._worker=e(m.default),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[t,n]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},l.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:l.default.getConfig()})}catch(e){o.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new h.default(t,n)}else this._controller=new h.default(t,n);if(this._controller){var i=this._controller;i.on(c.default.IO_ERROR,this._onIOError.bind(this)),i.on(c.default.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(c.default.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(c.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(c.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(c.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(c.default.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(c.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(c.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return n(r,[{key:"destroy",value:function e(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),l.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function e(t,n){this._emitter.addListener(t,n)}},{key:"off",value:function e(t,n){this._emitter.removeListener(t,n)}},{key:"hasWorker",value:function e(){return null!=this._worker}},{key:"open",value:function e(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}},{key:"close",value:function e(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}},{key:"seek",value:function e(t){this._worker?this._worker.postMessage({cmd:"seek",param:t}):this._controller.seek(t)}},{key:"pause",value:function e(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}},{key:"resume",value:function e(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}},{key:"_onInitSegment",value:function e(t,n){var i=this;Promise.resolve().then(function(){i._emitter.emit(c.default.INIT_SEGMENT,t,n)})}},{key:"_onMediaSegment",value:function e(t,n){var i=this;Promise.resolve().then(function(){i._emitter.emit(c.default.MEDIA_SEGMENT,t,n)})}},{key:"_onLoadingComplete",value:function e(){var t=this;Promise.resolve().then(function(){t._emitter.emit(c.default.LOADING_COMPLETE)})}},{key:"_onRecoveredEarlyEof",value:function e(){var t=this;Promise.resolve().then(function(){t._emitter.emit(c.default.RECOVERED_EARLY_EOF)})}},{key:"_onMediaInfo",value:function e(t){var n=this;Promise.resolve().then(function(){n._emitter.emit(c.default.MEDIA_INFO,t)})}},{key:"_onStatisticsInfo",value:function e(t){var n=this;Promise.resolve().then(function(){n._emitter.emit(c.default.STATISTICS_INFO,t)})}},{key:"_onIOError",value:function e(t,n){var i=this;Promise.resolve().then(function(){i._emitter.emit(c.default.IO_ERROR,t,n)})}},{key:"_onDemuxError",value:function e(t,n){var i=this;Promise.resolve().then(function(){i._emitter.emit(c.default.DEMUX_ERROR,t,n)})}},{key:"_onRecommendSeekpoint",value:function e(t){var n=this;Promise.resolve().then(function(){n._emitter.emit(c.default.RECOMMEND_SEEKPOINT,t)})}},{key:"_onLoggingConfigChanged",value:function e(t){this._worker&&this._worker.postMessage({cmd:"logging_config",param:t})}},{key:"_onWorkerMessage",value:function e(t){var n=t.data,i=n.data;if("destroyed"===n.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(n.msg){case c.default.INIT_SEGMENT:case c.default.MEDIA_SEGMENT:this._emitter.emit(n.msg,i.type,i.data);break;case c.default.LOADING_COMPLETE:case c.default.RECOVERED_EARLY_EOF:this._emitter.emit(n.msg);break;case c.default.MEDIA_INFO:Object.setPrototypeOf(i,v.default.prototype),this._emitter.emit(n.msg,i);break;case c.default.STATISTICS_INFO:this._emitter.emit(n.msg,i);break;case c.default.IO_ERROR:case c.default.DEMUX_ERROR:this._emitter.emit(n.msg,i.type,i.info);break;case c.default.RECOMMEND_SEEKPOINT:this._emitter.emit(n.msg,i);break;case"logcat_callback":o.default.emitter.emit("log",i.type,i.logcat)}}}]),r}();t.default=E},{"../utils/logger.js":41,"../utils/logging-control.js":42,"./media-info.js":7,"./transmuxing-controller.js":12,"./transmuxing-events.js":13,"./transmuxing-worker.js":14,events:2,webworkify:4}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r,s=k(e("events")),a,o=k(e("../utils/logger.js")),u,l=k(e("../utils/browser.js")),d,h=k(e("./media-info.js")),f,c=k(e("../demux/flv-demuxer.js")),_,m=k(e("../remux/mp4-remuxer.js")),p,v=k(e("../demux/demux-errors.js")),g,y=k(e("../io/io-controller.js")),E,b=k(e("./transmuxing-events.js")),S=e("../io/loader.js");function k(e){return e&&e.__esModule?e:{default:e}}function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var w=function(){function e(t,n){L(this,e),this.TAG="TransmuxingController",this._emitter=new s.default,this._config=n,t.segments||(t.segments=[{duration:t.duration,filesize:t.filesize,url:t.url}]),"boolean"!=typeof t.cors&&(t.cors=!0),"boolean"!=typeof t.withCredentials&&(t.withCredentials=!1),this._mediaDataSource=t;var i=this._currentSegmentIndex=0;this._mediaDataSource.segments.forEach(function(e){e.timestampBase=i,i+=e.duration,e.cors=t.cors,e.withCredentials=t.withCredentials,n.referrerPolicy&&(e.referrerPolicy=n.referrerPolicy)}),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return i(e,[{key:"destroy",value:function e(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function e(t,n){this._emitter.addListener(t,n)}},{key:"off",value:function e(t,n){this._emitter.removeListener(t,n)}},{key:"start",value:function e(){this._loadSegment(0),this._enableStatisticsReporter()}},{key:"_loadSegment",value:function e(t,n){this._currentSegmentIndex=t;var i=this._mediaDataSource.segments[t],r=this._ioctl=new y.default(i,this._config,t);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),n?this._demuxer.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(n)}},{key:"stop",value:function e(){this._internalAbort(),this._disableStatisticsReporter()}},{key:"_internalAbort",value:function e(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}},{key:"pause",value:function e(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}},{key:"resume",value:function e(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}},{key:"seek",value:function e(t){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var n=this._searchSegmentIndexContains(t);if(n===this._currentSegmentIndex){var i=this._mediaInfo.segments[n];if(null==i)this._pendingSeekTime=t;else{var r=i.getNearestKeyframe(t);this._remuxer.seek(r.milliseconds),this._ioctl.seek(r.fileposition),this._pendingResolveSeekPoint=r.milliseconds}}else{var s=this._mediaInfo.segments[n];if(null==s)this._pendingSeekTime=t,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(n);else{var a=s.getNearestKeyframe(t);this._internalAbort(),this._remuxer.seek(t),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[n].timestampBase,this._loadSegment(n,a.fileposition),this._pendingResolveSeekPoint=a.milliseconds,this._reportSegmentMediaInfo(n)}}this._enableStatisticsReporter()}}},{key:"_searchSegmentIndexContains",value:function e(t){for(var n=this._mediaDataSource.segments,i=n.length-1,r=0;r<n.length;r++)if(t<n[r].timestampBase){i=r-1;break}return i}},{key:"_onInitChunkArrival",value:function e(t,n){var i=this,r=null,s=0;if(0<n)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,s=this._demuxer.parseChunks(t,n);else if((r=c.default.probe(t)).match){this._demuxer=new c.default(r,this._config),this._remuxer||(this._remuxer=new m.default(this._config));var a=this._mediaDataSource;null==a.duration||isNaN(a.duration)||(this._demuxer.overridedDuration=a.duration),"boolean"==typeof a.hasAudio&&(this._demuxer.overridedHasAudio=a.hasAudio),"boolean"==typeof a.hasVideo&&(this._demuxer.overridedHasVideo=a.hasVideo),this._demuxer.timestampBase=a.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),s=this._demuxer.parseChunks(t,n)}else r=null,o.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){i._internalAbort()}),this._emitter.emit(b.default.DEMUX_ERROR,v.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),s=0;return s}},{key:"_onMediaInfo",value:function e(t){var n=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},t),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,h.default.prototype));var i=Object.assign({},t);Object.setPrototypeOf(i,h.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then(function(){var e=n._pendingSeekTime;n._pendingSeekTime=null,n.seek(e)})}},{key:"_onIOSeeked",value:function e(){this._remuxer.insertDiscontinuity()}},{key:"_onIOComplete",value:function e(t){var n,i=t+1;i<this._mediaDataSource.segments.length?(this._internalAbort(),this._loadSegment(i)):(this._remuxer.flushStashedSamples(),this._emitter.emit(b.default.LOADING_COMPLETE),this._disableStatisticsReporter())}},{key:"_onIORedirect",value:function e(t){var n=this._ioctl.extraData;this._mediaDataSource.segments[n].redirectedURL=t}},{key:"_onIORecoveredEarlyEof",value:function e(){this._emitter.emit(b.default.RECOVERED_EARLY_EOF)}},{key:"_onIOException",value:function e(t,n){o.default.e(this.TAG,"IOException: type = "+t+", code = "+n.code+", msg = "+n.msg),this._emitter.emit(b.default.IO_ERROR,t,n),this._disableStatisticsReporter()}},{key:"_onDemuxException",value:function e(t,n){o.default.e(this.TAG,"DemuxException: type = "+t+", info = "+n),this._emitter.emit(b.default.DEMUX_ERROR,t,n)}},{key:"_onRemuxerInitSegmentArrival",value:function e(t,n){this._emitter.emit(b.default.INIT_SEGMENT,t,n)}},{key:"_onRemuxerMediaSegmentArrival",value:function e(t,n){if(null==this._pendingSeekTime&&(this._emitter.emit(b.default.MEDIA_SEGMENT,t,n),null!=this._pendingResolveSeekPoint&&"video"===t)){var i=n.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,l.default.safari&&0<i.length&&i[0].originalDts===r&&(r=i[0].pts),this._emitter.emit(b.default.RECOMMEND_SEEKPOINT,r)}}},{key:"_enableStatisticsReporter",value:function e(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}},{key:"_disableStatisticsReporter",value:function e(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"_reportSegmentMediaInfo",value:function e(t){var n=this._mediaInfo.segments[t],i=Object.assign({},n);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(b.default.MEDIA_INFO,i)}},{key:"_reportStatisticsInfo",value:function e(){var t={};t.url=this._ioctl.currentURL,t.hasRedirect=this._ioctl.hasRedirect,t.hasRedirect&&(t.redirectedURL=this._ioctl.currentRedirectedURL),t.speed=this._ioctl.currentSpeed,t.loaderType=this._ioctl.loaderType,t.currentSegmentIndex=this._currentSegmentIndex,t.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(b.default.STATISTICS_INFO,t)}}]),e}();n.default=w},{"../demux/demux-errors.js":16,"../demux/flv-demuxer.js":18,"../io/io-controller.js":23,"../io/loader.js":24,"../remux/mp4-remuxer.js":38,"../utils/browser.js":39,"../utils/logger.js":41,"./media-info.js":7,"./transmuxing-events.js":13,events:2}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"};n.default=i},{}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r=l(e("../utils/logger.js")),s,m=l(e("../utils/logging-control.js")),a,p=l(e("../utils/polyfill.js")),o,v=l(e("./transmuxing-controller.js")),u,g=l(e("./transmuxing-events.js"));function l(e){return e&&e.__esModule?e:{default:e}}var d=function e(i){var t="TransmuxingWorker",n=null,r=_.bind(this);function s(e,t){var n={msg:g.default.INIT_SEGMENT,data:{type:e,data:t}};i.postMessage(n,[t.data])}function a(e,t){var n={msg:g.default.MEDIA_SEGMENT,data:{type:e,data:t}};i.postMessage(n,[t.data])}function o(){var e={msg:g.default.LOADING_COMPLETE};i.postMessage(e)}function u(){var e={msg:g.default.RECOVERED_EARLY_EOF};i.postMessage(e)}function l(e){var t={msg:g.default.MEDIA_INFO,data:e};i.postMessage(t)}function d(e){var t={msg:g.default.STATISTICS_INFO,data:e};i.postMessage(t)}function h(e,t){i.postMessage({msg:g.default.IO_ERROR,data:{type:e,info:t}})}function f(e,t){i.postMessage({msg:g.default.DEMUX_ERROR,data:{type:e,info:t}})}function c(e){i.postMessage({msg:g.default.RECOMMEND_SEEKPOINT,data:e})}function _(e,t){i.postMessage({msg:"logcat_callback",data:{type:e,logcat:t}})}p.default.install(),i.addEventListener("message",function(e){switch(e.data.cmd){case"init":(n=new v.default(e.data.param[0],e.data.param[1])).on(g.default.IO_ERROR,h.bind(this)),n.on(g.default.DEMUX_ERROR,f.bind(this)),n.on(g.default.INIT_SEGMENT,s.bind(this)),n.on(g.default.MEDIA_SEGMENT,a.bind(this)),n.on(g.default.LOADING_COMPLETE,o.bind(this)),n.on(g.default.RECOVERED_EARLY_EOF,u.bind(this)),n.on(g.default.MEDIA_INFO,l.bind(this)),n.on(g.default.STATISTICS_INFO,d.bind(this)),n.on(g.default.RECOMMEND_SEEKPOINT,c.bind(this));break;case"destroy":n&&(n.destroy(),n=null),i.postMessage({msg:"destroyed"});break;case"start":n.start();break;case"stop":n.stop();break;case"seek":n.seek(e.data.param);break;case"pause":n.pause();break;case"resume":n.resume();break;case"logging_config":var t=e.data.param;m.default.applyConfig(t),!0===t.enableCallback?m.default.addLogListener(r):m.default.removeLogListener(r)}})};n.default=d},{"../utils/logger.js":41,"../utils/logging-control.js":42,"../utils/polyfill.js":43,"./transmuxing-controller.js":12,"./transmuxing-events.js":13}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r,k=a(e("../utils/logger.js")),s,o=a(e("../utils/utf8-conv.js")),L=e("../utils/exception.js");function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var w=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[0]),l,d=function(){function S(){u(this,S)}return i(S,null,[{key:"parseScriptData",value:function e(t,n,i){var r={};try{var s=S.parseValue(t,n,i),a=S.parseValue(t,n+s.size,i-s.size);r[s.data]=a.data}catch(e){k.default.e("AMF",e.toString())}return r}},{key:"parseObject",value:function e(t,n,i){if(i<3)throw new L.IllegalStateException("Data not enough when parse ScriptDataObject");var r=S.parseString(t,n,i),s=S.parseValue(t,n+r.size,i-r.size),a=s.objectEnd;return{data:{name:r.data,value:s.data},size:r.size+s.size,objectEnd:a}}},{key:"parseVariable",value:function e(t,n,i){return S.parseObject(t,n,i)}},{key:"parseString",value:function e(t,n,i){if(i<2)throw new L.IllegalStateException("Data not enough when parse String");var r,s=new DataView(t,n,i).getUint16(0,!w),a=void 0;return{data:a=0<s?(0,o.default)(new Uint8Array(t,n+2,s)):"",size:2+s}}},{key:"parseLongString",value:function e(t,n,i){if(i<4)throw new L.IllegalStateException("Data not enough when parse LongString");var r,s=new DataView(t,n,i).getUint32(0,!w),a=void 0;return{data:a=0<s?(0,o.default)(new Uint8Array(t,n+4,s)):"",size:4+s}}},{key:"parseDate",value:function e(t,n,i){if(i<10)throw new L.IllegalStateException("Data size invalid when parse Date");var r=new DataView(t,n,i),s=r.getFloat64(0,!w),a=r.getInt16(8,!w);return{data:new Date(s+=60*a*1e3),size:10}}},{key:"parseValue",value:function e(t,n,i){if(i<1)throw new L.IllegalStateException("Data not enough when parse Value");var r=new DataView(t,n,i),s=1,a=r.getUint8(0),o=void 0,u=!1;try{switch(a){case 0:o=r.getFloat64(1,!w),s+=8;break;case 1:var l;o=!!r.getUint8(1),s+=1;break;case 2:var d=S.parseString(t,n+1,i-1);o=d.data,s+=d.size;break;case 3:o={};var h=0,f;for(9==(16777215&r.getUint32(i-4,!w))&&(h=3);s<i-4;){var c=S.parseObject(t,n+s,i-s-h);if(c.objectEnd)break;o[c.data.name]=c.data.value,s+=c.size}if(s<=i-3)9===(16777215&r.getUint32(s-1,!w))&&(s+=3);break;case 8:o={},s+=4;var _=0,m;for(9==(16777215&r.getUint32(i-4,!w))&&(_=3);s<i-8;){var p=S.parseVariable(t,n+s,i-s-_);if(p.objectEnd)break;o[p.data.name]=p.data.value,s+=p.size}if(s<=i-3)9===(16777215&r.getUint32(s-1,!w))&&(s+=3);break;case 9:s=1,u=!(o=void 0);break;case 10:o=[];var v=r.getUint32(1,!w);s+=4;for(var g=0;g<v;g++){var y=S.parseValue(t,n+s,i-s);o.push(y.data),s+=y.size}break;case 11:var E=S.parseDate(t,n+1,i-1);o=E.data,s+=E.size;break;case 12:var b=S.parseString(t,n+1,i-1);o=b.data,s+=b.size;break;default:s=i,k.default.w("AMF","Unsupported AMF value type "+a)}}catch(e){k.default.e("AMF",e.toString())}return{data:o,size:s,objectEnd:u}}}]),S}();n.default=d},{"../utils/exception.js":40,"../utils/logger.js":41,"../utils/utf8-conv.js":44}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};n.default=i},{}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),o=e("../utils/exception.js");function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(e){r(this,t),this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return i(t,[{key:"destroy",value:function e(){this._buffer=null}},{key:"_fillCurrentWord",value:function e(){var t=this._total_bytes-this._buffer_index;if(t<=0)throw new o.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var n=Math.min(4,t),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+n)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=n,this._current_word_bits_left=8*n}},{key:"readBits",value:function e(t){if(32<t)throw new o.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(t<=this._current_word_bits_left){var n=this._current_word>>>32-t;return this._current_word<<=t,this._current_word_bits_left-=t,n}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var r=t-this._current_word_bits_left;this._fillCurrentWord();var s=Math.min(r,this._current_word_bits_left),a=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,i=i<<s|a}},{key:"readBool",value:function e(){return 1===this.readBits(1)}},{key:"readByte",value:function e(){return this.readBits(8)}},{key:"_skipLeadingZero",value:function e(){var t=void 0;for(t=0;t<this._current_word_bits_left;t++)if(0!=(this._current_word&2147483648>>>t))return this._current_word<<=t,this._current_word_bits_left-=t,t;return this._fillCurrentWord(),t+this._skipLeadingZero()}},{key:"readUEG",value:function e(){var t=this._skipLeadingZero();return this.readBits(t+1)-1}},{key:"readSEG",value:function e(){var t=this.readUEG();return 1&t?t+1>>>1:-1*(t>>>1)}}]),t}();n.default=s},{"../utils/exception.js":40}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var d="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},i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r,O=f(e("../utils/logger.js")),s,h=f(e("./amf-parser.js")),a,T=f(e("./sps-parser.js")),o,C=f(e("./demux-errors.js")),u,l=f(e("../core/media-info.js")),E=e("../utils/exception.js");function f(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e){return e>>>8&255|(255&e)<<8}function m(e){return(4278190080&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24}function p(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}var v=function(){function y(e,t){var n;c(this,y),this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new l.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0])}return i(y,[{key:"destroy",value:function e(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onTrackMetadata=null,this._onDataAvailable=null}},{key:"bindDataSource",value:function e(t){return t.onDataArrival=this.parseChunks.bind(this),this}},{key:"resetMediaInfo",value:function e(){this._mediaInfo=new l.default}},{key:"_isInitialMetadataDispatched",value:function e(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched}},{key:"parseChunks",value:function e(t,n){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new E.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0,r=this._littleEndian,s,a;if(0===n){if(!(13<t.byteLength))return 0;var o;i=y.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,n+i!==this._dataOffset&&O.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(t,i).getUint32(0,!r)&&O.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),i+=4);for(;i<t.byteLength;){this._dispatch=!0;var u=new DataView(t,i);if(i+11+4>t.byteLength)break;var l=u.getUint8(0),d=16777215&u.getUint32(0,!r);if(i+11+d+4>t.byteLength)break;if(8===l||9===l||18===l){var h=u.getUint8(4),f=u.getUint8(5),c,_,m=u.getUint8(6)|f<<8|h<<16|u.getUint8(7)<<24,p;0!==(16777215&u.getUint32(7,!r))&&O.default.w(this.TAG,"Meet tag which has StreamID != 0!");var v=i+11;switch(l){case 8:this._parseAudioData(t,v,d,m);break;case 9:this._parseVideoData(t,v,d,m,n+i);break;case 18:this._parseScriptData(t,v,d)}var g=u.getUint32(11+d,!r);g!==11+d&&O.default.w(this.TAG,"Invalid PrevTagSize "+g),i+=11+d+4}else O.default.w(this.TAG,"Unsupported tag type "+l+", skipped"),i+=11+d+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),i}},{key:"_parseScriptData",value:function e(t,n,i){var r=h.default.parseScriptData(t,n,i);if(r.hasOwnProperty("onMetaData")){if(null==r.onMetaData||"object"!==d(r.onMetaData))return void O.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&O.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=r;var s=this._metadata.onMetaData;if("boolean"==typeof s.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=s.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof s.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=s.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof s.audiodatarate&&(this._mediaInfo.audioDataRate=s.audiodatarate),"number"==typeof s.videodatarate&&(this._mediaInfo.videoDataRate=s.videodatarate),"number"==typeof s.width&&(this._mediaInfo.width=s.width),"number"==typeof s.height&&(this._mediaInfo.height=s.height),"number"==typeof s.duration){if(!this._durationOverrided){var a=Math.floor(s.duration*this._timescale);this._duration=a,this._mediaInfo.duration=a}}else this._mediaInfo.duration=0;if("number"==typeof s.framerate){var o=Math.floor(1e3*s.framerate);if(0<o){var u=o/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=u,this._referenceFrameRate.fps_num=o,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=u}}if("object"===d(s.keyframes)){this._mediaInfo.hasKeyframesIndex=!0;var l=s.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),s.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=s,O.default.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}}},{key:"_parseKeyframesIndex",value:function e(t){for(var n=[],i=[],r=1;r<t.times.length;r++){var s=this._timestampBase+Math.floor(1e3*t.times[r]);n.push(s),i.push(t.filepositions[r])}return{times:n,filepositions:i}}},{key:"_parseAudioData",value:function e(t,n,i,r){if(i<=1)O.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){var s=this._littleEndian,a,o=new DataView(t,n,i).getUint8(0),u=o>>>4;if(2===u||10===u){var l=0,d=(12&o)>>>2;if(0<=d&&d<=4){l=this._flvSoundRateTable[d];var h=(2&o)>>>1,f=1&o,c=this._audioMetadata,_=this._audioTrack;if(c||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(c=this._audioMetadata={}).type="audio",c.id=_.id,c.timescale=this._timescale,c.duration=this._duration,c.audioSampleRate=l,c.channelCount=0===f?1:2),10===u){var m=this._parseAACAudioData(t,n+1,i-1);if(null==m)return;if(0===m.packetType){c.config&&O.default.w(this.TAG,"Found another AudioSpecificConfig!");var p=m.data;c.audioSampleRate=p.samplingRate,c.channelCount=p.channelCount,c.codec=p.codec,c.originalCodec=p.originalCodec,c.config=p.config,c.refSampleDuration=1024/c.audioSampleRate*c.timescale,O.default.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",c);var v=this._mediaInfo;v.audioCodec=c.originalCodec,v.audioSampleRate=c.audioSampleRate,v.audioChannelCount=c.channelCount,v.hasVideo?null!=v.videoCodec&&(v.mimeType='video/x-flv; codecs="'+v.videoCodec+","+v.audioCodec+'"'):v.mimeType='video/x-flv; codecs="'+v.audioCodec+'"',v.isComplete()&&this._onMediaInfo(v)}else if(1===m.packetType){var g=this._timestampBase+r,y={unit:m.data,length:m.data.byteLength,dts:g,pts:g};_.samples.push(y),_.length+=m.data.length}else O.default.e(this.TAG,"Flv: Unsupported AAC data type "+m.packetType)}else if(2===u){if(!c.codec){var E=this._parseMP3AudioData(t,n+1,i-1,!0);if(null==E)return;c.audioSampleRate=E.samplingRate,c.channelCount=E.channelCount,c.codec=E.codec,c.originalCodec=E.originalCodec,c.refSampleDuration=1152/c.audioSampleRate*c.timescale,O.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",c);var b=this._mediaInfo;b.audioCodec=c.codec,b.audioSampleRate=c.audioSampleRate,b.audioChannelCount=c.channelCount,b.audioDataRate=E.bitRate,b.hasVideo?null!=b.videoCodec&&(b.mimeType='video/x-flv; codecs="'+b.videoCodec+","+b.audioCodec+'"'):b.mimeType='video/x-flv; codecs="'+b.audioCodec+'"',b.isComplete()&&this._onMediaInfo(b)}var S=this._parseMP3AudioData(t,n+1,i-1,!1);if(null==S)return;var k=this._timestampBase+r,L={unit:S,length:S.byteLength,dts:k,pts:k};_.samples.push(L),_.length+=S.length}}else this._onError(C.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+d)}else this._onError(C.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+u)}}},{key:"_parseAACAudioData",value:function e(t,n,i){if(!(i<=1)){var r={},s=new Uint8Array(t,n,i);return r.packetType=s[0],0===s[0]?r.data=this._parseAACAudioSpecificConfig(t,n+1,i-1):r.data=s.subarray(1),r}O.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")}},{key:"_parseAACAudioSpecificConfig",value:function e(t,n,i){var r=new Uint8Array(t,n,i),s=null,a=0,o=0,u=null,l=0,d=null;if(a=o=r[0]>>>3,(l=(7&r[0])<<1|r[1]>>>7)<0||l>=this._mpegSamplingRates.length)this._onError(C.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var h=this._mpegSamplingRates[l],f=(120&r[1])>>>3;if(!(f<0||8<=f)){5===a&&(d=(7&r[1])<<1|r[2]>>>7,u=(124&r[2])>>>2);var c=self.navigator.userAgent.toLowerCase();return-1!==c.indexOf("firefox")?d=6<=l?(a=5,s=new Array(4),l-3):(a=2,s=new Array(2),l):-1!==c.indexOf("android")?(a=2,s=new Array(2),d=l):(a=5,d=l,s=new Array(4),6<=l?d=l-3:1===f&&(a=2,s=new Array(2),d=l)),s[0]=a<<3,s[0]|=(15&l)>>>1,s[1]=(15&l)<<7,s[1]|=(15&f)<<3,5===a&&(s[1]|=(15&d)>>>1,s[2]=(1&d)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:h,channelCount:f,codec:"mp4a.40."+a,originalCodec:"mp4a.40."+o}}this._onError(C.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}}},{key:"_parseMP3AudioData",value:function e(t,n,i,r){if(!(i<4)){var s=this._littleEndian,a=new Uint8Array(t,n,i),o=null;if(r){if(255!==a[0])return;var u=a[1]>>>3&3,l=(6&a[1])>>1,d=(240&a[2])>>>4,h=(12&a[2])>>>2,f,c=3!==(a[3]>>>6&3)?2:1,_=0,m=0,p=34,v="mp3";switch(u){case 0:_=this._mpegAudioV25SampleRateTable[h];break;case 2:_=this._mpegAudioV20SampleRateTable[h];break;case 3:_=this._mpegAudioV10SampleRateTable[h]}switch(l){case 1:p=34,d<this._mpegAudioL3BitRateTable.length&&(m=this._mpegAudioL3BitRateTable[d]);break;case 2:p=33,d<this._mpegAudioL2BitRateTable.length&&(m=this._mpegAudioL2BitRateTable[d]);break;case 3:p=32,d<this._mpegAudioL1BitRateTable.length&&(m=this._mpegAudioL1BitRateTable[d])}o={bitRate:m,samplingRate:_,channelCount:c,codec:v,originalCodec:v}}else o=a;return o}O.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")}},{key:"_parseVideoData",value:function e(t,n,i,r,s){if(i<=1)O.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var a=new Uint8Array(t,n,i)[0],o=(240&a)>>>4,u=15&a;7===u?this._parseAVCVideoPacket(t,n+1,i-1,r,s,o):this._onError(C.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+u)}}},{key:"_parseAVCVideoPacket",value:function e(t,n,i,r,s,a){if(i<4)O.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var o=this._littleEndian,u=new DataView(t,n,i),l=u.getUint8(0),d,h=(16777215&u.getUint32(0,!o))<<8>>8;if(0===l)this._parseAVCDecoderConfigurationRecord(t,n+4,i-4);else if(1===l)this._parseAVCVideoData(t,n+4,i-4,r,s,a,h);else if(2!==l)return void this._onError(C.default.FORMAT_ERROR,"Flv: Invalid video packet type "+l)}}},{key:"_parseAVCDecoderConfigurationRecord",value:function e(t,n,i){if(i<7)O.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var r=this._videoMetadata,s=this._videoTrack,a=this._littleEndian,o=new DataView(t,n,i);r?void 0!==r.avcc&&O.default.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type="video",r.id=s.id,r.timescale=this._timescale,r.duration=this._duration);var u=o.getUint8(0),l=o.getUint8(1),d=o.getUint8(2),h=o.getUint8(3);if(1===u&&0!==l)if(this._naluLengthSize=1+(3&o.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var f=31&o.getUint8(5);if(0!==f){1<f&&O.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+f);for(var c=6,_=0;_<f;_++){var m=o.getUint16(c,!a);if(c+=2,0!==m){var p=new Uint8Array(t,n+c,m);c+=m;var v=T.default.parseSPS(p);if(0===_){r.codecWidth=v.codec_size.width,r.codecHeight=v.codec_size.height,r.presentWidth=v.present_size.width,r.presentHeight=v.present_size.height,r.profile=v.profile_string,r.level=v.level_string,r.bitDepth=v.bit_depth,r.chromaFormat=v.chroma_format,r.sarRatio=v.sar_ratio,r.frameRate=v.frame_rate,!1!==v.frame_rate.fixed&&0!==v.frame_rate.fps_num&&0!==v.frame_rate.fps_den||(r.frameRate=this._referenceFrameRate);var g=r.frameRate.fps_den,y=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(g/y);for(var E=p.subarray(1,4),b="avc1.",S=0;S<3;S++){var k=E[S].toString(16);k.length<2&&(k="0"+k),b+=k}r.codec=b;var L=this._mediaInfo;L.width=r.codecWidth,L.height=r.codecHeight,L.fps=r.frameRate.fps,L.profile=r.profile,L.level=r.level,L.refFrames=v.ref_frames,L.chromaFormat=v.chroma_format_string,L.sarNum=r.sarRatio.width,L.sarDen=r.sarRatio.height,L.videoCodec=b,L.hasAudio?null!=L.audioCodec&&(L.mimeType='video/x-flv; codecs="'+L.videoCodec+","+L.audioCodec+'"'):L.mimeType='video/x-flv; codecs="'+L.videoCodec+'"',L.isComplete()&&this._onMediaInfo(L)}}}var w=o.getUint8(c);if(0!==w){1<w&&O.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+w),c++;for(var R=0;R<w;R++){var A=o.getUint16(c,!a);c+=2,0!==A&&(c+=A)}r.avcc=new Uint8Array(i),r.avcc.set(new Uint8Array(t,n,i),0),O.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",r)}else this._onError(C.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(C.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(C.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(C.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}}},{key:"_parseAVCVideoData",value:function e(t,n,i,r,s,a,o){for(var u=this._littleEndian,l=new DataView(t,n,i),d=[],h=0,f=0,c=this._naluLengthSize,_=this._timestampBase+r,m=1===a;f<i;){if(i<=f+4){O.default.w(this.TAG,"Malformed Nalu near timestamp "+_+", offset = "+f+", dataSize = "+i);break}var p=l.getUint32(f,!u);if(3===c&&(p>>>=8),i-c<p)return void O.default.w(this.TAG,"Malformed Nalus near timestamp "+_+", NaluSize > DataSize!");var v=31&l.getUint8(f+c);5===v&&(m=!0);var g=new Uint8Array(t,n+f,c+p),y={type:v,data:g};d.push(y),h+=g.byteLength,f+=c+p}if(d.length){var E=this._videoTrack,b={units:d,length:h,isKeyframe:m,dts:_,cts:o,pts:_+o};m&&(b.fileposition=s),E.samples.push(b),E.length+=h}}},{key:"onTrackMetadata",get:function e(){return this._onTrackMetadata},set:function e(t){this._onTrackMetadata=t}},{key:"onMediaInfo",get:function e(){return this._onMediaInfo},set:function e(t){this._onMediaInfo=t}},{key:"onError",get:function e(){return this._onError},set:function e(t){this._onError=t}},{key:"onDataAvailable",get:function e(){return this._onDataAvailable},set:function e(t){this._onDataAvailable=t}},{key:"timestampBase",get:function e(){return this._timestampBase},set:function e(t){this._timestampBase=t}},{key:"overridedDuration",get:function e(){return this._duration},set:function e(t){this._durationOverrided=!0,this._duration=t,this._mediaInfo.duration=t}},{key:"overridedHasAudio",set:function e(t){this._hasAudioFlagOverrided=!0,this._hasAudio=t,this._mediaInfo.hasAudio=t}},{key:"overridedHasVideo",set:function e(t){this._hasVideoFlagOverrided=!0,this._hasVideo=t,this._mediaInfo.hasVideo=t}}],[{key:"probe",value:function e(t){var n=new Uint8Array(t),i={match:!1};if(70!==n[0]||76!==n[1]||86!==n[2]||1!==n[3])return i;var r=(4&n[4])>>>2!=0,s=0!=(1&n[4]),a=p(n,5);return a<9?i:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:r,hasVideoTrack:s}}}]),y}();n.default=v},{"../core/media-info.js":7,"../utils/exception.js":40,"../utils/logger.js":41,"./amf-parser.js":15,"./demux-errors.js":16,"./sps-parser.js":19}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r,W=s(e("./exp-golomb.js"));function s(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function q(){a(this,q)}return i(q,null,[{key:"_ebsp2rbsp",value:function e(t){for(var n=t,i=n.byteLength,r=new Uint8Array(i),s=0,a=0;a<i;a++)2<=a&&3===n[a]&&0===n[a-1]&&0===n[a-2]||(r[s]=n[a],s++);return new Uint8Array(r.buffer,0,s)}},{key:"parseSPS",value:function e(t){var n=q._ebsp2rbsp(t),i=new W.default(n);i.readByte();var r=i.readByte();i.readByte();var s=i.readByte();i.readUEG();var a=q.getProfileString(r),o=q.getLevelString(s),u=1,l=420,d=[0,420,422,444],h=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(3===(u=i.readUEG())&&i.readBits(1),u<=3&&(l=d[u]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool()))for(var f=3!==u?8:12,c=0;c<f;c++)i.readBool()&&q._skipScalingList(i,c<6?16:64);i.readUEG();var _=i.readUEG();if(0===_)i.readUEG();else if(1===_){i.readBits(1),i.readSEG(),i.readSEG();for(var m=i.readUEG(),p=0;p<m;p++)i.readSEG()}var v=i.readUEG();i.readBits(1);var g=i.readUEG(),y=i.readUEG(),E=i.readBits(1);0===E&&i.readBits(1),i.readBits(1);var b=0,S=0,k=0,L=0,w;i.readBool()&&(b=i.readUEG(),S=i.readUEG(),k=i.readUEG(),L=i.readUEG());var R=1,A=1,O=0,T=!0,C=0,I=0,x;if(i.readBool()){if(i.readBool()){var M=i.readByte(),D,B;0<M&&M<16?(R=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][M-1],A=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][M-1]):255===M&&(R=i.readByte()<<8|i.readByte(),A=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){var j=i.readBits(32),P=i.readBits(32);T=i.readBool(),O=(C=P)/(I=2*j)}}var U=1;1===R&&1===A||(U=R/A);var N=0,F=0,G,V;0===u?(N=1,F=2-E):(N=3===u?1:2,F=(1===u?2:1)*(2-E));var z=16*(g+1),H=16*(y+1)*(2-E);z-=(b+S)*N,H-=(k+L)*F;var K=Math.ceil(z*U);return i.destroy(),i=null,{profile_string:a,level_string:o,bit_depth:h,ref_frames:v,chroma_format:l,chroma_format_string:q.getChromaFormatString(l),frame_rate:{fixed:T,fps:O,fps_den:I,fps_num:C},sar_ratio:{width:R,height:A},codec_size:{width:z,height:H},present_size:{width:K,height:H}}}},{key:"_skipScalingList",value:function e(t,n){for(var i=8,r=8,s=0,a=0;a<n;a++)0!==r&&(r=(i+(s=t.readSEG())+256)%256),i=0===r?i:r}},{key:"getProfileString",value:function e(t){switch(t){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}},{key:"getLevelString",value:function e(t){return(t/10).toFixed(1)}},{key:"getChromaFormatString",value:function e(t){switch(t){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}]),q}();n.default=o},{"./exp-golomb.js":17}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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},r,s=g(e("./utils/polyfill.js")),a,o=g(e("./core/features.js")),u,l=g(e("./player/flv-player.js")),d,h=g(e("./player/native-player.js")),f,c=g(e("./player/player-events.js")),_=e("./player/player-errors.js"),m,p=g(e("./utils/logging-control.js")),v=e("./utils/exception.js");function g(e){return e&&e.__esModule?e:{default:e}}function y(e,t){var n=e;if(null==n||"object"!==(void 0===n?"undefined":i(n)))throw new v.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!n.hasOwnProperty("type"))throw new v.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(n.type){case"flv":return new l.default(n,t);default:return new h.default(n,t)}}function E(){return o.default.supportMSEH264Playback()}function b(){return o.default.getFeatureList()}s.default.install();var S={};S.createPlayer=y,S.isSupported=E,S.getFeatureList=b,S.Events=c.default,S.ErrorTypes=_.ErrorTypes,S.ErrorDetails=_.ErrorDetails,S.FlvPlayer=l.default,S.NativePlayer=h.default,S.LoggingControl=p.default,Object.defineProperty(S,"version",{enumerable:!0,get:function e(){return"1.4.0"}}),n.default=S},{"./core/features.js":6,"./player/flv-player.js":32,"./player/native-player.js":33,"./player/player-errors.js":34,"./player/player-events.js":35,"./utils/exception.js":40,"./utils/logging-control.js":42,"./utils/polyfill.js":43}],21:[function(e,t,n){"use strict";t.exports=e("./flv.js").default},{"./flv.js":20}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var d="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},r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},s=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,a=l(e("../utils/logger.js")),o,u=l(e("../utils/browser.js")),h=e("./loader.js"),f=e("../utils/exception.js");function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var p=function(e){function i(e,t){c(this,i);var n=_(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,"fetch-stream-loader"));return n.TAG="FetchStreamLoader",n._seekHandler=e,n._config=t,n._needStash=!0,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return m(i,e),s(i,null,[{key:"isSupported",value:function e(){try{var t=u.default.msedge&&15048<=u.default.version.minor,n=!u.default.msedge||t;return self.fetch&&self.ReadableStream&&n}catch(e){return!1}}}]),s(i,[{key:"destroy",value:function e(){this.isWorking()&&this.abort(),r(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"destroy",this).call(this)}},{key:"open",value:function e(t,n){var i=this;this._dataSource=t,this._range=n;var r=t.url;this._config.reuseRedirectedURL&&null!=t.redirectedURL&&(r=t.redirectedURL);var s=this._seekHandler.getConfig(r,n),a=new self.Headers;if("object"===d(s.headers)){var o=s.headers;for(var u in o)o.hasOwnProperty(u)&&a.append(u,o[u])}var l={method:"GET",headers:a,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};!1===t.cors&&(l.mode="same-origin"),t.withCredentials&&(l.credentials="include"),t.referrerPolicy&&(l.referrerPolicy=t.referrerPolicy),this._status=h.LoaderStatus.kConnecting,self.fetch(s.url,l).then(function(e){if(i._requestAbort)return i._requestAbort=!1,void(i._status=h.LoaderStatus.kIdle);if(e.ok&&200<=e.status&&e.status<=299){if(e.url!==s.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var n=e.headers.get("Content-Length");return null!=n&&(i._contentLength=parseInt(n),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=h.LoaderStatus.kError,!i._onError)throw new f.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(h.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}).catch(function(e){if(i._status=h.LoaderStatus.kError,!i._onError)throw e;i._onError(h.LoaderErrors.EXCEPTION,{code:-1,msg:e.message})})}},{key:"abort",value:function e(){this._requestAbort=!0}},{key:"_pump",value:function e(i){var r=this;return i.read().then(function(e){if(e.done)r._status=h.LoaderStatus.kComplete,r._onComplete&&r._onComplete(r._range.from,r._range.from+r._receivedLength-1);else{if(!0===r._requestAbort)return r._requestAbort=!1,r._status=h.LoaderStatus.kComplete,i.cancel();r._status=h.LoaderStatus.kBuffering;var t=e.value.buffer,n=r._range.from+r._receivedLength;r._receivedLength+=t.byteLength,r._onDataArrival&&r._onDataArrival(t,n,r._receivedLength),r._pump(i)}}).catch(function(e){if(11!==e.code||!u.default.msedge){r._status=h.LoaderStatus.kError;var t=0,n=null;if(n=19!==e.code&&"network error"!==e.message||!(null===r._contentLength||null!==r._contentLength&&r._receivedLength<r._contentLength)?(t=h.LoaderErrors.EXCEPTION,{code:e.code,msg:e.message}):(t=h.LoaderErrors.EARLY_EOF,{code:e.code,msg:"Fetch stream meet Early-EOF"}),!r._onError)throw new f.RuntimeException(n.msg);r._onError(t,n)}})}}]),i}(h.BaseLoader);n.default=p},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,o=L(e("../utils/logger.js")),s,a=L(e("./speed-sampler.js")),u=e("./loader.js"),l,d=L(e("./fetch-stream-loader.js")),h,f=L(e("./xhr-moz-chunked-loader.js")),c,_=L(e("./xhr-msstream-loader.js")),m,p=L(e("./xhr-range-loader.js")),v,g=L(e("./websocket-loader.js")),y,E=L(e("./range-seek-handler.js")),b,S=L(e("./param-seek-handler.js")),k=e("../utils/exception.js");function L(e){return e&&e.__esModule?e:{default:e}}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var R=function(){function i(e,t,n){w(this,i),this.TAG="IOController",this._config=t,this._extraData=n,this._stashInitialSize=393216,null!=t.stashInitialSize&&0<t.stashInitialSize&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,!(this._enableStash=!0)===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new a.default,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return r(i,[{key:"destroy",value:function e(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}},{key:"isWorking",value:function e(){return this._loader&&this._loader.isWorking()&&!this._paused}},{key:"isPaused",value:function e(){return this._paused}},{key:"_selectSeekHandler",value:function e(){var t=this._config;if("range"===t.seekType)this._seekHandler=new E.default(this._config.rangeLoadZeroStart);else if("param"===t.seekType){var n=t.seekParamStart||"bstart",i=t.seekParamEnd||"bend";this._seekHandler=new S.default(n,i)}else{if("custom"!==t.seekType)throw new k.InvalidArgumentException("Invalid seekType in config: "+t.seekType);if("function"!=typeof t.customSeekHandler)throw new k.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new t.customSeekHandler}}},{key:"_selectLoader",value:function e(){if(this._isWebSocketURL)this._loaderClass=g.default;else if(d.default.isSupported())this._loaderClass=d.default;else if(f.default.isSupported())this._loaderClass=f.default;else{if(!p.default.isSupported())throw new k.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=p.default}}},{key:"_createLoader",value:function e(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}},{key:"open",value:function e(t){this._currentRange={from:0,to:-1},t&&(this._currentRange.from=t),this._speedSampler.reset(),t||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}},{key:"abort",value:function e(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}},{key:"pause",value:function e(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}},{key:"resume",value:function e(){if(this._paused){this._paused=!1;var t=this._resumeFrom;this._resumeFrom=0,this._internalSeek(t,!0)}}},{key:"seek",value:function e(t){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(t,!0)}},{key:"_internalSeek",value:function e(t,n){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(n),this._loader.destroy(),this._loader=null;var i={from:t,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()}},{key:"updateUrl",value:function e(t){if(!t||"string"!=typeof t||0===t.length)throw new k.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=t}},{key:"_expandBuffer",value:function e(t){for(var n=this._stashSize;n+1048576<t;)n*=2;if((n+=1048576)!==this._bufferSize){var i=new ArrayBuffer(n);if(0<this._stashUsed){var r=new Uint8Array(this._stashBuffer,0,this._stashUsed),s;new Uint8Array(i,0,n).set(r,0)}this._stashBuffer=i,this._bufferSize=n}}},{key:"_normalizeSpeed",value:function e(t){var n=this._speedNormalizeList,i=n.length-1,r=0,s=0,a=i;if(t<n[0])return n[0];for(;s<=a;){if((r=s+Math.floor((a-s)/2))===i||t>=n[r]&&t<n[r+1])return n[r];n[r]<t?s=r+1:a=r-1}}},{key:"_adjustStashSize",value:function e(t){var n=0;8192<(n=this._config.isLive?t:t<512?t:512<=t&&t<=1024?Math.floor(1.5*t):2*t)&&(n=8192);var i=1024*n+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*n}},{key:"_dispatchChunks",value:function e(t,n){return this._currentRange.to=n+t.byteLength-1,this._onDataArrival(t,n)}},{key:"_onURLRedirect",value:function e(t){this._redirectedURL=t,this._onRedirect&&this._onRedirect(t)}},{key:"_onContentLengthKnown",value:function e(t){t&&this._fullRequestFlag&&(this._totalLength=t,this._fullRequestFlag=!1)}},{key:"_onLoaderChunkArrival",value:function e(t,n,i){if(!this._onDataArrival)throw new k.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(t.byteLength);var r=this._speedSampler.lastSecondKBps;if(0!==r){var s=this._normalizeSpeed(r);this._speedNormalized!==s&&(this._speedNormalized=s,this._adjustStashSize(s))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=n),this._stashUsed+t.byteLength<=this._stashSize){var a;new Uint8Array(this._stashBuffer,0,this._stashSize).set(new Uint8Array(t),this._stashUsed),this._stashUsed+=t.byteLength}else{var o=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(0<this._stashUsed){var u=this._stashBuffer.slice(0,this._stashUsed),l=this._dispatchChunks(u,this._stashByteStart);if(l<u.byteLength){if(0<l){var d=new Uint8Array(u,l);o.set(d,0),this._stashUsed=d.byteLength,this._stashByteStart+=l}}else this._stashUsed=0,this._stashByteStart+=l;this._stashUsed+t.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+t.byteLength),o=new Uint8Array(this._stashBuffer,0,this._bufferSize)),o.set(new Uint8Array(t),this._stashUsed),this._stashUsed+=t.byteLength}else{var h=this._dispatchChunks(t,n);if(h<t.byteLength){var f=t.byteLength-h;f>this._bufferSize&&(this._expandBuffer(f),o=new Uint8Array(this._stashBuffer,0,this._bufferSize)),o.set(new Uint8Array(t,h),0),this._stashUsed+=f,this._stashByteStart=n+h}}}else if(0===this._stashUsed){var c=this._dispatchChunks(t,n);if(c<t.byteLength){var _=t.byteLength-c,m;_>this._bufferSize&&this._expandBuffer(_),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(t,c),0),this._stashUsed+=_,this._stashByteStart=n+c}}else{this._stashUsed+t.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+t.byteLength);var p=new Uint8Array(this._stashBuffer,0,this._bufferSize);p.set(new Uint8Array(t),this._stashUsed),this._stashUsed+=t.byteLength;var v=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(v<this._stashUsed&&0<v){var g=new Uint8Array(this._stashBuffer,v);p.set(g,0)}this._stashUsed-=v,this._stashByteStart+=v}}}},{key:"_flushStashBuffer",value:function e(t){if(0<this._stashUsed){var n=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(n,this._stashByteStart),r=n.byteLength-i;if(i<n.byteLength){if(!t){if(0<i){var s=new Uint8Array(this._stashBuffer,0,this._bufferSize),a=new Uint8Array(n,i);s.set(a,0),this._stashUsed=a.byteLength,this._stashByteStart+=i}return 0}o.default.w(this.TAG,r+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,r}return 0}},{key:"_onLoaderComplete",value:function e(t,n){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}},{key:"_onLoaderError",value:function e(t,n){switch(o.default.e(this.TAG,"Loader error, code = "+n.code+", msg = "+n.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,t=u.LoaderErrors.UNRECOVERABLE_EARLY_EOF),t){case u.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(o.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}t=u.LoaderErrors.UNRECOVERABLE_EARLY_EOF;break;case u.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case u.LoaderErrors.CONNECTING_TIMEOUT:case u.LoaderErrors.HTTP_STATUS_CODE_INVALID:case u.LoaderErrors.EXCEPTION:}if(!this._onError)throw new k.RuntimeException("IOException: "+n.msg);this._onError(t,n)}},{key:"status",get:function e(){return this._loader.status}},{key:"extraData",get:function e(){return this._extraData},set:function e(t){this._extraData=t}},{key:"onDataArrival",get:function e(){return this._onDataArrival},set:function e(t){this._onDataArrival=t}},{key:"onSeeked",get:function e(){return this._onSeeked},set:function e(t){this._onSeeked=t}},{key:"onError",get:function e(){return this._onError},set:function e(t){this._onError=t}},{key:"onComplete",get:function e(){return this._onComplete},set:function e(t){this._onComplete=t}},{key:"onRedirect",get:function e(){return this._onRedirect},set:function e(t){this._onRedirect=t}},{key:"onRecoveredEarlyEof",get:function e(){return this._onRecoveredEarlyEof},set:function e(t){this._onRecoveredEarlyEof=t}},{key:"currentURL",get:function e(){return this._dataSource.url}},{key:"hasRedirect",get:function e(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL}},{key:"currentRedirectedURL",get:function e(){return this._redirectedURL||this._dataSource.redirectedURL}},{key:"currentSpeed",get:function e(){return this._loaderClass===p.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}},{key:"loaderType",get:function e(){return this._loader.type}}]),i}();n.default=R},{"../utils/exception.js":40,"../utils/logger.js":41,"./fetch-stream-loader.js":22,"./loader.js":24,"./param-seek-handler.js":25,"./range-seek-handler.js":26,"./speed-sampler.js":27,"./websocket-loader.js":28,"./xhr-moz-chunked-loader.js":29,"./xhr-msstream-loader.js":30,"./xhr-range-loader.js":31}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.BaseLoader=n.LoaderErrors=n.LoaderStatus=void 0;var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r=e("../utils/exception.js");function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=n.LoaderStatus={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},o=n.LoaderErrors={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},u=n.BaseLoader=function(){function t(e){s(this,t),this._type=e||"undefined",this._status=a.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return i(t,[{key:"destroy",value:function e(){this._status=a.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}},{key:"isWorking",value:function e(){return this._status===a.kConnecting||this._status===a.kBuffering}},{key:"open",value:function e(t,n){throw new r.NotImplementedException("Unimplemented abstract function!")}},{key:"abort",value:function e(){throw new r.NotImplementedException("Unimplemented abstract function!")}},{key:"type",get:function e(){return this._type}},{key:"status",get:function e(){return this._status}},{key:"needStashBuffer",get:function e(){return this._needStash}},{key:"onContentLengthKnown",get:function e(){return this._onContentLengthKnown},set:function e(t){this._onContentLengthKnown=t}},{key:"onURLRedirect",get:function e(){return this._onURLRedirect},set:function e(t){this._onURLRedirect=t}},{key:"onDataArrival",get:function e(){return this._onDataArrival},set:function e(t){this._onDataArrival=t}},{key:"onError",get:function e(){return this._onError},set:function e(t){this._onError=t}},{key:"onComplete",get:function e(){return this._onComplete},set:function e(t){this._onComplete=t}}]),t}()},{"../utils/exception.js":40}],25:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function n(e,t){r(this,n),this._startName=e,this._endName=t}return i(n,[{key:"getConfig",value:function e(t,n){var i=t;if(0!==n.from||-1!==n.to){var r=!0;-1===i.indexOf("?")&&(i+="?",r=!1),r&&(i+="&"),i+=this._startName+"="+n.from.toString(),-1!==n.to&&(i+="&"+this._endName+"="+n.to.toString())}return{url:i,headers:{}}}},{key:"removeURLParameters",value:function e(t){var n=t.split("?")[0],i=void 0,r=t.indexOf("?");-1!==r&&(i=t.substring(r+1));var s="";if(null!=i&&0<i.length)for(var a=i.split("&"),o=0;o<a.length;o++){var u=a[o].split("="),l=0<o;u[0]!==this._startName&&u[0]!==this._endName&&(l&&(s+="&"),s+=a[o])}return 0===s.length?n:n+"?"+s}}]),n}();n.default=s},{}],26:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(e){r(this,t),this._zeroStart=e||!1}return i(t,[{key:"getConfig",value:function e(t,n){var i={};if(0!==n.from||-1!==n.to){var r=void 0;r=-1!==n.to?"bytes="+n.from.toString()+"-"+n.to.toString():"bytes="+n.from.toString()+"-",i.Range=r}else this._zeroStart&&(i.Range="bytes=0-");return{url:t,headers:i}}},{key:"removeURLParameters",value:function e(t){return t}}]),t}();n.default=s},{}],27:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(){r(this,e),this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return i(e,[{key:"reset",value:function e(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}},{key:"addBytes",value:function e(t){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=t,this._totalBytes+=t):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=t,this._totalBytes+=t):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=t,this._totalBytes+=t,this._lastCheckpoint=this._now())}},{key:"currentKBps",get:function e(){this.addBytes(0);var t=(this._now()-this._lastCheckpoint)/1e3;return 0==t&&(t=1),this._intervalBytes/t/1024}},{key:"lastSecondKBps",get:function e(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:500<=this._now()-this._lastCheckpoint?this.currentKBps:0}},{key:"averageKBps",get:function e(){var t=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/t/1024}}]),e}();n.default=s},{}],28:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},r=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),s,a=l(e("../utils/logger.js")),o=e("./loader.js"),u=e("../utils/exception.js");function l(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){function t(){d(this,t);var e=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"websocket-loader"));return e.TAG="WebSocketLoader",e._needStash=!0,e._ws=null,e._requestAbort=!1,e._receivedLength=0,e}return f(t,e),r(t,null,[{key:"isSupported",value:function e(){try{return void 0!==self.WebSocket}catch(e){return!1}}}]),r(t,[{key:"destroy",value:function e(){this._ws&&this.abort(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function e(t){try{var n=this._ws=new self.WebSocket(t.url);n.binaryType="arraybuffer",n.onopen=this._onWebSocketOpen.bind(this),n.onclose=this._onWebSocketClose.bind(this),n.onmessage=this._onWebSocketMessage.bind(this),n.onerror=this._onWebSocketError.bind(this),this._status=o.LoaderStatus.kConnecting}catch(e){this._status=o.LoaderStatus.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new u.RuntimeException(i.msg);this._onError(o.LoaderErrors.EXCEPTION,i)}}},{key:"abort",value:function e(){var t=this._ws;!t||0!==t.readyState&&1!==t.readyState||(this._requestAbort=!0,t.close()),this._ws=null,this._status=o.LoaderStatus.kComplete}},{key:"_onWebSocketOpen",value:function e(t){this._status=o.LoaderStatus.kBuffering}},{key:"_onWebSocketClose",value:function e(t){!0!==this._requestAbort?(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1}},{key:"_onWebSocketMessage",value:function e(t){var n=this;if(t.data instanceof ArrayBuffer)this._dispatchArrayBuffer(t.data);else if(t.data instanceof Blob){var i=new FileReader;i.onload=function(){n._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(t.data)}else{this._status=o.LoaderStatus.kError;var r={code:-1,msg:"Unsupported WebSocket message type: "+t.data.constructor.name};if(!this._onError)throw new u.RuntimeException(r.msg);this._onError(o.LoaderErrors.EXCEPTION,r)}}},{key:"_dispatchArrayBuffer",value:function e(t){var n=t,i=this._receivedLength;this._receivedLength+=n.byteLength,this._onDataArrival&&this._onDataArrival(n,i,this._receivedLength)}},{key:"_onWebSocketError",value:function e(t){this._status=o.LoaderStatus.kError;var n={code:t.code,msg:t.message};if(!this._onError)throw new u.RuntimeException(n.msg);this._onError(o.LoaderErrors.EXCEPTION,n)}}]),t}(o.BaseLoader);n.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],29:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var u="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},r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},s=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,a=d(e("../utils/logger.js")),l=e("./loader.js"),o=e("../utils/exception.js");function d(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _=function(e){function i(e,t){h(this,i);var n=f(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,"xhr-moz-chunked-loader"));return n.TAG="MozChunkedLoader",n._seekHandler=e,n._config=t,n._needStash=!0,n._xhr=null,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return c(i,e),s(i,null,[{key:"isSupported",value:function e(){try{var t=new XMLHttpRequest;return t.open("GET","https://example.com",!0),(t.responseType="moz-chunked-arraybuffer")===t.responseType}catch(e){return a.default.w("MozChunkedLoader",e.message),!1}}}]),s(i,[{key:"destroy",value:function e(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),r(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"destroy",this).call(this)}},{key:"open",value:function e(t,n){this._dataSource=t,this._range=n;var i=t.url;this._config.reuseRedirectedURL&&null!=t.redirectedURL&&(i=t.redirectedURL);var r=this._seekHandler.getConfig(i,n);this._requestURL=r.url;var s=this._xhr=new XMLHttpRequest;if(s.open("GET",r.url,!0),s.responseType="moz-chunked-arraybuffer",s.onreadystatechange=this._onReadyStateChange.bind(this),s.onprogress=this._onProgress.bind(this),s.onloadend=this._onLoadEnd.bind(this),s.onerror=this._onXhrError.bind(this),t.withCredentials&&(s.withCredentials=!0),"object"===u(r.headers)){var a=r.headers;for(var o in a)a.hasOwnProperty(o)&&s.setRequestHeader(o,a[o])}this._status=l.LoaderStatus.kConnecting,s.send()}},{key:"abort",value:function e(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=l.LoaderStatus.kComplete}},{key:"_onReadyStateChange",value:function e(t){var n=t.target;if(2===n.readyState){if(null!=n.responseURL&&n.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(n.responseURL);this._onURLRedirect(i)}if(0!==n.status&&(n.status<200||299<n.status)){if(this._status=l.LoaderStatus.kError,!this._onError)throw new o.RuntimeException("MozChunkedLoader: Http code invalid, "+n.status+" "+n.statusText);this._onError(l.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:n.status,msg:n.statusText})}else this._status=l.LoaderStatus.kBuffering}}},{key:"_onProgress",value:function e(t){if(this._status!==l.LoaderStatus.kError){null===this._contentLength&&null!==t.total&&0!==t.total&&(this._contentLength=t.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var n=t.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=n.byteLength,this._onDataArrival&&this._onDataArrival(n,i,this._receivedLength)}}},{key:"_onLoadEnd",value:function e(t){!0!==this._requestAbort?this._status!==l.LoaderStatus.kError&&(this._status=l.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1}},{key:"_onXhrError",value:function e(t){this._status=l.LoaderStatus.kError;var n=0,i=null;if(i=this._contentLength&&t.loaded<this._contentLength?(n=l.LoaderErrors.EARLY_EOF,{code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(n=l.LoaderErrors.EXCEPTION,{code:-1,msg:t.constructor.name+" "+t.type}),!this._onError)throw new o.RuntimeException(i.msg);this._onError(n,i)}}]),i}(l.BaseLoader);n.default=_},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],30:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var d="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},r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},s=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,a=u(e("../utils/logger.js")),h=e("./loader.js"),o=e("../utils/exception.js");function u(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _=function(e){function i(e,t){l(this,i);var n=f(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,"xhr-msstream-loader"));return n.TAG="MSStreamLoader",n._seekHandler=e,n._config=t,n._needStash=!0,n._xhr=null,n._reader=null,n._totalRange=null,n._currentRange=null,n._currentRequestURL=null,n._currentRedirectedURL=null,n._contentLength=null,n._receivedLength=0,n._bufferLimit=16777216,n._lastTimeBufferSize=0,n._isReconnecting=!1,n}return c(i,e),s(i,null,[{key:"isSupported",value:function e(){try{if(void 0===self.MSStream||void 0===self.MSStreamReader)return!1;var t=new XMLHttpRequest;return t.open("GET","https://example.com",!0),(t.responseType="ms-stream")===t.responseType}catch(e){return a.default.w("MSStreamLoader",e.message),!1}}}]),s(i,[{key:"destroy",value:function e(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),r(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"destroy",this).call(this)}},{key:"open",value:function e(t,n){this._internalOpen(t,n,!1)}},{key:"_internalOpen",value:function e(t,n,i){this._dataSource=t,i?this._currentRange=n:this._totalRange=n;var r=t.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?r=this._currentRedirectedURL:null!=t.redirectedURL&&(r=t.redirectedURL));var s=this._seekHandler.getConfig(r,n);this._currentRequestURL=s.url;var a=this._reader=new self.MSStreamReader;a.onprogress=this._msrOnProgress.bind(this),a.onload=this._msrOnLoad.bind(this),a.onerror=this._msrOnError.bind(this);var o=this._xhr=new XMLHttpRequest;if(o.open("GET",s.url,!0),o.responseType="ms-stream",o.onreadystatechange=this._xhrOnReadyStateChange.bind(this),o.onerror=this._xhrOnError.bind(this),t.withCredentials&&(o.withCredentials=!0),"object"===d(s.headers)){var u=s.headers;for(var l in u)u.hasOwnProperty(l)&&o.setRequestHeader(l,u[l])}this._isReconnecting?this._isReconnecting=!1:this._status=h.LoaderStatus.kConnecting,o.send()}},{key:"abort",value:function e(){this._internalAbort(),this._status=h.LoaderStatus.kComplete}},{key:"_internalAbort",value:function e(){this._reader&&(1===this._reader.readyState&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)}},{key:"_xhrOnReadyStateChange",value:function e(t){var n=t.target;if(2===n.readyState)if(200<=n.status&&n.status<=299){if(this._status=h.LoaderStatus.kBuffering,null!=n.responseURL){var i=this._seekHandler.removeURLParameters(n.responseURL);n.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}var r=n.getResponseHeader("Content-Length");if(null!=r&&null==this._contentLength){var s=parseInt(r);0<s&&(this._contentLength=s,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else{if(this._status=h.LoaderStatus.kError,!this._onError)throw new o.RuntimeException("MSStreamLoader: Http code invalid, "+n.status+" "+n.statusText);this._onError(h.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:n.status,msg:n.statusText})}else if(3===n.readyState&&200<=n.status&&n.status<=299){this._status=h.LoaderStatus.kBuffering;var a=n.response;this._reader.readAsArrayBuffer(a)}}},{key:"_xhrOnError",value:function e(t){this._status=h.LoaderStatus.kError;var n=h.LoaderErrors.EXCEPTION,i={code:-1,msg:t.constructor.name+" "+t.type};if(!this._onError)throw new o.RuntimeException(i.msg);this._onError(n,i)}},{key:"_msrOnProgress",value:function e(t){var n,i=t.target.result;if(null!=i){var r=i.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=i.byteLength;var s=this._totalRange.from+this._receivedLength;this._receivedLength+=r.byteLength,this._onDataArrival&&this._onDataArrival(r,s,this._receivedLength),i.byteLength>=this._bufferLimit&&(a.default.v(this.TAG,"MSStream buffer exceeded max size near "+(s+r.byteLength)+", reconnecting..."),this._doReconnectIfNeeded())}else this._doReconnectIfNeeded()}},{key:"_doReconnectIfNeeded",value:function e(){if(null==this._contentLength||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();var t={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,t,!0)}}},{key:"_msrOnLoad",value:function e(t){this._status=h.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}},{key:"_msrOnError",value:function e(t){this._status=h.LoaderStatus.kError;var n=0,i=null;if(i=this._contentLength&&this._receivedLength<this._contentLength?(n=h.LoaderErrors.EARLY_EOF,{code:-1,msg:"MSStream meet Early-Eof"}):(n=h.LoaderErrors.EARLY_EOF,{code:-1,msg:t.constructor.name+" "+t.type}),!this._onError)throw new o.RuntimeException(i.msg);this._onError(n,i)}}]),i}(h.BaseLoader);n.default=_},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],31:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var u="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},r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},s=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,a=f(e("../utils/logger.js")),o,l=f(e("./speed-sampler.js")),d=e("./loader.js"),h=e("../utils/exception.js");function f(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var p=function(e){function i(e,t){c(this,i);var n=_(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,"xhr-range-loader"));return n.TAG="RangeLoader",n._seekHandler=e,n._config=t,n._needStash=!1,n._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],n._currentChunkSizeKB=384,n._currentSpeedNormalized=0,n._zeroSpeedChunkCount=0,n._xhr=null,n._speedSampler=new l.default,n._requestAbort=!1,n._waitForTotalLength=!1,n._totalLengthReceived=!1,n._currentRequestURL=null,n._currentRedirectedURL=null,n._currentRequestRange=null,n._totalLength=null,n._contentLength=null,n._receivedLength=0,n._lastTimeLoaded=0,n}return m(i,e),s(i,null,[{key:"isSupported",value:function e(){try{var t=new XMLHttpRequest;return t.open("GET","https://example.com",!0),(t.responseType="arraybuffer")===t.responseType}catch(e){return a.default.w("RangeLoader",e.message),!1}}}]),s(i,[{key:"destroy",value:function e(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),r(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"destroy",this).call(this)}},{key:"open",value:function e(t,n){this._dataSource=t,this._range=n,this._status=d.LoaderStatus.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))}},{key:"_openSubRange",value:function e(){var t=1024*this._currentChunkSizeKB,n=this._range.from+this._receivedLength,i=n+t;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:n,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)}},{key:"_internalOpen",value:function e(t,n){this._lastTimeLoaded=0;var i=t.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=t.redirectedURL&&(i=t.redirectedURL));var r=this._seekHandler.getConfig(i,n);this._currentRequestURL=r.url;var s=this._xhr=new XMLHttpRequest;if(s.open("GET",r.url,!0),s.responseType="arraybuffer",s.onreadystatechange=this._onReadyStateChange.bind(this),s.onprogress=this._onProgress.bind(this),s.onload=this._onLoad.bind(this),s.onerror=this._onXhrError.bind(this),t.withCredentials&&(s.withCredentials=!0),"object"===u(r.headers)){var a=r.headers;for(var o in a)a.hasOwnProperty(o)&&s.setRequestHeader(o,a[o])}s.send()}},{key:"abort",value:function e(){this._requestAbort=!0,this._internalAbort(),this._status=d.LoaderStatus.kComplete}},{key:"_internalAbort",value:function e(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}},{key:"_onReadyStateChange",value:function e(t){var n=t.target;if(2===n.readyState){if(null!=n.responseURL){var i=this._seekHandler.removeURLParameters(n.responseURL);n.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(200<=n.status&&n.status<=299){if(this._waitForTotalLength)return;this._status=d.LoaderStatus.kBuffering}else{if(this._status=d.LoaderStatus.kError,!this._onError)throw new h.RuntimeException("RangeLoader: Http code invalid, "+n.status+" "+n.statusText);this._onError(d.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:n.status,msg:n.statusText})}}}},{key:"_onProgress",value:function e(t){if(this._status!==d.LoaderStatus.kError){if(null===this._contentLength){var n=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,n=this._totalLengthReceived=!0;var i=t.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,n)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var r=t.loaded-this._lastTimeLoaded;this._lastTimeLoaded=t.loaded,this._speedSampler.addBytes(r)}}},{key:"_normalizeSpeed",value:function e(t){var n=this._chunkSizeKBList,i=n.length-1,r=0,s=0,a=i;if(t<n[0])return n[0];for(;s<=a;){if((r=s+Math.floor((a-s)/2))===i||t>=n[r]&&t<n[r+1])return n[r];n[r]<t?s=r+1:a=r-1}}},{key:"_onLoad",value:function e(t){if(this._status!==d.LoaderStatus.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var n=this._speedSampler.lastSecondKBps;if(0===n&&(this._zeroSpeedChunkCount++,3<=this._zeroSpeedChunkCount&&(n=this._speedSampler.currentKBps)),0!==n){var i=this._normalizeSpeed(n);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var r=t.target.response,s=this._range.from+this._receivedLength;this._receivedLength+=r.byteLength;var a=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(r,s,this._receivedLength),a&&(this._status=d.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}}},{key:"_onXhrError",value:function e(t){this._status=d.LoaderStatus.kError;var n=0,i=null;if(i=this._contentLength&&0<this._receivedLength&&this._receivedLength<this._contentLength?(n=d.LoaderErrors.EARLY_EOF,{code:-1,msg:"RangeLoader meet Early-Eof"}):(n=d.LoaderErrors.EXCEPTION,{code:-1,msg:t.constructor.name+" "+t.type}),!this._onError)throw new h.RuntimeException(i.msg);this._onError(n,i)}},{key:"currentSpeed",get:function e(){return this._speedSampler.lastSecondKBps}}]),i}(d.BaseLoader);n.default=p},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24,"./speed-sampler.js":27}],32:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="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},s=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,a=L(e("events")),o,u=L(e("../utils/logger.js")),l,d=L(e("../utils/browser.js")),h,f=L(e("./player-events.js")),c,_=L(e("../core/transmuxer.js")),m,p=L(e("../core/transmuxing-events.js")),v,g=L(e("../core/mse-controller.js")),y,E=L(e("../core/mse-events.js")),b=e("./player-errors.js"),S=e("../config.js"),k=e("../utils/exception.js");function L(e){return e&&e.__esModule?e:{default:e}}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var R=function(){function i(e,t){if(w(this,i),this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new a.default,this._config=(0,S.createDefaultConfig)(),"object"===(void 0===t?"undefined":r(t))&&Object.assign(this._config,t),"flv"!==e.type.toLowerCase())throw new k.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");!0===e.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var n=d.default.chrome&&(d.default.version.major<50||50===d.default.version.major&&d.default.version.build<2661);this._alwaysSeekKeyframe=!!(n||d.default.msedge||d.default.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return s(i,[{key:"destroy",value:function e(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function e(t,n){var i=this;t===f.default.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then(function(){i._emitter.emit(f.default.MEDIA_INFO,i.mediaInfo)}):t===f.default.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then(function(){i._emitter.emit(f.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(t,n)}},{key:"off",value:function e(t,n){this._emitter.removeListener(t,n)}},{key:"attachMediaElement",value:function e(t){var n=this;if((this._mediaElement=t).addEventListener("loadedmetadata",this.e.onvLoadedMetadata),t.addEventListener("seeking",this.e.onvSeeking),t.addEventListener("canplay",this.e.onvCanPlay),t.addEventListener("stalled",this.e.onvStalled),t.addEventListener("progress",this.e.onvProgress),this._msectl=new g.default(this._config),this._msectl.on(E.default.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(E.default.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(E.default.SOURCE_OPEN,function(){n._mseSourceOpened=!0,n._hasPendingLoad&&(n._hasPendingLoad=!1,n.load())}),this._msectl.on(E.default.ERROR,function(e){n._emitter.emit(f.default.ERROR,b.ErrorTypes.MEDIA_ERROR,b.ErrorDetails.MEDIA_MSE_ERROR,e)}),this._msectl.attachMediaElement(t),null!=this._pendingSeekTime)try{t.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function e(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}},{key:"load",value:function e(){var i=this;if(!this._mediaElement)throw new k.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new k.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(0<this._mediaElement.readyState&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new _.default(this._mediaDataSource,this._config),this._transmuxer.on(p.default.INIT_SEGMENT,function(e,t){i._msectl.appendInitSegment(t)}),this._transmuxer.on(p.default.MEDIA_SEGMENT,function(e,t){if(i._msectl.appendMediaSegment(t),i._config.lazyLoad&&!i._config.isLive){var n=i._mediaElement.currentTime;t.info.endDts>=1e3*(n+i._config.lazyLoadMaxDuration)&&null==i._progressChecker&&(u.default.v(i.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),i._suspendTransmuxer())}}),this._transmuxer.on(p.default.LOADING_COMPLETE,function(){i._msectl.endOfStream(),i._emitter.emit(f.default.LOADING_COMPLETE)}),this._transmuxer.on(p.default.RECOVERED_EARLY_EOF,function(){i._emitter.emit(f.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(p.default.IO_ERROR,function(e,t){i._emitter.emit(f.default.ERROR,b.ErrorTypes.NETWORK_ERROR,e,t)}),this._transmuxer.on(p.default.DEMUX_ERROR,function(e,t){i._emitter.emit(f.default.ERROR,b.ErrorTypes.MEDIA_ERROR,e,{code:-1,msg:t})}),this._transmuxer.on(p.default.MEDIA_INFO,function(e){i._mediaInfo=e,i._emitter.emit(f.default.MEDIA_INFO,Object.assign({},e))}),this._transmuxer.on(p.default.STATISTICS_INFO,function(e){i._statisticsInfo=i._fillStatisticsInfo(e),i._emitter.emit(f.default.STATISTICS_INFO,Object.assign({},i._statisticsInfo))}),this._transmuxer.on(p.default.RECOMMEND_SEEKPOINT,function(e){i._mediaElement&&!i._config.accurateSeek&&(i._requestSetTime=!0,i._mediaElement.currentTime=e/1e3)}),this._transmuxer.open()))}},{key:"unload",value:function e(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}},{key:"play",value:function e(){return this._mediaElement.play()}},{key:"pause",value:function e(){this._mediaElement.pause()}},{key:"_fillStatisticsInfo",value:function e(t){if(t.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return t;var n=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var s=this._mediaElement.getVideoPlaybackQuality();i=s.totalVideoFrames,r=s.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):n=!1;return n&&(t.decodedFrames=i,t.droppedFrames=r),t}},{key:"_onmseUpdateEnd",value:function e(){if(this._config.lazyLoad&&!this._config.isLive){for(var t=this._mediaElement.buffered,n=this._mediaElement.currentTime,i=0,r=0,s=0;s<t.length;s++){var a=t.start(s),o=t.end(s);if(a<=n&&n<o){i=a,r=o;break}}r>=n+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(u.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}}},{key:"_onmseBufferFull",value:function e(){u.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()}},{key:"_suspendTransmuxer",value:function e(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}},{key:"_checkProgressAndResume",value:function e(){for(var t=this._mediaElement.currentTime,n=this._mediaElement.buffered,i=!1,r=0;r<n.length;r++){var s=n.start(r),a=n.end(r);if(s<=t&&t<a){t>=a-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(u.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}},{key:"_isTimepointBuffered",value:function e(t){for(var n=this._mediaElement.buffered,i=0;i<n.length;i++){var r=n.start(i),s=n.end(i);if(r<=t&&t<s)return!0}return!1}},{key:"_internalSeek",value:function e(t){var n=this._isTimepointBuffered(t),i=!1,r=0;if(t<1&&0<this._mediaElement.buffered.length){var s=this._mediaElement.buffered.start(0);(s<1&&t<s||d.default.safari)&&(i=!0,r=d.default.safari?.1:s)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=r;else if(n){if(this._alwaysSeekKeyframe){var a=this._msectl.getNearestKeyframe(Math.floor(1e3*t));this._requestSetTime=!0,this._mediaElement.currentTime=null!=a?a.dts/1e3:t}else this._requestSetTime=!0,this._mediaElement.currentTime=t;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(t),this._transmuxer.seek(Math.floor(1e3*t)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=t)}},{key:"_checkAndApplyUnbufferedSeekpoint",value:function e(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var t=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(t)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(t),this._transmuxer.seek(Math.floor(1e3*t)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=t))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},{key:"_checkAndResumeStuckPlayback",value:function e(t){var n=this._mediaElement;if(t||!this._receivedCanPlay||n.readyState<2){var i=n.buffered;0<i.length&&n.currentTime<i.start(0)&&(u.default.w(this.TAG,"Playback seems stuck at "+n.currentTime+", seek to "+i.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}},{key:"_onvLoadedMetadata",value:function e(t){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}},{key:"_onvSeeking",value:function e(t){var n=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(n<1&&0<i.length){var r=i.start(0);if(r<1&&n<r||d.default.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=d.default.safari?.1:r)}if(this._isTimepointBuffered(n)){if(this._alwaysSeekKeyframe){var s=this._msectl.getNearestKeyframe(Math.floor(1e3*n));null!=s&&(this._requestSetTime=!0,this._mediaElement.currentTime=s.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:n,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}}},{key:"_onvCanPlay",value:function e(t){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}},{key:"_onvStalled",value:function e(t){this._checkAndResumeStuckPlayback(!0)}},{key:"_onvProgress",value:function e(t){this._checkAndResumeStuckPlayback()}},{key:"type",get:function e(){return this._type}},{key:"buffered",get:function e(){return this._mediaElement.buffered}},{key:"duration",get:function e(){return this._mediaElement.duration}},{key:"volume",get:function e(){return this._mediaElement.volume},set:function e(t){this._mediaElement.volume=t}},{key:"muted",get:function e(){return this._mediaElement.muted},set:function e(t){this._mediaElement.muted=t}},{key:"currentTime",get:function e(){return this._mediaElement?this._mediaElement.currentTime:0},set:function e(t){this._mediaElement?this._internalSeek(t):this._pendingSeekTime=t}},{key:"mediaInfo",get:function e(){return Object.assign({},this._mediaInfo)}},{key:"statisticsInfo",get:function e(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}}]),i}();n.default=R},{"../config.js":5,"../core/mse-controller.js":9,"../core/mse-events.js":10,"../core/transmuxer.js":11,"../core/transmuxing-events.js":13,"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./player-errors.js":34,"./player-events.js":35,events:2}],33:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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},r=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),s,a=h(e("events")),o,u=h(e("./player-events.js")),l=e("../config.js"),d=e("../utils/exception.js");function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var c=function(){function n(e,t){if(f(this,n),this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new a.default,this._config=(0,l.createDefaultConfig)(),"object"===(void 0===t?"undefined":i(t))&&Object.assign(this._config,t),"flv"===e.type.toLowerCase())throw new d.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new d.InvalidArgumentException("NativePlayer("+e.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return r(n,[{key:"destroy",value:function e(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function e(t,n){var i=this;t===u.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){i._emitter.emit(u.default.MEDIA_INFO,i.mediaInfo)}):t===u.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){i._emitter.emit(u.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(t,n)}},{key:"off",value:function e(t,n){this._emitter.removeListener(t,n)}},{key:"attachMediaElement",value:function e(t){if((this._mediaElement=t).addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{t.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function e(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"load",value:function e(){if(!this._mediaElement)throw new d.IllegalStateException("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,0<this._mediaElement.readyState&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}},{key:"unload",value:function e(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"play",value:function e(){return this._mediaElement.play()}},{key:"pause",value:function e(){this._mediaElement.pause()}},{key:"_onvLoadedMetadata",value:function e(t){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(u.default.MEDIA_INFO,this.mediaInfo)}},{key:"_reportStatisticsInfo",value:function e(){this._emitter.emit(u.default.STATISTICS_INFO,this.statisticsInfo)}},{key:"type",get:function e(){return this._type}},{key:"buffered",get:function e(){return this._mediaElement.buffered}},{key:"duration",get:function e(){return this._mediaElement.duration}},{key:"volume",get:function e(){return this._mediaElement.volume},set:function e(t){this._mediaElement.volume=t}},{key:"muted",get:function e(){return this._mediaElement.muted},set:function e(t){this._mediaElement.muted=t}},{key:"currentTime",get:function e(){return this._mediaElement?this._mediaElement.currentTime:0},set:function e(t){this._mediaElement?this._mediaElement.currentTime=t:this._pendingSeekTime=t}},{key:"mediaInfo",get:function e(){var t,n={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(n.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(n.width=this._mediaElement.videoWidth,n.height=this._mediaElement.videoHeight)),n}},{key:"statisticsInfo",get:function e(){var t={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return t;var n=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var s=this._mediaElement.getVideoPlaybackQuality();i=s.totalVideoFrames,r=s.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):n=!1;return n&&(t.decodedFrames=i,t.droppedFrames=r),t}}]),n}();n.default=c},{"../config.js":5,"../utils/exception.js":40,"./player-events.js":35,events:2}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorDetails=n.ErrorTypes=void 0;var i=e("../io/loader.js"),r,s=a(e("../demux/demux-errors.js"));function a(e){return e&&e.__esModule?e:{default:e}}var o=n.ErrorTypes={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},u=n.ErrorDetails={NETWORK_EXCEPTION:i.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:i.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:i.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:i.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:s.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:s.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:s.default.CODEC_UNSUPPORTED}},{"../demux/demux-errors.js":16,"../io/loader.js":24}],35:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",STATISTICS_INFO:"statistics_info"};n.default=i},{}],36:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(){r(this,e)}return i(e,null,[{key:"getSilentFrame",value:function e(t,n){if("mp4a.40.2"===t){if(1===n)return new Uint8Array([0,200,0,128,35,128]);if(2===n)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===n)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===n)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===n)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===n)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===n)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===n)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===n)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}}]),e}();n.default=s},{}],37:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function f(){r(this,f)}return i(f,null,[{key:"init",value:function e(){for(var t in f.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]})f.types.hasOwnProperty(t)&&(f.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=f.constants={};n.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),n.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),n.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSC=n.STCO=n.STTS,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),n.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function e(t){for(var n=8,i=null,r=Array.prototype.slice.call(arguments,1),s=r.length,a=0;a<s;a++)n+=r[a].byteLength;(i=new Uint8Array(n))[0]=n>>>24&255,i[1]=n>>>16&255,i[2]=n>>>8&255,i[3]=255&n,i.set(t,4);for(var o=8,u=0;u<s;u++)i.set(r[u],o),o+=r[u].byteLength;return i}},{key:"generateInitSegment",value:function e(t){var n=f.box(f.types.ftyp,f.constants.FTYP),i=f.moov(t),r=new Uint8Array(n.byteLength+i.byteLength);return r.set(n,0),r.set(i,n.byteLength),r}},{key:"moov",value:function e(t){var n=f.mvhd(t.timescale,t.duration),i=f.trak(t),r=f.mvex(t);return f.box(f.types.moov,n,i,r)}},{key:"mvhd",value:function e(t,n){return f.box(f.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function e(t){return f.box(f.types.trak,f.tkhd(t),f.mdia(t))}},{key:"tkhd",value:function e(t){var n=t.id,i=t.duration,r=t.presentWidth,s=t.presentHeight;return f.box(f.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,s>>>8&255,255&s,0,0]))}},{key:"mdia",value:function e(t){return f.box(f.types.mdia,f.mdhd(t),f.hdlr(t),f.minf(t))}},{key:"mdhd",value:function e(t){var n=t.timescale,i=t.duration;return f.box(f.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}},{key:"hdlr",value:function e(t){var n=null;return n="audio"===t.type?f.constants.HDLR_AUDIO:f.constants.HDLR_VIDEO,f.box(f.types.hdlr,n)}},{key:"minf",value:function e(t){var n=null;return n="audio"===t.type?f.box(f.types.smhd,f.constants.SMHD):f.box(f.types.vmhd,f.constants.VMHD),f.box(f.types.minf,n,f.dinf(),f.stbl(t))}},{key:"dinf",value:function e(){var t;return f.box(f.types.dinf,f.box(f.types.dref,f.constants.DREF))}},{key:"stbl",value:function e(t){var n;return f.box(f.types.stbl,f.stsd(t),f.box(f.types.stts,f.constants.STTS),f.box(f.types.stsc,f.constants.STSC),f.box(f.types.stsz,f.constants.STSZ),f.box(f.types.stco,f.constants.STCO))}},{key:"stsd",value:function e(t){return"audio"===t.type?"mp3"===t.codec?f.box(f.types.stsd,f.constants.STSD_PREFIX,f.mp3(t)):f.box(f.types.stsd,f.constants.STSD_PREFIX,f.mp4a(t)):f.box(f.types.stsd,f.constants.STSD_PREFIX,f.avc1(t))}},{key:"mp3",value:function e(t){var n=t.channelCount,i=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return f.box(f.types[".mp3"],r)}},{key:"mp4a",value:function e(t){var n=t.channelCount,i=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return f.box(f.types.mp4a,r,f.esds(t))}},{key:"esds",value:function e(t){var n=t.config||[],i=n.length,r=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(n).concat([6,1,2]));return f.box(f.types.esds,r)}},{key:"avc1",value:function e(t){var n=t.avcc,i=t.codecWidth,r=t.codecHeight,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return f.box(f.types.avc1,s,f.box(f.types.avcC,n))}},{key:"mvex",value:function e(t){return f.box(f.types.mvex,f.trex(t))}},{key:"trex",value:function e(t){var n=t.id,i=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return f.box(f.types.trex,i)}},{key:"moof",value:function e(t,n){return f.box(f.types.moof,f.mfhd(t.sequenceNumber),f.traf(t,n))}},{key:"mfhd",value:function e(t){var n=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return f.box(f.types.mfhd,n)}},{key:"traf",value:function e(t,n){var i=t.id,r=f.box(f.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=f.box(f.types.tfdt,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),a=f.sdtp(t),o=f.trun(t,a.byteLength+16+16+8+16+8+8);return f.box(f.types.traf,r,s,o,a)}},{key:"sdtp",value:function e(t){for(var n=t.samples||[],i=n.length,r=new Uint8Array(4+i),s=0;s<i;s++){var a=n[s].flags;r[s+4]=a.isLeading<<6|a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy}return f.box(f.types.sdtp,r)}},{key:"trun",value:function e(t,n){var i=t.samples||[],r=i.length,s=12+16*r,a=new Uint8Array(s);n+=8+s,a.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var o=0;o<r;o++){var u=i[o].duration,l=i[o].size,d=i[o].flags,h=i[o].cts;a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,l>>>24&255,l>>>16&255,l>>>8&255,255&l,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.isNonSync,0,0,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*o)}return f.box(f.types.trun,a)}},{key:"mdat",value:function e(t){return f.box(f.types.mdat,t)}}]),f}();s.init(),n.default=s},{}],38:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r,$=l(e("../utils/logger.js")),s,ee=l(e("./mp4-generator.js")),a,te=l(e("./aac-silent.js")),o,ne=l(e("../utils/browser.js")),ie=e("../core/media-segment-info.js"),u=e("../utils/exception.js");function l(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var h=function(){function t(e){d(this,t),this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new ie.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new ie.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!ne.default.chrome||!(ne.default.version.major<50||50===ne.default.version.major&&ne.default.version.build<2661)),this._fillSilentAfterSeek=ne.default.msedge||ne.default.msie,this._mp3UseMpegAudio=!ne.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return i(t,[{key:"destroy",value:function e(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}},{key:"bindDataSource",value:function e(t){return t.onDataAvailable=this.remux.bind(this),t.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}},{key:"insertDiscontinuity",value:function e(){this._audioNextDts=this._videoNextDts=void 0}},{key:"seek",value:function e(t){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}},{key:"remux",value:function e(t,n){if(!this._onMediaSegment)throw new u.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(t,n),this._remuxVideo(n),this._remuxAudio(t)}},{key:"_onTrackMetadataReceived",value:function e(t,n){var i=null,r="mp4",s=n.codec;if("audio"===t)i="mp3"===(this._audioMeta=n).codec&&this._mp3UseMpegAudio?(r="mpeg",s="",new Uint8Array):ee.default.generateInitSegment(n);else{if("video"!==t)return;this._videoMeta=n,i=ee.default.generateInitSegment(n)}if(!this._onInitSegment)throw new u.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(t,{type:t,data:i.buffer,codec:s,container:t+"/"+r,mediaDuration:n.duration})}},{key:"_calculateDtsBase",value:function e(t,n){this._dtsBaseInited||(t.samples&&t.samples.length&&(this._audioDtsBase=t.samples[0].dts),n.samples&&n.samples.length&&(this._videoDtsBase=n.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}},{key:"flushStashedSamples",value:function e(){var t=this._videoStashedLastSample,n=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=t&&(i.samples.push(t),i.length=t.length);var r={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=n&&(r.samples.push(n),r.length=n.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(r,!0)}},{key:"_remuxAudio",value:function e(t,n){if(null!=this._audioMeta){var i=t,r=i.samples,s=void 0,a=-1,o=-1,u=-1,l=this._audioMeta.refSampleDuration,d="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,h=this._dtsBaseInited&&void 0===this._audioNextDts,f=!1;if(r&&0!==r.length&&(1!==r.length||n)){var c=0,_=null,m=0;m=d?(c=0,i.length):(c=8)+i.length;var p=null;if(1<r.length&&(m-=(p=r.pop()).length),null!=this._audioStashedLastSample){var v=this._audioStashedLastSample;this._audioStashedLastSample=null,r.unshift(v),m+=v.length}null!=p&&(this._audioStashedLastSample=p);var g=r[0].dts-this._dtsBase;if(this._audioNextDts)s=g-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())s=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(f=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(g);if(null!=y){var E=g-(y.originalDts+y.duration),b;E<=3&&(E=0),s=g-(y.dts+y.duration+E)}else s=0}if(f){var S=g-s,k=this._videoSegmentInfoList.getLastSegmentBefore(g);if(null!=k&&k.beginDts<S){var L=te.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(L){var w=k.beginDts,R=S-k.beginDts;$.default.v(this.TAG,"InsertPrefixSilentAudio: dts: "+w+", duration: "+R),r.unshift({unit:L,dts:w,pts:w}),m+=L.byteLength}}else f=!1}for(var A=[],O=0;O<r.length;O++){var T=r[O],C=T.unit,I=T.dts-this._dtsBase,x=I-s;-1===a&&(a=x);var M=0,D,B;if(O!==r.length-1)M=r[O+1].dts-this._dtsBase-s-x;else if(null!=p)M=p.dts-this._dtsBase-s-x;else M=1<=A.length?A[A.length-1].duration:Math.floor(l);var j=!1,P=null;if(1.5*l<M&&"mp3"!==this._audioMeta.codec&&this._fillAudioTimestampGap&&!ne.default.safari){j=!0;var U=Math.abs(M-l),N=Math.ceil(U/l),F=x+l;$.default.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\ndts: "+(x+M)+" ms, expected: "+(x+Math.round(l))+" ms, delta: "+Math.round(U)+" ms, generate: "+N+" frames");var G=te.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);null==G&&($.default.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),G=C),P=[];for(var V=0;V<N;V++){var z=Math.round(F);if(0<P.length){var H=P[P.length-1];H.duration=z-H.dts}var K={dts:z,pts:z,cts:0,unit:G,size:G.byteLength,duration:0,originalDts:I,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};P.push(K),m+=C.byteLength,F+=l}var q=P[P.length-1];q.duration=x+M-q.dts,M=Math.round(l)}A.push({dts:x,pts:x,cts:0,unit:T.unit,size:T.unit.byteLength,duration:M,originalDts:I,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),j&&A.push.apply(A,P)}d?_=new Uint8Array(m):((_=new Uint8Array(m))[0]=m>>>24&255,_[1]=m>>>16&255,_[2]=m>>>8&255,_[3]=255&m,_.set(ee.default.types.mdat,4));for(var W=0;W<A.length;W++){var X=A[W].unit;_.set(X,c),c+=X.byteLength}var Y=A[A.length-1];o=Y.dts+Y.duration,this._audioNextDts=o;var Z=new ie.MediaSegmentInfo;Z.beginDts=a,Z.endDts=o,Z.beginPts=a,Z.endPts=o,Z.originalBeginDts=A[0].originalDts,Z.originalEndDts=Y.originalDts+Y.duration,Z.firstSample=new ie.SampleInfo(A[0].dts,A[0].pts,A[0].duration,A[0].originalDts,!1),Z.lastSample=new ie.SampleInfo(Y.dts,Y.pts,Y.duration,Y.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(Z),i.samples=A,i.sequenceNumber++;var Q=null;Q=d?new Uint8Array:ee.default.moof(i,a),i.samples=[],i.length=0;var J={type:"audio",data:this._mergeBoxes(Q,_).buffer,sampleCount:A.length,info:Z};d&&h&&(J.timestampOffset=a),this._onMediaSegment("audio",J)}}}},{key:"_remuxVideo",value:function e(t,n){if(null!=this._videoMeta){var i=t,r=i.samples,s=void 0,a=-1,o=-1,u=-1,l=-1;if(r&&0!==r.length&&(1!==r.length||n)){var d=8,h=null,f=8+t.length,c=null;if(1<r.length&&(f-=(c=r.pop()).length),null!=this._videoStashedLastSample){var _=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(_),f+=_.length}null!=c&&(this._videoStashedLastSample=c);var m=r[0].dts-this._dtsBase;if(this._videoNextDts)s=m-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())s=0;else{var p=this._videoSegmentInfoList.getLastSampleBefore(m);if(null!=p){var v=m-(p.originalDts+p.duration),g;v<=3&&(v=0),s=m-(p.dts+p.duration+v)}else s=0}for(var y=new ie.MediaSegmentInfo,E=[],b=0;b<r.length;b++){var S=r[b],k=S.dts-this._dtsBase,L=S.isKeyframe,w=k-s,R=S.cts,A=w+R;-1===a&&(a=w,u=A);var O=0,T,C;if(b!==r.length-1)O=r[b+1].dts-this._dtsBase-s-w;else if(null!=c)O=c.dts-this._dtsBase-s-w;else O=1<=E.length?E[E.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(L){var I=new ie.SampleInfo(w,A,O,S.dts,!0);I.fileposition=S.fileposition,y.appendSyncPoint(I)}E.push({dts:w,pts:A,cts:R,units:S.units,size:S.length,isKeyframe:L,duration:O,originalDts:k,flags:{isLeading:0,dependsOn:L?2:1,isDependedOn:L?1:0,hasRedundancy:0,isNonSync:L?0:1}})}(h=new Uint8Array(f))[0]=f>>>24&255,h[1]=f>>>16&255,h[2]=f>>>8&255,h[3]=255&f,h.set(ee.default.types.mdat,4);for(var x=0;x<E.length;x++)for(var M=E[x].units;M.length;){var D,B=M.shift().data;h.set(B,d),d+=B.byteLength}var j=E[E.length-1];if(o=j.dts+j.duration,l=j.pts+j.duration,this._videoNextDts=o,y.beginDts=a,y.endDts=o,y.beginPts=u,y.endPts=l,y.originalBeginDts=E[0].originalDts,y.originalEndDts=j.originalDts+j.duration,y.firstSample=new ie.SampleInfo(E[0].dts,E[0].pts,E[0].duration,E[0].originalDts,E[0].isKeyframe),y.lastSample=new ie.SampleInfo(j.dts,j.pts,j.duration,j.originalDts,j.isKeyframe),this._isLive||this._videoSegmentInfoList.append(y),i.samples=E,i.sequenceNumber++,this._forceFirstIDR){var P=E[0].flags;P.dependsOn=2,P.isNonSync=0}var U=ee.default.moof(i,a);i.samples=[],i.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(U,h).buffer,sampleCount:E.length,info:y})}}}},{key:"_mergeBoxes",value:function e(t,n){var i=new Uint8Array(t.byteLength+n.byteLength);return i.set(t,0),i.set(n,t.byteLength),i}},{key:"onInitSegment",get:function e(){return this._onInitSegment},set:function e(t){this._onInitSegment=t}},{key:"onMediaSegment",get:function e(){return this._onMediaSegment},set:function e(t){this._onMediaSegment=t}}]),t}();n.default=h},{"../core/media-segment-info.js":8,"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./aac-silent.js":36,"./mp4-generator.js":37}],39:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var h={};function i(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0<=e.indexOf("trident")&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],n=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],i={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:n[0]||""},r={};if(i.browser){r[i.browser]=!0;var s=i.majorVersion.split(".");r.version={major:parseInt(i.majorVersion,10),string:i.version},1<s.length&&(r.version.minor=parseInt(s[1],10)),2<s.length&&(r.version.build=parseInt(s[2],10))}if(i.platform&&(r[i.platform]=!0),(r.chrome||r.opr||r.safari)&&(r.webkit=!0),r.rv||r.iemobile){r.rv&&delete r.rv;var a="msie";r[i.browser=a]=!0}if(r.edge){delete r.edge;var o="msedge";r[i.browser=o]=!0}if(r.opr){var u="opera";r[i.browser=u]=!0}if(r.safari&&r.android){var l="android";r[i.browser=l]=!0}for(var d in r.name=i.browser,r.platform=i.platform,h)h.hasOwnProperty(d)&&delete h[d];Object.assign(h,r)}i(),n.default=h},{}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n.RuntimeException=function(){function t(e){a(this,t),this._message=e}return i(t,[{key:"toString",value:function e(){return this.name+": "+this.message}},{key:"name",get:function e(){return"RuntimeException"}},{key:"message",get:function e(){return this._message}}]),t}(),u=n.IllegalStateException=function(e){function t(e){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return s(t,e),i(t,[{key:"name",get:function e(){return"IllegalStateException"}}]),t}(o),l=n.InvalidArgumentException=function(e){function t(e){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return s(t,e),i(t,[{key:"name",get:function e(){return"InvalidArgumentException"}}]),t}(o),d=n.NotImplementedException=function(e){function t(e){return a(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return s(t,e),i(t,[{key:"name",get:function e(){return"NotImplementedException"}}]),t}(o)},{}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),r,s=a(e("events"));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=function(){function r(){o(this,r)}return i(r,null,[{key:"e",value:function e(t,n){t&&!r.FORCE_GLOBAL_TAG||(t=r.GLOBAL_TAG);var i="["+t+"] > "+n;r.ENABLE_CALLBACK&&r.emitter.emit("log","error",i),r.ENABLE_ERROR&&(console.error?console.error(i):console.warn?console.warn(i):console.log(i))}},{key:"i",value:function e(t,n){t&&!r.FORCE_GLOBAL_TAG||(t=r.GLOBAL_TAG);var i="["+t+"] > "+n;r.ENABLE_CALLBACK&&r.emitter.emit("log","info",i),r.ENABLE_INFO&&(console.info?console.info(i):console.log(i))}},{key:"w",value:function e(t,n){t&&!r.FORCE_GLOBAL_TAG||(t=r.GLOBAL_TAG);var i="["+t+"] > "+n;r.ENABLE_CALLBACK&&r.emitter.emit("log","warn",i),r.ENABLE_WARN&&(console.warn?console.warn(i):console.log(i))}},{key:"d",value:function e(t,n){t&&!r.FORCE_GLOBAL_TAG||(t=r.GLOBAL_TAG);var i="["+t+"] > "+n;r.ENABLE_CALLBACK&&r.emitter.emit("log","debug",i),r.ENABLE_DEBUG&&(console.debug?console.debug(i):console.log(i))}},{key:"v",value:function e(t,n){t&&!r.FORCE_GLOBAL_TAG||(t=r.GLOBAL_TAG);var i="["+t+"] > "+n;r.ENABLE_CALLBACK&&r.emitter.emit("log","verbose",i),r.ENABLE_VERBOSE&&console.log(i)}}]),r}();u.GLOBAL_TAG="flv.js",u.FORCE_GLOBAL_TAG=!1,u.ENABLE_ERROR=!0,u.ENABLE_INFO=!0,u.ENABLE_WARN=!0,u.ENABLE_DEBUG=!0,u.ENABLE_VERBOSE=!0,u.ENABLE_CALLBACK=!1,u.emitter=new s.default,n.default=u},{events:2}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}(),i,s=u(e("events")),a,o=u(e("./logger.js"));function u(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=function(){function i(){l(this,i)}return r(i,null,[{key:"getConfig",value:function e(){return{globalTag:o.default.GLOBAL_TAG,forceGlobalTag:o.default.FORCE_GLOBAL_TAG,enableVerbose:o.default.ENABLE_VERBOSE,enableDebug:o.default.ENABLE_DEBUG,enableInfo:o.default.ENABLE_INFO,enableWarn:o.default.ENABLE_WARN,enableError:o.default.ENABLE_ERROR,enableCallback:o.default.ENABLE_CALLBACK}}},{key:"applyConfig",value:function e(t){o.default.GLOBAL_TAG=t.globalTag,o.default.FORCE_GLOBAL_TAG=t.forceGlobalTag,o.default.ENABLE_VERBOSE=t.enableVerbose,o.default.ENABLE_DEBUG=t.enableDebug,o.default.ENABLE_INFO=t.enableInfo,o.default.ENABLE_WARN=t.enableWarn,o.default.ENABLE_ERROR=t.enableError,o.default.ENABLE_CALLBACK=t.enableCallback}},{key:"_notifyChange",value:function e(){var t=i.emitter;if(0<t.listenerCount("change")){var n=i.getConfig();t.emit("change",n)}}},{key:"registerListener",value:function e(t){i.emitter.addListener("change",t)}},{key:"removeListener",value:function e(t){i.emitter.removeListener("change",t)}},{key:"addLogListener",value:function e(t){o.default.emitter.addListener("log",t),0<o.default.emitter.listenerCount("log")&&(o.default.ENABLE_CALLBACK=!0,i._notifyChange())}},{key:"removeLogListener",value:function e(t){o.default.emitter.removeListener("log",t),0===o.default.emitter.listenerCount("log")&&(o.default.ENABLE_CALLBACK=!1,i._notifyChange())}},{key:"forceGlobalTag",get:function e(){return o.default.FORCE_GLOBAL_TAG},set:function e(t){o.default.FORCE_GLOBAL_TAG=t,i._notifyChange()}},{key:"globalTag",get:function e(){return o.default.GLOBAL_TAG},set:function e(t){o.default.GLOBAL_TAG=t,i._notifyChange()}},{key:"enableAll",get:function e(){return o.default.ENABLE_VERBOSE&&o.default.ENABLE_DEBUG&&o.default.ENABLE_INFO&&o.default.ENABLE_WARN&&o.default.ENABLE_ERROR},set:function e(t){o.default.ENABLE_VERBOSE=t,o.default.ENABLE_DEBUG=t,o.default.ENABLE_INFO=t,o.default.ENABLE_WARN=t,o.default.ENABLE_ERROR=t,i._notifyChange()}},{key:"enableDebug",get:function e(){return o.default.ENABLE_DEBUG},set:function e(t){o.default.ENABLE_DEBUG=t,i._notifyChange()}},{key:"enableVerbose",get:function e(){return o.default.ENABLE_VERBOSE},set:function e(t){o.default.ENABLE_VERBOSE=t,i._notifyChange()}},{key:"enableInfo",get:function e(){return o.default.ENABLE_INFO},set:function e(t){o.default.ENABLE_INFO=t,i._notifyChange()}},{key:"enableWarn",get:function e(){return o.default.ENABLE_WARN},set:function e(t){o.default.ENABLE_WARN=t,i._notifyChange()}},{key:"enableError",get:function e(){return o.default.ENABLE_ERROR},set:function e(t){o.default.ENABLE_ERROR=t,i._notifyChange()}}]),i}();d.emitter=new s.default,n.default=d},{"./logger.js":41,events:2}],43:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(){r(this,e)}return i(e,null,[{key:"install",value:function e(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t},"function"!=typeof self.Promise&&t("es6-promise").polyfill()}}]),e}();s.install(),n.default=s},{"es6-promise":1}],44:[function(e,t,n){"use strict";function u(e,t,n){var i=e;if(t+n<i.length){for(;n--;)if(128!=(192&i[++t]))return!1;return!0}return!1}function i(e){for(var t=[],n=e,i=0,r=e.length;i<r;)if(n[i]<128)t.push(String.fromCharCode(n[i])),++i;else{if(n[i]<192);else if(n[i]<224){if(u(n,i,1)){var s=(31&n[i])<<6|63&n[i+1];if(128<=s){t.push(String.fromCharCode(65535&s)),i+=2;continue}}}else if(n[i]<240){if(u(n,i,2)){var a=(15&n[i])<<12|(63&n[i+1])<<6|63&n[i+2];if(2048<=a&&55296!=(63488&a)){t.push(String.fromCharCode(65535&a)),i+=3;continue}}}else if(n[i]<248&&u(n,i,3)){var o=(7&n[i])<<18|(63&n[i+1])<<12|(63&n[i+2])<<6|63&n[i+3];if(65536<o&&o<1114112){o-=65536,t.push(String.fromCharCode(o>>>10|55296)),t.push(String.fromCharCode(1023&o|56320)),i+=4;continue}}t.push(String.fromCharCode(65533)),++i}return t.join("")}Object.defineProperty(n,"__esModule",{value:!0}),n.default=i},{}]},{},[21])(21)});
|